32
32
private Control control;
33
33
private Cancellable transaction;
36
public string[] icon_table;
38
public void get_pkgs_cb (Progress progress, ProgressType type) {
41
public void ready () {
35
45
public void get_pkgs (string filters) {
37
47
filter = filter_bitfield_from_string(filters);
38
48
loading_started("Loading packages");
39
client.get_packages_async(filter, null, (pkg) => {
40
if (pkg.package != null) {
41
app_added(pkg.package);
49
client.get_packages_async(filter, null, (progress, type) => {
50
if (type == ProgressType.PACKAGE_ID && progress.package != null) {
51
stdout.printf("%s, %s\n", progress.package.get_name(), progress.package.get_arch());
52
app_added(progress.package);
53
while (Gtk.events_pending())
43
while (Gtk.events_pending())
50
59
public void search_for_packages (string filters, string name) {
80
89
return res.get_package_array()[0];
92
private void fill_icon_table () {
94
string.joinv("|", {group_enum_to_string(Group.UNKNOWN),"help-browser"}), /* fall though value */
95
string.joinv("|", {group_enum_to_string(Group.ACCESSIBILITY), "preferences-desktop-accessibility"}),
96
string.joinv("|", {group_enum_to_string(Group.ACCESSORIES), "applications-accessories"}),
97
string.joinv("|", {group_enum_to_string(Group.ADMIN_TOOLS), "system-lock-screen"}),
98
string.joinv("|", {group_enum_to_string(Group.COLLECTIONS), "pk-collection-installed"}),
99
string.joinv("|", {group_enum_to_string(Group.COMMUNICATION), "folder-remote"}),
100
string.joinv("|", {group_enum_to_string(Group.DESKTOP_GNOME), "pk-desktop-gnome"}),
101
string.joinv("|", {group_enum_to_string(Group.DESKTOP_KDE), "pk-desktop-kde"}),
102
string.joinv("|", {group_enum_to_string(Group.DESKTOP_OTHER), "user-desktop"}),
103
string.joinv("|", {group_enum_to_string(Group.DESKTOP_XFCE), "pk-desktop-xfce"}),
104
string.joinv("|", {group_enum_to_string(Group.DOCUMENTATION), "x-office-address-book"}),
105
string.joinv("|", {group_enum_to_string(Group.EDUCATION), "utilities-system-monitor"}),
106
string.joinv("|", {group_enum_to_string(Group.ELECTRONICS), "video-display"}),
107
string.joinv("|", {group_enum_to_string(Group.FONTS), "preferences-desktop-font"}),
108
string.joinv("|", {group_enum_to_string(Group.GAMES), "applications-games"}),
109
string.joinv("|", {group_enum_to_string(Group.GRAPHICS), "applications-graphics"}),
110
string.joinv("|", {group_enum_to_string(Group.INTERNET), "applications-internet"}),
111
string.joinv("|", {group_enum_to_string(Group.LEGACY), "media-floppy"}),
112
string.joinv("|", {group_enum_to_string(Group.LOCALIZATION), "preferences-desktop-locale"}),
113
string.joinv("|", {group_enum_to_string(Group.MAPS), "applications-multimedia"}),
114
string.joinv("|", {group_enum_to_string(Group.MULTIMEDIA), "applications-multimedia"}),
115
string.joinv("|", {group_enum_to_string(Group.NETWORK), "network-wired"}),
116
string.joinv("|", {group_enum_to_string(Group.OFFICE), "applications-office"}),
117
string.joinv("|", {group_enum_to_string(Group.OTHER), "applications-other"}),
118
string.joinv("|", {group_enum_to_string(Group.POWER_MANAGEMENT), "battery"}),
119
string.joinv("|", {group_enum_to_string(Group.PROGRAMMING), "applications-development"}),
120
string.joinv("|", {group_enum_to_string(Group.PUBLISHING), "accessories-dictionary"}),
121
string.joinv("|", {group_enum_to_string(Group.REPOS), "system-file-manager"}),
122
string.joinv("|", {group_enum_to_string(Group.SCIENCE), "application-certificate"}),
123
string.joinv("|", {group_enum_to_string(Group.SECURITY), "network-wireless-encrypted"}),
124
string.joinv("|", {group_enum_to_string(Group.SERVERS), "network-server"}),
125
string.joinv("|", {group_enum_to_string(Group.SYSTEM), "applications-system"}),
126
string.joinv("|", {group_enum_to_string(Group.VIRTUALIZATION), "computer"}),
127
string.joinv("|", {group_enum_to_string(Group.VENDOR), "application-certificate"}),
128
string.joinv("|", {group_enum_to_string(Group.NEWEST), "dialog-information"})
132
private string group_to_icon_name(string group) {
133
foreach (string couple in icon_table) {
134
if (couple.split("|")[0] == group) {
135
return couple.split("|")[1];
83
142
public void get_categories () {
84
category_added("gtk-yes", "Utilities");
85
category_added("gtk-yes", "Internet");
86
category_added("gtk-yes", "System");
87
category_added("gtk-yes", "Accessibility");
144
for (int i = 0; i < Group.LAST; i++) {
145
if (i != Group.COLLECTIONS && i != Group.NEWEST)
146
category_added(group_to_icon_name(group_enum_to_string((Group)i)), group_enum_to_string((Group)i));
149
category_added("applications-accessories", "Accessories");
150
category_added("applications-internet", "Internet");
151
category_added("applications-office", "Office");
152
category_added("applications-multimedia", "Multimedia");
153
category_added("applications-development", "Development");
154
category_added("category-show-all", "All");
157
public void get_screenshot (string pkg_name) {
90
161
public AppsManager () {
91
162
client = new Client();
92
163
control = new Control();
93
164
transaction = new Cancellable();