1 #ifndef PACKAGEKIT_H
2 #define PACKAGEKIT_H
3 
4 #include <e.h>
5 
6 
7 #define PKITV07 (ctxt->v_maj == 0) && (ctxt->v_min == 7)
8 #define PKITV08 (ctxt->v_maj == 0) && (ctxt->v_min == 8)
9 
10 // PackageKit dbus interface contains bitfield constants which
11 // aren't introspectable. we define here. still cannot find the proper doc!
12 #define PK_PROVIDES_ANY 1
13 #define PK_FILTER_ENUM_NOT_INSTALLED 1 << 3
14 #define PK_FILTER_ENUM_NEWEST 1 << 16
15 #define PK_FILTER_ENUM_ARCH 1 << 18
16 #define PK_TRANSACTION_FLAG_ENUM_ONLY_TRUSTED 1 << 1
17 
18 typedef enum {
19    PK_INFO_ENUM_UNKNOWN,
20    PK_INFO_ENUM_INSTALLED,
21    PK_INFO_ENUM_AVAILABLE,
22    PK_INFO_ENUM_LOW,
23    PK_INFO_ENUM_ENHANCEMENT,
24    PK_INFO_ENUM_NORMAL,
25    PK_INFO_ENUM_BUGFIX,
26    PK_INFO_ENUM_IMPORTANT,
27    PK_INFO_ENUM_SECURITY,
28    PK_INFO_ENUM_BLOCKED,
29    PK_INFO_ENUM_DOWNLOADING,
30    PK_INFO_ENUM_UPDATING,
31    PK_INFO_ENUM_INSTALLING,
32    PK_INFO_ENUM_REMOVING,
33    PK_INFO_ENUM_CLEANUP,
34    PK_INFO_ENUM_OBSOLETING,
35    PK_INFO_ENUM_COLLECTION_INSTALLED,
36    PK_INFO_ENUM_COLLECTION_AVAILABLE,
37    PK_INFO_ENUM_FINISHED,
38    PK_INFO_ENUM_REINSTALLING,
39    PK_INFO_ENUM_DOWNGRADING,
40    PK_INFO_ENUM_PREPARING,
41    PK_INFO_ENUM_DECOMPRESSING,
42    PK_INFO_ENUM_UNTRUSTED,
43    PK_INFO_ENUM_TRUSTED,
44    PK_INFO_ENUM_LAST,
45 } PackageKit_Package_Info;
46 
47 typedef struct _PackageKit_Config
48 {
49    int update_interval;
50    int last_update;
51    const char *manager_command;
52    int show_description;
53 } PackageKit_Config;
54 
55 typedef struct _E_PackageKit_Module_Context
56 {
57    E_Module *module;
58    Eina_List *instances;
59    Eina_List *packages;
60    Ecore_Timer *refresh_timer;
61    const char *error;
62    int v_maj;
63    int v_min;
64    int v_mic;
65 
66    Eldbus_Connection *conn;
67    Eldbus_Proxy *packagekit;
68    Eldbus_Proxy *transaction;
69    double transaction_progress;
70 
71    E_Config_DD *conf_edd;
72    PackageKit_Config *config;
73 
74 } E_PackageKit_Module_Context;
75 
76 typedef struct _E_PackageKit_Instance
77 {
78    E_PackageKit_Module_Context *ctxt;
79    E_Gadcon_Client *gcc;
80    Evas_Object *gadget;
81    E_Gadcon_Popup *popup;
82    Evas_Object *ctxpopup;
83    Evas_Object *popup_title_entry;
84    Evas_Object *popup_error_label;
85    Evas_Object *popup_install_button;
86    Evas_Object *popup_progressbar;
87    Evas_Object *popup_progressbar_frame;
88    Evas_Object *popup_genlist;
89    Elm_Genlist_Item_Class *popup_genlist_itc;
90    Eina_Bool popup_help_mode;
91 } E_PackageKit_Instance;
92 
93 typedef struct _E_PackageKit_Package
94 {
95    const char *pkg_id;
96    const char *name;
97    const char *summary;
98    const char *version;
99    PackageKit_Package_Info info;
100    Eina_Bool to_be_installed;
101 } E_PackageKit_Package;
102 
103 
104 typedef void (*E_PackageKit_Transaction_Func)(E_PackageKit_Module_Context *ctxt,
105                                               const char *transaction);
106 
107 
108 Eina_Bool packagekit_dbus_connect(E_PackageKit_Module_Context *ctxt);
109 void      packagekit_dbus_disconnect(E_PackageKit_Module_Context *ctxt);
110 void      packagekit_create_transaction_and_exec(E_PackageKit_Module_Context *ctxt,
111                                                  E_PackageKit_Transaction_Func func);
112 void      packagekit_get_updates(E_PackageKit_Module_Context *ctxt, const char *transaction);
113 void      packagekit_refresh_cache(E_PackageKit_Module_Context *ctxt, const char *transaction);
114 void      packagekit_update_packages(E_PackageKit_Module_Context *ctxt, const char *transaction);
115 void      packagekit_icon_update(E_PackageKit_Module_Context *ctxt, Eina_Bool working);
116 void      packagekit_popup_new(E_PackageKit_Instance *inst, Eina_Bool is_gadcon);
117 void      packagekit_popup_del(E_PackageKit_Instance *inst);
118 void      packagekit_popup_update(E_PackageKit_Instance *inst, Eina_Bool rebuild_list);
119 
120 
121 #endif
122