| 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 |
/** |
| 23 |
* SECTION:pk-repo-signature-required |
| 24 |
* @short_description: RepoSignatureRequired object |
| 25 |
* |
| 26 |
* This GObject represents a repo_signature_required from a transaction. |
| 27 |
* These objects represent single items of data from the transaction, and are |
| 28 |
* often present in lists (#PkResults) or just refcounted in client programs. |
| 29 |
*/ |
| 30 |
|
| 31 |
#include "config.h" |
| 32 |
|
| 33 |
#include <glib-object.h> |
| 34 |
|
| 35 |
#include <packagekit-glib2/pk-repo-signature-required.h> |
| 36 |
#include <packagekit-glib2/pk-enum.h> |
| 37 |
#include <packagekit-glib2/pk-enum-types.h> |
| 38 |
|
| 39 |
static void pk_repo_signature_required_finalize (GObject *object); |
| 40 |
|
| 41 |
/** |
| 42 |
* PkRepoSignatureRequiredPrivate: |
| 43 |
* |
| 44 |
* Private #PkRepoSignatureRequired data |
| 45 |
**/ |
| 46 |
struct _PkRepoSignatureRequiredPrivate |
| 47 |
{ |
| 48 |
gchar *package_id; |
| 49 |
gchar *repository_name; |
| 50 |
gchar *key_url; |
| 51 |
gchar *key_userid; |
| 52 |
gchar *key_id; |
| 53 |
gchar *key_fingerprint; |
| 54 |
gchar *key_timestamp; |
| 55 |
PkSigTypeEnum type; |
| 56 |
}; |
| 57 |
|
| 58 |
enum { |
| 59 |
PROP_0, |
| 60 |
PROP_PACKAGE_ID, |
| 61 |
PROP_REPOSITORY_NAME, |
| 62 |
PROP_KEY_URL, |
| 63 |
PROP_KEY_USERID, |
| 64 |
PROP_KEY_ID, |
| 65 |
PROP_KEY_FINGERPRINT, |
| 66 |
PROP_KEY_TIMESTAMP, |
| 67 |
PROP_TYPE, |
| 68 |
PROP_LAST |
| 69 |
}; |
| 70 |
|
| 71 |
G_DEFINE_TYPE_WITH_PRIVATE (PkRepoSignatureRequired, pk_repo_signature_required, PK_TYPE_SOURCE) |
| 72 |
#define GET_PRIVATE(o) (pk_repo_signature_required_get_instance_private (o)) |
| 73 |
|
| 74 |
/* |
| 75 |
* pk_repo_signature_required_get_property: |
| 76 |
**/ |
| 77 |
static void |
| 78 |
pk_repo_signature_required_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) |
| 79 |
{ |
| 80 |
PkRepoSignatureRequired *repo_signature_required = PK_REPO_SIGNATURE_REQUIRED (object); |
| 81 |
PkRepoSignatureRequiredPrivate *priv = GET_PRIVATE(repo_signature_required); |
| 82 |
|
| 83 |
switch (prop_id) { |
| 84 |
case PROP_PACKAGE_ID: |
| 85 |
g_value_set_string (value, priv->package_id); |
| 86 |
break; |
| 87 |
case PROP_REPOSITORY_NAME: |
| 88 |
g_value_set_string (value, priv->repository_name); |
| 89 |
break; |
| 90 |
case PROP_KEY_URL: |
| 91 |
g_value_set_string (value, priv->key_url); |
| 92 |
break; |
| 93 |
case PROP_KEY_USERID: |
| 94 |
g_value_set_string (value, priv->key_userid); |
| 95 |
break; |
| 96 |
case PROP_KEY_ID: |
| 97 |
g_value_set_string (value, priv->key_id); |
| 98 |
break; |
| 99 |
case PROP_KEY_FINGERPRINT: |
| 100 |
g_value_set_string (value, priv->key_fingerprint); |
| 101 |
break; |
| 102 |
case PROP_KEY_TIMESTAMP: |
| 103 |
g_value_set_string (value, priv->key_timestamp); |
| 104 |
break; |
| 105 |
case PROP_TYPE: |
| 106 |
g_value_set_enum (value, priv->type); |
| 107 |
break; |
| 108 |
default: |
| 109 |
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); |
| 110 |
break; |
| 111 |
} |
| 112 |
} |
| 113 |
|
| 114 |
/* |
| 115 |
* pk_repo_signature_required_set_property: |
| 116 |
**/ |
| 117 |
static void |
| 118 |
pk_repo_signature_required_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) |
| 119 |
{ |
| 120 |
PkRepoSignatureRequired *repo_signature_required = PK_REPO_SIGNATURE_REQUIRED (object); |
| 121 |
PkRepoSignatureRequiredPrivate *priv = GET_PRIVATE(repo_signature_required); |
| 122 |
|
| 123 |
switch (prop_id) { |
| 124 |
case PROP_PACKAGE_ID: |
| 125 |
g_free (priv->package_id); |
| 126 |
priv->package_id = g_value_dup_string (value); |
| 127 |
break; |
| 128 |
case PROP_REPOSITORY_NAME: |
| 129 |
g_free (priv->repository_name); |
| 130 |
priv->repository_name = g_value_dup_string (value); |
| 131 |
break; |
| 132 |
case PROP_KEY_URL: |
| 133 |
g_free (priv->key_url); |
| 134 |
priv->key_url = g_value_dup_string (value); |
| 135 |
break; |
| 136 |
case PROP_KEY_USERID: |
| 137 |
g_free (priv->key_userid); |
| 138 |
priv->key_userid = g_value_dup_string (value); |
| 139 |
break; |
| 140 |
case PROP_KEY_ID: |
| 141 |
g_free (priv->key_id); |
| 142 |
priv->key_id = g_value_dup_string (value); |
| 143 |
break; |
| 144 |
case PROP_KEY_FINGERPRINT: |
| 145 |
g_free (priv->key_fingerprint); |
| 146 |
priv->key_fingerprint = g_value_dup_string (value); |
| 147 |
break; |
| 148 |
case PROP_KEY_TIMESTAMP: |
| 149 |
g_free (priv->key_timestamp); |
| 150 |
priv->key_timestamp = g_value_dup_string (value); |
| 151 |
break; |
| 152 |
case PROP_TYPE: |
| 153 |
priv->type = g_value_get_enum (value); |
| 154 |
break; |
| 155 |
default: |
| 156 |
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); |
| 157 |
break; |
| 158 |
} |
| 159 |
} |
| 160 |
|
| 161 |
/* |
| 162 |
* pk_repo_signature_required_class_init: |
| 163 |
**/ |
| 164 |
static void |
| 165 |
pk_repo_signature_required_class_init (PkRepoSignatureRequiredClass *klass) |
| 166 |
{ |
| 167 |
GParamSpec *pspec; |
| 168 |
GObjectClass *object_class = G_OBJECT_CLASS (klass); |
| 169 |
object_class->finalize = pk_repo_signature_required_finalize; |
| 170 |
object_class->get_property = pk_repo_signature_required_get_property; |
| 171 |
object_class->set_property = pk_repo_signature_required_set_property; |
| 172 |
|
| 173 |
/** |
| 174 |
* PkRepoSignatureRequired:package-id: |
| 175 |
* |
| 176 |
* Since: 0.5.4 |
| 177 |
*/ |
| 178 |
pspec = g_param_spec_string ("package-id", NULL, NULL, |
| 179 |
NULL, |
| 180 |
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); |
| 181 |
g_object_class_install_property (object_class, PROP_PACKAGE_ID, pspec); |
| 182 |
|
| 183 |
/** |
| 184 |
* PkRepoSignatureRequired:repository-name: |
| 185 |
* |
| 186 |
* Since: 0.5.4 |
| 187 |
*/ |
| 188 |
pspec = g_param_spec_string ("repository-name", NULL, NULL, |
| 189 |
NULL, |
| 190 |
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); |
| 191 |
g_object_class_install_property (object_class, PROP_REPOSITORY_NAME, pspec); |
| 192 |
|
| 193 |
/** |
| 194 |
* PkRepoSignatureRequired:key-url: |
| 195 |
* |
| 196 |
* Since: 0.5.4 |
| 197 |
*/ |
| 198 |
pspec = g_param_spec_string ("key-url", NULL, NULL, |
| 199 |
NULL, |
| 200 |
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); |
| 201 |
g_object_class_install_property (object_class, PROP_KEY_URL, pspec); |
| 202 |
|
| 203 |
/** |
| 204 |
* PkRepoSignatureRequired:key-userid: |
| 205 |
* |
| 206 |
* Since: 0.5.4 |
| 207 |
*/ |
| 208 |
pspec = g_param_spec_string ("key-userid", NULL, NULL, |
| 209 |
NULL, |
| 210 |
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); |
| 211 |
g_object_class_install_property (object_class, PROP_KEY_USERID, pspec); |
| 212 |
|
| 213 |
/** |
| 214 |
* PkRepoSignatureRequired:key-id: |
| 215 |
* |
| 216 |
* Since: 0.5.4 |
| 217 |
*/ |
| 218 |
pspec = g_param_spec_string ("key-id", NULL, NULL, |
| 219 |
NULL, |
| 220 |
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); |
| 221 |
g_object_class_install_property (object_class, PROP_KEY_ID, pspec); |
| 222 |
|
| 223 |
/** |
| 224 |
* PkRepoSignatureRequired:key-fingerprint: |
| 225 |
* |
| 226 |
* Since: 0.5.4 |
| 227 |
*/ |
| 228 |
pspec = g_param_spec_string ("key-fingerprint", NULL, NULL, |
| 229 |
NULL, |
| 230 |
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); |
| 231 |
g_object_class_install_property (object_class, PROP_KEY_FINGERPRINT, pspec); |
| 232 |
|
| 233 |
/** |
| 234 |
* PkRepoSignatureRequired:key-timestamp: |
| 235 |
* |
| 236 |
* Since: 0.5.4 |
| 237 |
*/ |
| 238 |
pspec = g_param_spec_string ("key-timestamp", NULL, NULL, |
| 239 |
NULL, |
| 240 |
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); |
| 241 |
g_object_class_install_property (object_class, PROP_KEY_TIMESTAMP, pspec); |
| 242 |
|
| 243 |
/** |
| 244 |
* PkRepoSignatureRequired:type: |
| 245 |
* |
| 246 |
* Since: 0.5.4 |
| 247 |
*/ |
| 248 |
pspec = g_param_spec_enum ("type", NULL, NULL, |
| 249 |
PK_TYPE_SIG_TYPE_ENUM, PK_SIGTYPE_ENUM_UNKNOWN, |
| 250 |
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); |
| 251 |
g_object_class_install_property (object_class, PROP_TYPE, pspec); |
| 252 |
} |
| 253 |
|
| 254 |
/* |
| 255 |
* pk_repo_signature_required_init: |
| 256 |
**/ |
| 257 |
static void |
| 258 |
pk_repo_signature_required_init (PkRepoSignatureRequired *repo_signature_required) |
| 259 |
{ |
| 260 |
repo_signature_required->priv = GET_PRIVATE(repo_signature_required); |
| 261 |
} |
| 262 |
|
| 263 |
/* |
| 264 |
* pk_repo_signature_required_finalize: |
| 265 |
**/ |
| 266 |
static void |
| 267 |
pk_repo_signature_required_finalize (GObject *object) |
| 268 |
{ |
| 269 |
PkRepoSignatureRequired *repo_signature_required = PK_REPO_SIGNATURE_REQUIRED (object); |
| 270 |
PkRepoSignatureRequiredPrivate *priv = GET_PRIVATE(repo_signature_required); |
| 271 |
|
| 272 |
g_clear_pointer (&priv->package_id, g_free); |
| 273 |
g_clear_pointer (&priv->repository_name, g_free); |
| 274 |
g_clear_pointer (&priv->key_url, g_free); |
| 275 |
g_clear_pointer (&priv->key_userid, g_free); |
| 276 |
g_clear_pointer (&priv->key_id, g_free); |
| 277 |
g_clear_pointer (&priv->key_fingerprint, g_free); |
| 278 |
g_clear_pointer (&priv->key_timestamp, g_free); |
| 279 |
|
| 280 |
G_OBJECT_CLASS (pk_repo_signature_required_parent_class)->finalize (object); |
| 281 |
} |
| 282 |
|
| 283 |
/** |
| 284 |
* pk_repo_signature_required_new: |
| 285 |
* |
| 286 |
* Return value: a new #PkRepoSignatureRequired object. |
| 287 |
* |
| 288 |
* Since: 0.5.4 |
| 289 |
**/ |
| 290 |
PkRepoSignatureRequired * |
| 291 |
pk_repo_signature_required_new (void) |
| 292 |
{ |
| 293 |
PkRepoSignatureRequired *repo_signature_required; |
| 294 |
repo_signature_required = g_object_new (PK_TYPE_REPO_SIGNATURE_REQUIRED, NULL); |
| 295 |
return PK_REPO_SIGNATURE_REQUIRED (repo_signature_required); |
| 296 |
} |