1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2  *
3  * Copyright (C) 2013-2015 Richard Hughes <richard@hughsie.com>
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 #ifndef __DNF_PACKAGE_H
23 #define __DNF_PACKAGE_H
24 
25 #include <glib.h>
26 
27 #include "hy-package.h"
28 
29 #include "dnf-repo.h"
30 #include "dnf-state.h"
31 
32 G_BEGIN_DECLS
33 
34 /**
35  * DnfPackageInfo:
36  * @DNF_PACKAGE_INFO_UNKNOWN:                   Unknown state
37  * @DNF_PACKAGE_INFO_UPDATE:                    Package update
38  * @DNF_PACKAGE_INFO_INSTALL:                   Package install
39  * @DNF_PACKAGE_INFO_REMOVE:                    Package remove
40  * @DNF_PACKAGE_INFO_CLEANUP:                   Package cleanup
41  * @DNF_PACKAGE_INFO_OBSOLETE:                  Package obsolete
42  * @DNF_PACKAGE_INFO_REINSTALL:                 Package re-install
43  * @DNF_PACKAGE_INFO_DOWNGRADE:                 Package downgrade
44  *
45  * The info enum code.
46  **/
47 typedef enum {
48         DNF_PACKAGE_INFO_UNKNOWN                        = 0,
49         DNF_PACKAGE_INFO_UPDATE                         = 11,
50         DNF_PACKAGE_INFO_INSTALL                        = 12,
51         DNF_PACKAGE_INFO_REMOVE                         = 13,
52         DNF_PACKAGE_INFO_CLEANUP                        = 14,
53         DNF_PACKAGE_INFO_OBSOLETE                       = 15,
54         DNF_PACKAGE_INFO_REINSTALL                      = 19,
55         DNF_PACKAGE_INFO_DOWNGRADE                      = 20,
56         /*< private >*/
57         DNF_PACKAGE_INFO_LAST
58 } DnfPackageInfo;
59 
60 DnfRepo         *dnf_package_get_repo                   (DnfPackage     *pkg);
61 void             dnf_package_set_repo                   (DnfPackage     *pkg,
62                                                          DnfRepo        *repo);
63 const gchar     *dnf_package_get_filename               (DnfPackage     *pkg);
64 void             dnf_package_set_filename               (DnfPackage     *pkg,
65                                                          const gchar    *filename);
66 const gchar     *dnf_package_get_origin                 (DnfPackage     *pkg);
67 void             dnf_package_set_origin                 (DnfPackage     *pkg,
68                                                          const gchar    *origin);
69 const gchar     *dnf_package_get_package_id             (DnfPackage     *pkg);
70 DnfPackageInfo   dnf_package_get_info                   (DnfPackage     *pkg);
71 void             dnf_package_set_info                   (DnfPackage     *pkg,
72                                                          DnfPackageInfo  info);
73 DnfStateAction   dnf_package_get_action                 (DnfPackage     *pkg);
74 void             dnf_package_set_action                 (DnfPackage     *pkg,
75                                                          DnfStateAction  action);
76 gboolean         dnf_package_get_user_action            (DnfPackage     *pkg);
77 void             dnf_package_set_user_action            (DnfPackage     *pkg,
78                                                          gboolean        user_action);
79 gboolean         dnf_package_is_gui                     (DnfPackage     *pkg);
80 gboolean         dnf_package_is_devel                   (DnfPackage     *pkg);
81 gboolean         dnf_package_is_local                   (DnfPackage     *pkg);
82 gchar           *dnf_package_get_local_baseurl          (DnfPackage     *pkg,
83                                                          GError         **error);
84 gboolean         dnf_package_is_downloaded              (DnfPackage     *pkg);
85 gboolean         dnf_package_is_installonly             (DnfPackage     *pkg);
86 const gchar     *dnf_package_get_pkgid                  (DnfPackage     *pkg);
87 void             dnf_package_set_pkgid                  (DnfPackage     *pkg,
88                                                          const gchar    *pkgid);
89 guint            dnf_package_get_cost                   (DnfPackage     *pkg);
90 gchar           *dnf_package_download                   (DnfPackage     *pkg,
91                                                          const gchar    *directory,
92                                                          DnfState       *state,
93                                                          GError         **error);
94 gboolean         dnf_package_check_filename             (DnfPackage     *pkg,
95                                                          gboolean       *valid,
96                                                          GError         **error);
97 
98 gboolean         dnf_package_array_download             (GPtrArray      *packages,
99                                                          const gchar    *directory,
100                                                          DnfState       *state,
101                                                          GError         **error);
102 guint64          dnf_package_array_get_download_size    (GPtrArray      *packages);
103 
104 G_END_DECLS
105 
106 #endif /* __DNF_PACKAGE_H */
107