1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
|
diff --git a/libappstream-builder/asb-self-test.c b/libappstream-builder/asb-self-test.c
index c13ed85..62ceeae 100644
--- a/libappstream-builder/asb-self-test.c
+++ b/libappstream-builder/asb-self-test.c
@@ -491,6 +491,7 @@ asb_test_context_func (void)
"<provides>\n"
"<dbus type=\"session\">org.freedesktop.AppStream</dbus>\n"
"</provides>\n"
+ "<launchable type=\"desktop-id\">app.desktop</launchable>\n"
"<languages>\n"
"<lang percentage=\"100\">en_GB</lang>\n"
"<lang percentage=\"33\">ru</lang>\n"
diff --git a/libappstream-glib/as-app.c b/libappstream-glib/as-app.c
index 488fd09..7f19b9b 100644
--- a/libappstream-glib/as-app.c
+++ b/libappstream-glib/as-app.c
@@ -4635,7 +4635,7 @@ as_app_node_insert (AsApp *app, GNode *parent, AsNodeContext *ctx)
}
/* <launchables> */
- if (priv->launchables->len > 0 && as_node_context_get_version (ctx) > 0.9) {
+ if (priv->launchables->len > 0) {
g_ptr_array_sort (priv->launchables, as_app_launchables_sort_cb);
for (i = 0; i < priv->launchables->len; i++) {
AsLaunchable *launchable = g_ptr_array_index (priv->launchables, i);
diff --git a/libappstream-glib/as-icon.c b/libappstream-glib/as-icon.c
index 9fc3ba7..8a13ae0 100644
--- a/libappstream-glib/as-icon.c
+++ b/libappstream-glib/as-icon.c
@@ -513,11 +513,9 @@ as_icon_node_insert_embedded (AsIcon *icon, GNode *parent, AsNodeContext *ctx)
n = as_node_insert (parent, "icon", NULL, 0,
"type", as_icon_kind_to_string (priv->kind),
NULL);
- if (as_node_context_get_version (ctx) >= 0.8) {
- as_node_add_attribute_as_uint (n, "width", priv->width);
- as_node_add_attribute_as_uint (n, "height", priv->height);
- }
- if (priv->scale > 1 && as_node_context_get_version (ctx) > 0.9)
+ as_node_add_attribute_as_uint (n, "width", priv->width);
+ as_node_add_attribute_as_uint (n, "height", priv->height);
+ if (priv->scale > 1)
as_node_add_attribute_as_uint (n, "scale", priv->scale);
as_node_insert (n, "name", priv->name, 0, NULL);
data = g_base64_encode (g_bytes_get_data (priv->data, NULL),
@@ -575,8 +573,7 @@ as_icon_node_insert (AsIcon *icon, GNode *parent, AsNodeContext *ctx)
}
break;
}
- if (priv->kind == AS_ICON_KIND_CACHED &&
- as_node_context_get_version (ctx) >= 0.8) {
+ if (priv->kind == AS_ICON_KIND_CACHED) {
if (priv->width > 0)
as_node_add_attribute_as_uint (n, "width", priv->width);
if (priv->height > 0)
diff --git a/libappstream-glib/as-release.c b/libappstream-glib/as-release.c
index 833ec6a..3ccefaa 100644
--- a/libappstream-glib/as-release.c
+++ b/libappstream-glib/as-release.c
@@ -645,7 +645,6 @@ as_release_node_insert (AsRelease *release, GNode *parent, AsNodeContext *ctx)
AsReleasePrivate *priv = GET_PRIVATE (release);
AsChecksum *checksum;
GNode *n;
- guint i;
n = as_node_insert (parent, "release", NULL,
AS_NODE_INSERT_FLAG_NONE,
@@ -667,19 +666,16 @@ as_release_node_insert (AsRelease *release, GNode *parent, AsNodeContext *ctx)
}
if (priv->version != NULL)
as_node_add_attribute (n, "version", priv->version);
- if (as_node_context_get_version (ctx) >= 0.9) {
- const gchar *tmp;
- for (i = 0; priv->locations != NULL && i < priv->locations->len; i++) {
- tmp = g_ptr_array_index (priv->locations, i);
- as_node_insert (n, "location", tmp,
- AS_NODE_INSERT_FLAG_NONE, NULL);
- }
- for (i = 0; priv->checksums != NULL && i < priv->checksums->len; i++) {
- checksum = g_ptr_array_index (priv->checksums, i);
- as_checksum_node_insert (checksum, n, ctx);
- }
+ for (guint i = 0; priv->locations != NULL && i < priv->locations->len; i++) {
+ const gchar *tmp = g_ptr_array_index (priv->locations, i);
+ as_node_insert (n, "location", tmp,
+ AS_NODE_INSERT_FLAG_NONE, NULL);
+ }
+ for (guint i = 0; priv->checksums != NULL && i < priv->checksums->len; i++) {
+ checksum = g_ptr_array_index (priv->checksums, i);
+ as_checksum_node_insert (checksum, n, ctx);
}
- if (priv->descriptions != NULL && as_node_context_get_version (ctx) >= 0.6) {
+ if (priv->descriptions != NULL) {
as_node_insert_localized (n, "description", priv->descriptions,
AS_NODE_INSERT_FLAG_PRE_ESCAPED |
AS_NODE_INSERT_FLAG_DEDUPE_LANG);
@@ -687,7 +683,7 @@ as_release_node_insert (AsRelease *release, GNode *parent, AsNodeContext *ctx)
/* add sizes */
if (priv->sizes != NULL) {
- for (i = 0; i < AS_SIZE_KIND_LAST; i++) {
+ for (guint i = 0; i < AS_SIZE_KIND_LAST; i++) {
g_autofree gchar *size_str = NULL;
if (priv->sizes[i] == 0)
continue;
diff --git a/libappstream-glib/as-screenshot.c b/libappstream-glib/as-screenshot.c
index 65ce4e7..327b20a 100644
--- a/libappstream-glib/as-screenshot.c
+++ b/libappstream-glib/as-screenshot.c
@@ -436,15 +436,13 @@ as_screenshot_node_insert (AsScreenshot *screenshot,
as_node_add_attribute (n, "type",
as_screenshot_kind_to_string (priv->kind));
}
- if (as_node_context_get_version (ctx) >= 0.41) {
- if (priv->captions != NULL) {
- as_node_insert_localized (n,
- "caption",
- priv->captions,
- AS_NODE_INSERT_FLAG_DEDUPE_LANG);
- }
+ if (priv->captions != NULL) {
+ as_node_insert_localized (n,
+ "caption",
+ priv->captions,
+ AS_NODE_INSERT_FLAG_DEDUPE_LANG);
}
- if (as_node_context_get_version (ctx) >= 0.8 && priv->priority != 0)
+ if (priv->priority != 0)
as_node_add_attribute_as_int (n, "priority", priv->priority);
for (i = 0; i < priv->images->len; i++) {
image = g_ptr_array_index (priv->images, i);
diff --git a/libappstream-glib/as-self-test.c b/libappstream-glib/as-self-test.c
index b73a528..d8b4889 100644
--- a/libappstream-glib/as-self-test.c
+++ b/libappstream-glib/as-self-test.c
@@ -968,7 +968,7 @@ as_test_icon_func (void)
as_node_context_set_version (ctx, 0.4);
n = as_icon_node_insert (icon, root, ctx);
xml = as_node_to_xml (n, AS_NODE_TO_XML_FLAG_NONE);
- ret = as_test_compare_lines (xml->str, src, &error);
+ ret = as_test_compare_lines (xml->str, "<icon type=\"cached\" height=\"64\" width=\"64\">app.png</icon>", &error);
g_assert_no_error (error);
g_assert (ret);
g_string_free (xml, TRUE);
@@ -1098,7 +1098,7 @@ as_test_icon_embedded_func (void)
AsNode *root;
GString *xml;
const gchar *src =
-"<icon type=\"embedded\"><name>app.png</name>"
+"<icon type=\"embedded\" height=\"32\" width=\"32\"><name>app.png</name>"
"<filecontent>\n"
"iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAAB3RJ\n"
"TUUH1gsaCxQZBldDDAAACLxJREFUWIW9lmtsHNUVx/8zd3Zm9uFd73ptZ/3Gid+OoUlwyAscSJw4\n"
@@ -2465,6 +2465,7 @@ as_test_app_no_markup_func (void)
"<component type=\"desktop\">\n"
"<id>org.gnome.Software.desktop</id>\n"
"<description>Software is awesome:\n\n * Bada\n * Boom!</description>\n"
+ "<launchable type=\"desktop-id\">org.gnome.Software.desktop</launchable>\n"
"</component>\n";
g_autoptr(AsNodeContext) ctx = NULL;
g_autoptr(AsApp) app = NULL;
@@ -3038,7 +3039,7 @@ as_test_store_embedded_func (void)
"<id>eog.desktop</id>"
"<pkgname>eog</pkgname>"
"<name>Image Viewer</name>"
-"<icon type=\"embedded\">"
+"<icon type=\"embedded\" height=\"32\" width=\"32\">"
"<name>eog.png</name>"
"<filecontent>\n"
"iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAAB3RJ\n"
@@ -3084,6 +3085,7 @@ as_test_store_embedded_func (void)
"xxVXYLZ16ADU690D3JzxXLG581caBWBep/71278AZpn8hFce4VcAAAAASUVORK5CYII=\n"
"</filecontent>"
"</icon>"
+"<launchable type=\"desktop-id\">eog.desktop</launchable>"
"</component>"
"</components>";
@@ -3909,30 +3911,12 @@ as_test_store_versions_func (void)
"<description><p>Hello</p></description>\n"
"</release>\n"
"</releases>\n"
+ "<launchable type=\"desktop-id\">test.desktop</launchable>\n"
"</component>\n"
"</components>\n", &error);
g_assert_no_error (error);
g_assert (ret);
g_string_free (xml, TRUE);
-
- /* test with legacy options */
- as_store_set_api_version (store, 0.6);
- xml = as_store_to_xml (store, 0);
- g_assert_cmpstr (xml->str, ==,
- "<components version=\"0.6\">"
- "<component type=\"desktop\">"
- "<id>test.desktop</id>"
- "<description><p>Hello world</p></description>"
- "<architectures><arch>i386</arch></architectures>"
- "<releases>"
- "<release timestamp=\"123\" version=\"0.1.2\">"
- "<description><p>Hello</p></description>"
- "</release>"
- "</releases>"
- "</component>"
- "</components>");
- g_string_free (xml, TRUE);
-
g_object_unref (store);
/* load a version 0.6 file to the store */
@@ -3952,6 +3936,7 @@ as_test_store_versions_func (void)
"<components version=\"0.6\">"
"<component type=\"desktop\">"
"<id>test.desktop</id>"
+ "<launchable type=\"desktop-id\">test.desktop</launchable>"
"</component>"
"</components>");
g_string_free (xml, TRUE);
@@ -3977,6 +3962,7 @@ as_test_store_addons_func (void)
"</component>"
"<component type=\"desktop\">"
"<id>eclipse.desktop</id>"
+ "<launchable type=\"desktop-id\">eclipse.desktop</launchable>"
"</component>"
"</components>";
g_autoptr(AsStore) store = NULL;
@@ -4059,6 +4045,7 @@ as_test_node_no_dup_c_func (void)
"<component type=\"desktop\">"
"<id>test.desktop</id>"
"<name>Krita</name>"
+ "<launchable type=\"desktop-id\">test.desktop</launchable>"
"</component>");
g_string_free (xml, TRUE);
as_node_unref (root);
@@ -4868,7 +4855,7 @@ as_test_store_yaml_func (void)
"<id>iceweasel.desktop</id>\n"
"<pkgname>iceweasel</pkgname>\n"
"<name>Iceweasel</name>\n"
- "<icon type=\"cached\">iceweasel.png</icon>\n"
+ "<icon type=\"cached\" height=\"64\" width=\"64\">iceweasel.png</icon>\n"
"<keywords>\n"
"<keyword>browser</keyword>\n"
"</keywords>\n"
|