Codebase list gnome-firmware / d5c25a2
New upstream snapshot. Debian Janitor 2 years ago
15 changed file(s) with 617 addition(s) and 875 deletion(s). Raw diff Collapse all Expand all
0 #!/bin/sh -e
1
2 meson -Dlibxmlb:gtkdoc=false \
3 -Dlibxmlb:introspection=false \
4 -Dlibjcat:man=false \
5 -Dlibjcat:gtkdoc=false \
6 -Dlibjcat:introspection=false \
7 -Dlibjcat:tests=false \
8 -Dfwupd:gtkdoc=false \
9 -Dfwupd:introspection=false \
10 -Dfwupd:build=library \
11 -Dfwupd:man=false \
12 -Dfwupd:tests=false \
13 -Dgcab:docs=false \
14 -Dgcab:introspection=false \
15 -Dgcab:vapi=false \
16 -Dgcab:tests=false \
17 -Dman=true \
18 build .
19 ninja -v -C build
0 #!/bin/sh -e
1 dpkg-reconfigure debconf -f noninteractive -p critical
2 apt update
3 apt install appstream \
4 build-essential \
5 git \
6 help2man \
7 gettext \
8 gnutls-bin \
9 gnutls-dev \
10 libfwupd-dev \
11 libgpgme11-dev \
12 libgtk-3-dev \
13 libgudev-1.0-dev \
14 libjson-glib-dev \
15 libsoup2.4-dev \
16 libxmlb-dev \
17 meson \
18 -yq
1515 BuildRequires: gtk3-devel
1616 BuildRequires: libxmlb-devel
1717 BuildRequires: libappstream-glib-devel
18 BuildRequires: libsoup-devel
1918 BuildRequires: desktop-file-utils
2019 BuildRequires: help2man
2120
0 gnome-firmware (3.36.0+git20210708.1.c9314a6-1) UNRELEASED; urgency=low
1
2 * New upstream snapshot.
3
4 -- Debian Janitor <janitor@jelmer.uk> Wed, 18 Aug 2021 11:57:47 -0000
5
06 gnome-firmware (3.36.0-1) unstable; urgency=medium
17
28 * New upstream release
00 project('gnome-firmware', 'c',
1 version : '3.36.0',
1 version : '40.alpha',
22 default_options : ['warning_level=1'],
33 meson_version : '>=0.46.0'
44 )
7878
7979 libgtk = dependency('gtk+-3.0', version : '>= 3.11.2')
8080 libgio = dependency('gio-2.0')
81 libfwupd = dependency('fwupd', version : '>= 1.2.10')
81 libfwupd = dependency('fwupd', version : '>= 1.5.5', fallback : ['fwupd', 'libfwupd_dep'])
8282 libxmlb = dependency('xmlb', version : '>=0.1.7', fallback : ['libxmlb', 'libxmlb_dep'])
83 libsoup = dependency('libsoup-2.4', version : '>= 2.51.92')
8483
8584 gnome = import('gnome')
8685 i18n = import('i18n')
2020 - network
2121 desktop: usr/share/applications/org.gnome.Firmware.desktop
2222 common-id: org.gnome.Firmware.desktop
23 extensions: [gnome-3-28]
23 extensions: [gnome-3-34]
2424 environment:
2525 LD_LIBRARY_PATH: $LD_LIBRARY_PATH:$SNAP/lib/gnome-firmware
2626
2727 parts:
28 gtksourceview:
29 source: https://gitlab.gnome.org/GNOME/gtksourceview.git
30 source-type: git
31 plugin: meson
32 meson-parameters: [--prefix=/usr, -Dc_args="-Wno-error=undef"]
33 organize:
34 snap/gtksourceview/current/usr: usr
28 nettle:
29 plugin: autotools
30 source: https://ftp.gnu.org/gnu/nettle/nettle-3.5.tar.gz
3531 build-packages:
36 - autoconf-archive
37 - gettext
38 - gobject-introspection
39 - gtk-doc-tools
40 - libfribidi-dev
41 - libgirepository1.0-dev
42 - libglib2.0-dev
43 - libgtk-3-dev
44 - libpeas-dev
45 - libxml2-dev
46 - libxml2-utils
47 - valac
32 - libgmp-dev
4833 prime:
49 - -usr/include
50 - -usr/lib/*/pkgconfig
51
52 fwupd:
53 plugin: meson
54 meson-parameters: [--prefix=/usr,
55 -Dlvfs=false,
56 -Dsystemd=false,
57 -Dplugin_synaptics=false,
58 -Dplugin_dell=false,
59 -Dplugin_amt=false,
60 -Dplugin_altos=false,
61 -Dplugin_thunderbolt=false,
62 -Dplugin_flashrom=false,
63 -Dplugin_uefi=false,
64 -Dplugin_redfish=false,
65 -Dplugin_modem_manager=false,
66 -Dgpg=false,
67 -Dtests=false,
68 -Dbuild=library,
69 -Dgtkdoc=false,
70 -Dintrospection=false,
71 -Dman=false,
72 -Dudevdir=$SNAPCRAFT_STAGE/lib/udev,
73 "-Dlibxmlb:gtkdoc=false",
74 "-Dlibxmlb:introspection=false",
75 -Dpkcs7=false]
76 source: https://github.com/fwupd/fwupd
77 source-type: git
34 - -include
35 - -bin
36 - -share/man
37 - -lib/pkgconfig
38 gnutls:
39 plugin: autotools
40 source: https://www.gnupg.org/ftp/gcrypt/gnutls/v3.6/gnutls-3.6.12.tar.xz
7841 build-packages:
79 - gcab
80 - gnutls-dev
81 - libarchive-dev
82 - libgudev-1.0-dev
83 - libgusb-dev
84 - libcairo-dev
85 - libelf-dev
86 - libftdi1-dev
87 - libgcab-dev
88 - libglib2.0-dev
89 - libjson-glib-dev
90 - libpango1.0-dev
91 - libpci-dev
92 - libpolkit-gobject-1-dev
93 - libsoup2.4-dev
94 - libsqlite3-dev
95 - locales
96 - pkg-config
97 - uuid-dev
98 stage-packages:
99 - libgcab-1.0-0
100 - libarchive13
101 - libassuan0
102 - liblcms2-2
103 - libelf1
104 - libjson-glib-1.0-0
105 - libpolkit-gobject-1-0
106 - libsoup2.4-1
107 - glib-networking
108 - libglib2.0-bin
109 - libgudev-1.0-0
110 - libgusb2
111 - libusb-1.0-0
42 - libtasn1-6-dev
43 - libunistring-dev
44 - libidn2-dev
45 - libunbound-dev
46 - libp11-kit-dev
11247 prime:
113 # we explicitly don't want /usr/bin/gpgconf
114 # this will cause gpgme to error finding it
115 # but that also avoids trying to use non-existent
116 # /usr/bin/gpg2
117 - -usr/bin
118 - -usr/sbin
119 - -usr/share/man
120 - -usr/share/GConf
121 - -etc/X11
122 - -etc/ldap
123 - -etc/logcheck
124 - -usr/lib/dconf
125 - -usr/lib/gcc
126 - -usr/lib/glib-networking
127 - -usr/lib/gnupg2
128 - -usr/lib/sasl2
129 - -usr/lib/systemd
130 - -usr/lib/*/audit
131 - -usr/share/glib-2.0/schemas
132 - -usr/share/X11
133 - -include
134 - -lib/udev
135 - -lib/*/pkgconfig
136 - -usr/share/lintian
137 - -usr/share/pkgconfig
138 - -usr/share/installed-tests
139 - -usr/share/polkit-1
140 - -usr/share/vala
141 - -usr/share/doc
142 - -usr/share/gnupg2
143 - -usr/share/info
144 - -usr/share/gir-1.0
145 - -usr/share/upstart
146 - -usr/include
147 - -usr/lib/*/pkgconfig
48 - -include
49 - -bin
50 - -share/man
51 - -lib/pkgconfig
52 after: [nettle]
14853
14954 gnome-firmware:
150 after: [gtksourceview, fwupd]
55 after: [gnutls]
15156 source: .
15257 plugin: meson
58 build-environment:
59 - C_INCLUDE_PATH: $SNAPCRAFT_STAGE/usr/include/gtksourceview-4
15360 meson-parameters:
15461 - --prefix=/snap/gnome-firmware/current/usr
15562 - -Dsystemd=false
15663 - -Dman=false
64 - -Dlibxmlb:gtkdoc=false
65 - -Dlibxmlb:introspection=false
66 - -Dlibjcat:man=false
67 - -Dlibjcat:gtkdoc=false
68 - -Dlibjcat:introspection=false
69 - -Dlibjcat:tests=false
70 - -Dfwupd:gtkdoc=false
71 - -Dfwupd:introspection=false
72 - -Dfwupd:build=library
73 - -Dfwupd:man=false
74 - -Dfwupd:tests=false
75 - -Dgcab:docs=false
76 - -Dgcab:introspection=false
77 - -Dgcab:vapi=false
78 - -Dgcab:tests=false
15779 organize:
15880 snap/gnome-firmware/current/usr: usr
15981 parse-info: [usr/share/metainfo/org.gnome.Firmware.metainfo.xml]
16082 build-packages:
16183 - desktop-file-utils
16284 - appstream
163 - gettext
164 - gnome-common
16585 - appstream-util
166 - gnome-pkg-tools
16786 - help2man
87 - git
88 - libgpgme11-dev
89 - libgtk-3-dev
90 - libgudev-1.0-dev
91 - libjson-glib-dev
92 - libsoup2.4-dev
93 - libcurl4-gnutls-dev
16894 override-pull: |
16995 snapcraftctl pull
17096 # Needed to work around parse failure https://bugs.launchpad.net/snapcraft/+bug/1852329
17197 sed -e '/^ *<!--.*/d' -i $SNAPCRAFT_PART_SRC/data/appdata/org.gnome.Firmware.metainfo.xml.in
17298 snapcraftctl set-version $(git describe HEAD --always)
99 override-build: |
100 sed -i.bak -e 's|Icon=org.gnome.Firmware$|Icon=${SNAP}/meta/gui/org.gnome.Firmware.svg|g' data/org.gnome.Firmware.desktop.in
101 snapcraftctl build
102 mkdir -p $SNAPCRAFT_PART_INSTALL/meta/gui/
103 cp data/icons/org.gnome.Firmware.svg $SNAPCRAFT_PART_INSTALL/meta/gui/
104 cp ../build/snapbuild/data/org.gnome.Firmware.desktop $SNAPCRAFT_PART_INSTALL/meta/gui/
173105 prime:
174106 - -usr/share/appdata
175107 - -usr/lib/*/pkgconfig
108
109 libraries:
110 after: [gnome-firmware]
111 plugin: nil
112 stage-packages:
113 - libevent-2.1-6
114 - libunbound2
115 - libassuan0
116 - libgpgme11
117 prime:
118 - usr/lib/*/libevent*
119 - usr/lib/*/libunbound*
120 - usr/lib/*/libassuan*
121 - usr/lib/*/libgpgme*
242242 return val != NULL;
243243 }
244244
245 /* installation helper functions */
246
247 gboolean
248 gfu_common_mkdir_parent (const gchar *filename, GError **error)
249 {
250 g_autofree gchar *parent = NULL;
251
252 parent = g_path_get_dirname (filename);
253 g_debug ("creating path %s", parent);
254 if (g_mkdir_with_parents (parent, 0755) == -1) {
255 g_set_error (error,
256 FWUPD_ERROR,
257 FWUPD_ERROR_INTERNAL,
258 "Failed to create '%s': %s",
259 parent, g_strerror (errno));
260 return FALSE;
261 }
262 return TRUE;
263 }
264
265 gchar *
266 gfu_get_user_cache_path (const gchar *fn)
267 {
268 g_autofree gchar *basename = g_path_get_basename (fn);
269
270 return g_build_filename (g_get_user_cache_dir (), "gfu", basename, NULL);
271 }
272
273 gboolean
274 gfu_common_file_exists_with_checksum (const gchar *fn,
275 const gchar *checksum_expected,
276 GChecksumType checksum_type)
277 {
278 gsize len = 0;
279 g_autofree gchar *checksum_actual = NULL;
280 g_autofree gchar *data = NULL;
281
282 if (!g_file_get_contents (fn, &data, &len, NULL))
283 return FALSE;
284 checksum_actual = g_compute_checksum_for_data (checksum_type,
285 (guchar *) data, len);
286 return g_strcmp0 (checksum_expected, checksum_actual) == 0;
287 }
288
289 SoupSession *
290 gfu_common_setup_networking (GError **error)
291 {
292 const gchar *http_proxy;
293 g_autofree gchar *user_agent = NULL;
294 g_autoptr(SoupSession) session = NULL;
295
296 /* create the soup session */
297 user_agent = fwupd_build_user_agent (GETTEXT_PACKAGE, VERSION);
298 session = soup_session_new_with_options (SOUP_SESSION_USER_AGENT, user_agent,
299 SOUP_SESSION_TIMEOUT, 60,
300 NULL);
301 if (session == NULL) {
302 g_set_error_literal (error,
303 FWUPD_ERROR,
304 FWUPD_ERROR_INTERNAL,
305 "failed to setup networking");
306 return NULL;
307 }
308
309 /* set the proxy */
310 http_proxy = g_getenv ("https_proxy");
311 if (http_proxy == NULL)
312 http_proxy = g_getenv ("HTTPS_PROXY");
313 if (http_proxy == NULL)
314 http_proxy = g_getenv ("http_proxy");
315 if (http_proxy == NULL)
316 http_proxy = g_getenv ("HTTP_PROXY");
317 if (http_proxy != NULL && strlen (http_proxy) > 0) {
318 g_autoptr(SoupURI) proxy_uri = soup_uri_new (http_proxy);
319 if (proxy_uri == NULL) {
320 g_set_error (error,
321 FWUPD_ERROR,
322 FWUPD_ERROR_INTERNAL,
323 "invalid proxy URI: %s", http_proxy);
324 return NULL;
325 }
326 g_object_set (session, SOUP_SESSION_PROXY_URI, proxy_uri, NULL);
327 }
328
329 /* this disables the double-compression of the firmware.xml.gz file */
330 soup_session_remove_feature_by_type (session, SOUP_TYPE_CONTENT_DECODER);
331 return g_steal_pointer (&session);
332 }
333
334245 /* GTK helper functions */
335246
336247 gchar *
353264 }
354265 if (device_flag == FWUPD_DEVICE_FLAG_REQUIRE_AC) {
355266 /* TRANSLATORS: Must be plugged in to an outlet */
356 return _("Requires AC power");
267 return _("System requires external power source");
357268 }
358269 if (device_flag == FWUPD_DEVICE_FLAG_LOCKED) {
359270 /* TRANSLATORS: Is locked and can be unlocked */
419330 /* skip */
420331 return NULL;
421332 }
422 #if FWUPD_CHECK_VERSION(1,3,2)
423333 if (device_flag == FWUPD_DEVICE_FLAG_HISTORICAL) {
424334 /* skip */
425335 return NULL;
426336 }
427 #endif
428 #if FWUPD_CHECK_VERSION(1,3,3)
429337 if (device_flag == FWUPD_DEVICE_FLAG_ONLY_SUPPORTED) {
430338 /* skip */
431339 return NULL;
454362 /* TRANSLATORS: Device remains usable during update */
455363 return _("Device is usable for the duration of the update");
456364 }
457 #endif
365 if (device_flag == FWUPD_DEVICE_FLAG_INSTALL_ALL_RELEASES) {
366 /* TRANSLATORS: Device does not jump directly to the newest */
367 return _("Device installs all intermediate releases");
368 }
369 if (device_flag == FWUPD_DEVICE_FLAG_SKIPS_RESTART) {
370 /* TRANSLATORS: Device does not restart and requires a manual action */
371 return _("Device skips restart");
372 }
373 if (device_flag == FWUPD_DEVICE_FLAG_HAS_MULTIPLE_BRANCHES) {
374 /* TRANSLATORS: the stream can be provided by different vendors */
375 return _("Device supports switching to a different stream of firmware");
376 }
377 if (device_flag == FWUPD_DEVICE_FLAG_BACKUP_BEFORE_INSTALL) {
378 /* TRANSLATORS: it is saved to the users local disk */
379 return _("Device firmware will be saved before installing updates");
380 }
458381 if (device_flag == FWUPD_DEVICE_FLAG_UNKNOWN) {
459382 return NULL;
460383 }
504427 return "emblem-important-symbolic";
505428 if (device_flag == FWUPD_DEVICE_FLAG_ENSURE_SEMVER)
506429 return "emblem-important-symbolic";
507 #if FWUPD_CHECK_VERSION(1,3,3)
508430 if (device_flag == FWUPD_DEVICE_FLAG_WILL_DISAPPEAR)
509431 return "emblem-important-symbolic";
510432 if (device_flag == FWUPD_DEVICE_FLAG_CAN_VERIFY)
515437 return "emblem-important-symbolic";
516438 if (device_flag == FWUPD_DEVICE_FLAG_USABLE_DURING_UPDATE)
517439 return "emblem-important-symbolic";
518
519 #endif
440 if (device_flag == FWUPD_DEVICE_FLAG_INSTALL_ALL_RELEASES)
441 return "media-skip-forward-symbolic";
442 if (device_flag == FWUPD_DEVICE_FLAG_SKIPS_RESTART)
443 return "process-stop-symbolic";
444 if (device_flag == FWUPD_DEVICE_FLAG_HAS_MULTIPLE_BRANCHES)
445 return "emblem-shared-symbolic";
446 if (device_flag == FWUPD_DEVICE_FLAG_BACKUP_BEFORE_INSTALL)
447 return "drive-harddisk-symbolic";
520448 if (device_flag == FWUPD_DEVICE_FLAG_UNKNOWN)
521449 return "unknown-symbolic";
522450 return NULL;
595523 /* TRANSLATORS: waiting for device to do something */
596524 return _("Waiting…");
597525 break;
526 case FWUPD_STATUS_SHUTDOWN:
527 /* TRANSLATORS: waiting for daemon */
528 return _("Shutting down…");
529 break;
598530 default:
599531 break;
600532 }
602534 /* TRANSLATORS: currect daemon status is unknown */
603535 return _("Unknown");
604536 }
537
538 gchar *
539 gfu_common_strjoin_array (const gchar *separator, GPtrArray *array)
540 {
541 g_autofree const gchar **strv = NULL;
542
543 g_return_val_if_fail (array != NULL, NULL);
544
545 strv = g_new0 (const gchar *, array->len + 1);
546 for (guint i = 0; i < array->len; i++)
547 strv[i] = g_ptr_array_index (array, i);
548 return g_strjoinv (separator, (gchar **) strv);
549 }
77 #pragma once
88
99 #include <xmlb.h>
10 #include <libsoup/soup.h>
1110 #include <errno.h>
1211
1312 G_BEGIN_DECLS
2120 } GfuOperation;
2221
2322 /* formatting helper functions */
24 gchar *gfu_common_checksum_format (const gchar *checksum);
25 const gchar *gfu_common_seconds_to_string (guint64 seconds);
26 gchar *gfu_common_xml_to_text (const gchar *xml,
23 gchar *gfu_common_checksum_format (const gchar *checksum);
24 const gchar *gfu_common_seconds_to_string (guint64 seconds);
25 gchar *gfu_common_xml_to_text (const gchar *xml,
2726 GError **error);
28 const gchar *gfu_common_device_flags_to_strings (guint64 flags);
29 const gchar *gfu_common_release_flags_to_strings (guint64 flags);
30 const gchar *gfu_status_to_string (FwupdStatus status);
31 gchar *gfu_operation_to_string (GfuOperation operation,
32 FwupdDevice *device);
27 const gchar *gfu_common_device_flags_to_strings (guint64 flags);
28 const gchar *gfu_common_release_flags_to_strings (guint64 flags);
29 const gchar *gfu_status_to_string (FwupdStatus status);
30 gchar *gfu_operation_to_string (GfuOperation operation,
31 FwupdDevice *device);
32 gchar *gfu_common_strjoin_array (const gchar *separator,
33 GPtrArray *array);
3334
3435 /* handle needs-reboot and needs-shutdown */
35 gboolean gfu_common_system_shutdown (GError **error);
36 gboolean gfu_common_system_reboot (GError **error);
37
38 /* installation helper functions */
39 gboolean gfu_common_mkdir_parent (const gchar *filename,
40 GError **error);
41 gboolean gfu_common_file_exists_with_checksum (const gchar *fn,
42 const gchar *checksum_expected,
43 GChecksumType checksum_type);
44 SoupSession *gfu_common_setup_networking (GError **error);
45 gchar *gfu_get_user_cache_path (const gchar *fn);
36 gboolean gfu_common_system_shutdown (GError **error);
37 gboolean gfu_common_system_reboot (GError **error);
4638
4739 /* GTK helper functions */
48 gchar *gfu_common_device_flag_to_string (guint64 device_flag);
49 gchar *gfu_common_device_icon_from_flag (FwupdDeviceFlags device_flag);
40 gchar *gfu_common_device_flag_to_string (guint64 device_flag);
41 gchar *gfu_common_device_icon_from_flag (FwupdDeviceFlags device_flag);
5042
5143 G_END_DECLS
3434 FwupdRelease *release;
3535 GPtrArray *releases;
3636 GfuMainMode mode;
37 GDBusProxy *proxy;
38 SoupSession *soup_session;
3937 FwupdInstallFlags flags;
4038 GfuOperation current_operation;
4139 GTimer *time_elapsed;
4240 gdouble last_estimate;
41 gchar *current_message;
4342 } GfuMain;
4443
4544 /* used to compare rows in a list */
8281 }
8382 gtk_dialog_run (GTK_DIALOG (dialog));
8483 gtk_widget_destroy (dialog);
84 }
85
86 static void
87 gfu_main_error_fatal (GfuMain *self, const gchar *text)
88 {
89 GtkWidget *w = GTK_WIDGET (gtk_builder_get_object (self->builder, "stack_main"));
90 gtk_stack_set_visible_child_name (GTK_STACK (w), "error");
91 w = GTK_WIDGET (gtk_builder_get_object (self->builder, "label_error"));
92 gtk_label_set_label (GTK_LABEL (w), text);
8593 }
8694
8795 static void
208216 /* set device information */
209217 if (self->device != NULL) {
210218 GPtrArray *guids;
219 GPtrArray *vendor_ids = fwupd_device_get_vendor_ids (self->device);
211220 g_autoptr(GString) attr = g_string_new (NULL);
221 g_autoptr(GString) version = g_string_new (fwupd_device_get_version (self->device));
212222 g_autoptr(GError) error = NULL;
213 gchar *tmp;
214 gchar *tmp2;
215
216 gfu_main_set_label (self, "label_device_version",
217 fwupd_device_get_version (self->device));
223 const gchar *tmp;
224
225 #if FWUPD_CHECK_VERSION(1,6,2)
226 if (fwupd_device_get_version_build_date (self->device) != 0) {
227 guint64 value = fwupd_device_get_version_build_date (self->device);
228 g_autoptr(GDateTime) date = g_date_time_new_from_unix_utc ((gint64) value);
229 g_autofree gchar *datestr = g_date_time_format (date, "%F");
230 g_string_append_printf (version, " [%s]", datestr);
231 }
232 #endif
233
234 gfu_main_set_label (self, "label_device_version", version->str);
218235 gfu_main_set_label (self, "label_device_version_lowest",
219236 fwupd_device_get_version_lowest (self->device));
220237 gfu_main_set_label (self, "label_device_version_bootloader",
225242 fwupd_device_get_serial (self->device));
226243
227244 tmp = fwupd_device_get_vendor (self->device);
228 tmp2 = fwupd_device_get_vendor_id (self->device);
229 if (tmp != NULL && tmp2 != NULL) {
230 g_autofree gchar *both = g_strdup_printf ("%s (%s)", tmp, tmp2);
245 if (tmp != NULL && vendor_ids->len > 0) {
246 g_autofree gchar *strv = gfu_common_strjoin_array (", ", vendor_ids);
247 g_autofree gchar *both = g_strdup_printf ("%s (%s)", tmp, strv);
231248 gfu_main_set_label (self, "label_device_vendor", both);
232249 } else if (tmp != NULL) {
233250 gfu_main_set_label (self, "label_device_vendor", tmp);
234 } else if (tmp2 != NULL) {
235 gfu_main_set_label (self, "label_device_vendor", tmp2);
251 } else if (vendor_ids->len > 0) {
252 g_autofree gchar *strv = gfu_common_strjoin_array (", ", vendor_ids);
253 gfu_main_set_label (self, "label_device_vendor", strv);
236254 } else {
237255 gfu_main_set_label (self, "label_device_vendor", NULL);
238256 }
243261
244262 gfu_main_set_label (self, "label_device_install_duration",
245263 gfu_common_seconds_to_string (fwupd_device_get_install_duration (self->device)));
246
247264
248265 gfu_main_set_device_flags (self, fwupd_device_get_flags (self->device));
249266
260277 /* set GUIDs->GUID if only one */
261278 gfu_main_set_label_title (self, "label_device_guids", ngettext ("GUID", "GUIDs", guids->len));
262279
263 #if FWUPD_CHECK_VERSION(1,3,3)
264280 /* device can be verified immediately without a round trip to firmware */
265281 if (fwupd_device_has_flag (self->device, FWUPD_DEVICE_FLAG_CAN_VERIFY) &&
266282 !fwupd_device_has_flag (self->device, FWUPD_DEVICE_FLAG_CAN_VERIFY_IMAGE)) {
283 //FIXME async
267284 if (!fwupd_client_verify (self->client,
268 fwupd_device_get_id (self->device),
269 self->cancellable,
270 &error)) {
285 fwupd_device_get_id (self->device),
286 self->cancellable,
287 &error)) {
271288 gfu_main_set_label (self, "label_device_checksums", error->message);
272289 } else {
273290 gfu_main_set_label (self, "label_device_checksums", _("Cryptographic hashes match"));
281298 } else {
282299 gfu_main_set_label (self, "label_device_checksums", NULL);
283300 }
284 #else
285 gfu_main_set_label (self, "label_device_checksums", NULL);
286 #endif
301
287302 //fixme: get parents
288303 //FwupdDevice *parent = fwupd_device_get_parent (self->device);
289304 //g_print ("parent: %s\n", fwupd_device_get_name (parent));
334349 ngettext ("Checksum", "Checksums", checks->len));
335350 }
336351
337 #if FWUPD_CHECK_VERSION(1,3,2)
338352 issues = fwupd_release_get_issues (self->release);
339 #endif
340 if (issues == NULL || issues->len == 0) {
353 if (issues->len == 0) {
341354 gfu_main_set_label (self, "label_release_issues", NULL);
342355 } else {
343356 g_autoptr(GString) str = g_string_new (NULL);
425438
426439 /* verify button */
427440 w = GTK_WIDGET (gtk_builder_get_object (self->builder, "button_verify"));
428 #if FWUPD_CHECK_VERSION(1,3,3)
429441 gtk_widget_set_visible (w, self->device != NULL &&
430442 !verification_matched &&
431443 fwupd_device_has_flag (self->device, FWUPD_DEVICE_FLAG_CAN_VERIFY_IMAGE));
432 #else
433 gtk_widget_set_visible (w, verification_matched);
434 #endif
435444
436445 /* verify update button */
437446 w = GTK_WIDGET (gtk_builder_get_object (self->builder, "button_verify_update"));
438 #if FWUPD_CHECK_VERSION(1,3,3)
439447 gtk_widget_set_visible (w, self->device != NULL &&
440448 !verification_matched &&
441449 fwupd_device_has_flag (self->device, FWUPD_DEVICE_FLAG_CAN_VERIFY));
442 #else
443 gtk_widget_set_visible (w, verification_matched);
444 #endif
450
445451 /* releases button */
446452 w = GTK_WIDGET (gtk_builder_get_object (self->builder, "button_releases"));
447453 if (self->releases == NULL || self->releases->len == 0) {
468474 w = GTK_WIDGET (gtk_builder_get_object (self->builder, "listbox_main"));
469475
470476 /* ignore if device can't be updated */
471 if (!fwupd_device_has_flag (device, FWUPD_DEVICE_FLAG_UPDATABLE))
472 return;
477 if (!fwupd_device_has_flag (device, FWUPD_DEVICE_FLAG_UPDATABLE) &&
478 !fwupd_device_has_flag (device, FWUPD_DEVICE_FLAG_UPDATABLE_HIDDEN))
479 return;
480
473481 /* create and add new row for device */
474482 l = gfu_device_row_new (device);
475483 gtk_widget_set_visible (l, TRUE);
521529 gfu_main_reboot_shutdown_prompt (GfuMain *self)
522530 {
523531 g_autoptr(GError) error = NULL;
524 guint64 flags = fwupd_device_get_flags (self->device);
525532
526533 /* if successful, prompt for reboot */
527534 // FIXME: handle with device::changed instead of removing
528535
529 if (flags & FWUPD_DEVICE_FLAG_NEEDS_SHUTDOWN) {
536 if (fwupd_device_has_flag (self->device, FWUPD_DEVICE_FLAG_NEEDS_SHUTDOWN)) {
530537 /* shutdown prompt */
531538 GtkWindow *window;
532539 GtkWidget *dialog;
569576
570577 gtk_widget_destroy (dialog);
571578 }
572 if (flags & FWUPD_DEVICE_FLAG_NEEDS_REBOOT) {
579 if (fwupd_device_has_flag (self->device, FWUPD_DEVICE_FLAG_NEEDS_REBOOT)) {
573580 /* shutdown prompt */
574581 GtkWindow *window;
575582 GtkWidget *dialog;
625632 /* async getter functions */
626633
627634 static void
628 gfu_main_update_remotes_cb (GObject *source_object, GAsyncResult *res, gpointer user_data)
635 gfu_main_update_remotes_cb (GObject *source, GAsyncResult *res, gpointer user_data)
629636 {
630637 GfuMain *self = (GfuMain *) user_data;
631638 GtkWidget *w;
632639 gboolean disabled_lvfs_remote = FALSE;
633640 gboolean enabled_any_download_remote = FALSE;
634641 g_autoptr(GError) error = NULL;
635 g_autoptr(GVariant) val = g_dbus_proxy_call_finish (self->proxy, res, &error);
636642 g_autoptr(GPtrArray) remotes = NULL;
637643
638 if (val == NULL) {
644 remotes = fwupd_client_get_remotes_finish (FWUPD_CLIENT (source), res, &error);
645 if (remotes == NULL) {
639646 gfu_main_error_dialog (self, _("Failed to load list of remotes"), error->message);
640647 return;
641648 }
642 remotes = fwupd_remote_array_from_variant (val);
643649 for (guint i = 0; i < remotes->len; i++) {
644650 FwupdRemote *remote = g_ptr_array_index (remotes, i);
645651 g_debug ("%s is %s", fwupd_remote_get_id (remote),
658664 }
659665
660666 w = GTK_WIDGET (gtk_builder_get_object (self->builder, "infobar_enable_lvfs"));
661 gtk_info_bar_set_revealed (GTK_INFO_BAR (w),
662 disabled_lvfs_remote && !enabled_any_download_remote);
663 }
664
665 static void
666 gfu_main_update_devices_cb (GObject *source_object, GAsyncResult *res, gpointer user_data)
667 if (disabled_lvfs_remote && !enabled_any_download_remote) {
668 gtk_widget_set_visible (w, TRUE);
669 gtk_info_bar_set_revealed (GTK_INFO_BAR (w), TRUE);
670 } else {
671 gtk_widget_set_visible (w, FALSE);
672 }
673 }
674
675 static void
676 gfu_main_update_devices_cb (GObject *source, GAsyncResult *res, gpointer user_data)
667677 {
668678 GtkWidget *w;
669679 GtkWidget *l = NULL;
670680 GfuMain *self = (GfuMain *) user_data;
671681 g_autoptr(GError) error = NULL;
672682 g_autoptr(GPtrArray) devices = NULL;
673 g_autoptr(GVariant) tmp = g_dbus_proxy_call_finish (self->proxy, res, &error);
674
675 if (tmp == NULL) {
683
684 devices = fwupd_client_get_devices_finish (FWUPD_CLIENT (source), res, &error);
685 if (devices == NULL) {
676686 gfu_main_error_dialog (self, _("Failed to load device list"), error->message);
677687 return;
678688 }
679
680 devices = fwupd_device_array_from_variant (tmp);
681689
682690 /* create a row in the listbox for each updatable device */
683691 w = GTK_WIDGET (gtk_builder_get_object (self->builder, "listbox_main"));
685693 FwupdDevice *device = g_ptr_array_index (devices, i);
686694 /* skip devices that can't be updated */
687695 if (!fwupd_device_has_flag (device, FWUPD_DEVICE_FLAG_UPDATABLE) &&
696 !fwupd_device_has_flag (device, FWUPD_DEVICE_FLAG_UPDATABLE_HIDDEN) &&
688697 !fwupd_device_has_flag (device, FWUPD_DEVICE_FLAG_LOCKED)) {
689698 g_debug ("ignoring non-updatable device: %s", fwupd_device_get_name (device));
690699 continue;
702711 }
703712
704713 static void
705 gfu_main_update_releases_cb (GObject *source_object, GAsyncResult *res, gpointer user_data)
714 gfu_main_update_releases_cb (GObject *source, GAsyncResult *res, gpointer user_data)
706715 {
707716 GtkWidget *w;
708717 GfuMain *self = (GfuMain *) user_data;
709718 g_autoptr(GError) error = NULL;
710 g_autoptr(GVariant) tmp = g_dbus_proxy_call_finish (self->proxy, res, &error);
711 if (tmp == NULL) {
719
720 self->releases = fwupd_client_get_releases_finish (FWUPD_CLIENT(source), res, &error);
721 if (self->releases == NULL) {
712722 /* No firmware found for this devices */
713723 g_debug ("ignoring: %s", error->message);
714724 return;
715725 }
716 self->releases = fwupd_release_array_from_variant (tmp);
717726
718727 w = GTK_WIDGET (gtk_builder_get_object (self->builder, "listbox_firmware"));
719728 gfu_main_container_remove_all (GTK_CONTAINER (w));
764773 }
765774
766775 static void
767 gfu_main_download_chunk_cb (SoupMessage *msg, SoupBuffer *chunk, gpointer user_data)
768 {
769 guint percentage;
770 goffset header_size;
771 goffset body_length;
776 gfu_main_client_percentage_changed_cb (FwupdClient *client, GParamSpec *pspec, GfuMain *self)
777 {
778 g_autofree gchar *str = NULL;
779 g_debug ("progress: %u%%", fwupd_client_get_percentage (client));
780 str = g_strdup_printf ("%s (%u%%)", _("Downloading"),
781 fwupd_client_get_percentage (client));
782 gfu_main_set_install_loading_label (self, str);
783 }
784
785 static void
786 gfu_main_refresh_remote_cb (GObject *source, GAsyncResult *res, gpointer user_data)
787 {
772788 GfuMain *self = (GfuMain *) user_data;
773
774 /* if it's returning "Found" or an error, ignore the percentage */
775 if (msg->status_code != SOUP_STATUS_OK) {
776 g_debug ("ignoring status code %u (%s)",
777 msg->status_code, msg->reason_phrase);
778 return;
779 }
780
781 /* get data */
782 body_length = msg->response_body->length;
783 header_size = soup_message_headers_get_content_length (msg->response_headers);
784
785 /* size is not known */
786 if (header_size < body_length)
787 return;
788
789 /* calculate percentage */
790 percentage = (guint) ((100 * body_length) / header_size);
791 g_debug ("progress: %u%%", percentage);
792 gfu_main_set_install_loading_label (self, g_strdup_printf ("%s (%u%%)",
793 _("Downloading"),
794 percentage));
795 }
796
797 static gboolean
798 gfu_main_download_file (GfuMain *self,
799 SoupURI *uri,
800 const gchar *fn,
801 const gchar *checksum_expected,
802 GError **error)
803 {
804 GChecksumType checksum_type;
805 guint status_code;
806 g_autoptr(GError) error_local = NULL;
807 g_autofree gchar *checksum_actual = NULL;
808 g_autofree gchar *uri_str = NULL;
809 g_autoptr(SoupMessage) msg = NULL;
810
811 /* check if the file already exists with the right checksum */
812 checksum_type = fwupd_checksum_guess_kind (checksum_expected);
813 if (gfu_common_file_exists_with_checksum (fn, checksum_expected, checksum_type)) {
814 g_debug ("skipping download as file already exists");
815 gfu_main_set_install_loading_label (self, _("File already downloaded..."));
816 return TRUE;
817 }
818
819 /* set up networking */
820 if (self->soup_session == NULL) {
821 self->soup_session = gfu_common_setup_networking (error);
822 if (self->soup_session == NULL)
823 return FALSE;
824 }
825
826 /* download data */
827 uri_str = soup_uri_to_string (uri, FALSE);
828 g_debug ("downloading %s to %s", uri_str, fn);
829 gfu_main_set_install_loading_label (self, _("Downloading file..."));
830 msg = soup_message_new_from_uri (SOUP_METHOD_GET, uri);
831 if (msg == NULL) {
832 g_set_error (error,
833 FWUPD_ERROR,
834 FWUPD_ERROR_INVALID_FILE,
835 "Failed to parse URI %s", uri_str);
836 return FALSE;
837 }
838 if (g_str_has_suffix (uri_str, ".asc") ||
839 g_str_has_suffix (uri_str, ".p7b") ||
840 g_str_has_suffix (uri_str, ".p7c")) {
841 /* TRANSLATORS: downloading new signing file */
842 g_debug ("%s %s\n", _("Fetching signature"), uri_str);
843 gfu_main_set_install_loading_label (self, _("Fetching signature..."));
844 } else if (g_str_has_suffix (uri_str, ".gz")) {
845 /* TRANSLATORS: downloading new metadata file */
846 g_debug ("%s %s\n", _("Fetching metadata"), uri_str);
847 gfu_main_set_install_loading_label (self, _("Fetching metadata..."));
848 } else if (g_str_has_suffix (uri_str, ".cab")) {
849 /* TRANSLATORS: downloading new firmware file */
850 g_debug ("%s %s\n", _("Fetching firmware"), uri_str);
851 gfu_main_set_install_loading_label (self, _("Fetching firmware..."));
852 } else {
853 /* TRANSLATORS: downloading unknown file */
854 g_debug ("%s %s\n", _("Fetching file"), uri_str);
855 gfu_main_set_install_loading_label (self, _("Fetching file..."));
856 }
857 g_signal_connect (msg, "got-chunk",
858 G_CALLBACK (gfu_main_download_chunk_cb), self);
859 status_code = soup_session_send_message (self->soup_session, msg);
860 g_debug ("\n");
861 if (status_code == 429) {
862 g_autofree gchar *str = g_strndup (msg->response_body->data,
863 msg->response_body->length);
864 if (g_strcmp0 (str, "Too Many Requests") == 0) {
865 g_set_error (error,
866 FWUPD_ERROR,
867 FWUPD_ERROR_INVALID_FILE,
868 /* TRANSLATORS: the server is rate-limiting downloads */
869 "%s", _("Failed to download due to server limit"));
870 return FALSE;
871 }
872 g_set_error (error,
873 FWUPD_ERROR,
874 FWUPD_ERROR_INVALID_FILE,
875 _("Failed to download due to server limit: %s"), str);
876 return FALSE;
877 }
878 if (status_code != SOUP_STATUS_OK) {
879 g_set_error (error,
880 FWUPD_ERROR,
881 FWUPD_ERROR_INVALID_FILE,
882 _("Failed to download %s: %s"),
883 uri_str, soup_status_get_phrase (status_code));
884 return FALSE;
885 }
886
887 /* verify checksum */
888 if (checksum_expected != NULL) {
889 checksum_actual = g_compute_checksum_for_data (checksum_type,
890 (guchar *) msg->response_body->data,
891 (gsize) msg->response_body->length);
892 if (g_strcmp0 (checksum_expected, checksum_actual) != 0) {
893 g_set_error (error,
894 FWUPD_ERROR,
895 FWUPD_ERROR_INVALID_FILE,
896 _("Checksum invalid, expected %s got %s"),
897 checksum_expected, checksum_actual);
898 return FALSE;
899 }
900 }
901
902 /* save file */
903 if (!g_file_set_contents (fn,
904 msg->response_body->data,
905 msg->response_body->length,
906 &error_local)) {
907 g_set_error (error,
908 FWUPD_ERROR,
909 FWUPD_ERROR_WRITE,
910 _("Failed to save file: %s"),
911 error_local->message);
912 return FALSE;
913 }
914 return TRUE;
915 }
916
917 static gboolean
918 gfu_main_download_metadata_for_remote (GfuMain *self,
919 FwupdRemote *remote,
920 GError **error)
921 {
922 g_autofree gchar *basename_asc = NULL;
923 g_autofree gchar *basename_id_asc = NULL;
924 g_autofree gchar *basename_id = NULL;
925 g_autofree gchar *basename = NULL;
926 g_autofree gchar *filename = NULL;
927 g_autofree gchar *filename_asc = NULL;
928 g_autoptr(SoupURI) uri = NULL;
929 g_autoptr(SoupURI) uri_sig = NULL;
930
931 /* generate some plausible local filenames */
932 basename = g_path_get_basename (fwupd_remote_get_filename_cache (remote));
933 basename_id = g_strdup_printf ("%s-%s", fwupd_remote_get_id (remote), basename);
934
935 /* download the metadata */
936 filename = gfu_get_user_cache_path (basename_id);
937 gfu_main_set_install_loading_label (self, _("Creating cache path..."));
938 if (!gfu_common_mkdir_parent (filename, error))
939 return FALSE;
940 uri = soup_uri_new (fwupd_remote_get_metadata_uri (remote));
941 gfu_main_set_install_loading_label (self, _("Preparing to download file..."));
942 if (!gfu_main_download_file (self, uri, filename, NULL, error))
943 return FALSE;
944
945 /* download the signature */
946 basename_asc = g_path_get_basename (fwupd_remote_get_filename_cache_sig (remote));
947 basename_id_asc = g_strdup_printf ("%s-%s", fwupd_remote_get_id (remote), basename_asc);
948 filename_asc = gfu_get_user_cache_path (basename_id_asc);
949 uri_sig = soup_uri_new (fwupd_remote_get_metadata_uri_sig (remote));
950 gfu_main_set_install_loading_label (self, _("Preparing to download file..."));
951 if (!gfu_main_download_file (self, uri_sig, filename_asc, NULL, error))
952 return FALSE;
953
954 /* send all this to fwupd */
955 return fwupd_client_update_metadata (self->client,
956 fwupd_remote_get_id (remote),
957 filename,
958 filename_asc,
959 NULL, error);
789 g_autoptr(GError) error = NULL;
790
791 if (!fwupd_client_update_metadata_bytes_finish (FWUPD_CLIENT (source), res, &error)) {
792 gfu_main_error_dialog (self, _("Failed to refresh metadata"), error->message);
793 return;
794 }
795 gfu_main_show_install_loading (self, FALSE);
796 }
797
798 static void
799 gfu_main_get_lvfs_remote_cb (GObject *source, GAsyncResult *res, gpointer user_data)
800 {
801 GfuMain *self = (GfuMain *) user_data;
802 g_autoptr(FwupdRemote) remote = NULL;
803 g_autoptr(GError) error = NULL;
804
805 remote = fwupd_client_get_remote_by_id_finish (FWUPD_CLIENT (source), res, &error);
806 if (remote == NULL) {
807 gfu_main_error_dialog (self, _("Failed to find LVFS"), error->message);
808 gfu_main_show_install_loading (self, FALSE);
809 return;
810 }
811
812 gfu_main_set_install_loading_label (self, _("Refreshing remote..."));
813 fwupd_client_refresh_remote_async (self->client, remote,
814 self->cancellable,
815 gfu_main_refresh_remote_cb,
816 self);
817 }
818
819 static void
820 gfu_main_modify_remote_cb (GObject *source, GAsyncResult *res, gpointer user_data)
821 {
822 GfuMain *self = (GfuMain *) user_data;
823 g_autoptr(GError) error = NULL;
824
825 if (!fwupd_client_modify_remote_finish (FWUPD_CLIENT (source), res, &error)) {
826 gfu_main_error_dialog (self, _("Failed to enable LVFS"), error->message);
827 gfu_main_show_install_loading (self, FALSE);
828 return;
829 }
830
831 /* refresh the newly-enabled remote */
832 fwupd_client_get_remote_by_id_async (self->client, "lvfs", self->cancellable,
833 gfu_main_get_lvfs_remote_cb,
834 self);
960835 }
961836
962837 static void
963838 gfu_main_enable_lvfs_cb (GtkWidget *widget, GfuMain *self)
964839 {
965840 GtkWidget *w;
966 g_autoptr(FwupdRemote) remote = NULL;
967 g_autoptr(GError) error = NULL;
968841
969842 /* hide notification */
970843 w = GTK_WIDGET (gtk_builder_get_object (self->builder, "infobar_enable_lvfs"));
972845
973846 /* enable remote */
974847 gfu_main_show_install_loading (self, TRUE);
975 if (!fwupd_client_modify_remote (self->client, "lvfs", "Enabled", "true", NULL, &error)) {
976 gfu_main_error_dialog (self, _("Failed to enable LVFS"), error->message);
848 fwupd_client_modify_remote_async (self->client, "lvfs", "Enabled", "true",
849 self->cancellable,
850 gfu_main_modify_remote_cb,
851 self);
852 }
853
854 static void
855 gfu_main_get_remotes_cb (GObject *source, GAsyncResult *res, gpointer user_data)
856 {
857 GfuMain *self = (GfuMain *) user_data;
858 g_autoptr(GError) error = NULL;
859 g_autoptr(GPtrArray) remotes = NULL;
860
861 remotes = fwupd_client_get_remotes_finish (FWUPD_CLIENT (source), res, &error);
862 if (remotes == NULL) {
863 gfu_main_error_dialog (self, _("Failed to get remotes list"), error->message);
977864 gfu_main_show_install_loading (self, FALSE);
978865 return;
979 }
980
981 /* refresh the newly-enabled remote */
982 remote = fwupd_client_get_remote_by_id (self->client, "lvfs", NULL, &error);
983 if (remote == NULL) {
984 gfu_main_error_dialog (self, _("Failed to find LVFS"), error->message);
985 gfu_main_show_install_loading (self, FALSE);
986 return;
987 }
988 if (!gfu_main_download_metadata_for_remote (self, remote, &error)) {
989 gfu_main_error_dialog (self, _("Failed to download metadata for LVFS"), error->message);
990 gfu_main_show_install_loading (self, FALSE);
991 return;
992 }
993 gfu_main_show_install_loading (self, FALSE);
994 }
995
996 static gboolean
997 gfu_main_download_metadata (GfuMain *self, GError **error)
998 {
999 g_autoptr(GPtrArray) remotes = NULL;
1000
1001 /* begin downloading, show loading animation */
1002 gfu_main_show_install_loading (self, TRUE);
1003
1004 remotes = fwupd_client_get_remotes (self->client, NULL, error);
1005 if (remotes == NULL) {
1006 gfu_main_show_install_loading (self, FALSE);
1007 return FALSE;
1008866 }
1009867 for (guint i = 0; i < remotes->len; i++) {
1010868 FwupdRemote *remote = g_ptr_array_index (remotes, i);
1012870 continue;
1013871 if (fwupd_remote_get_kind (remote) != FWUPD_REMOTE_KIND_DOWNLOAD)
1014872 continue;
1015 if (!gfu_main_download_metadata_for_remote (self, remote, error)) {
1016 gfu_main_show_install_loading (self, FALSE);
1017 return FALSE;
1018 }
873 /* should this be a single async action? */
874 fwupd_client_refresh_remote_async (self->client, remote,
875 self->cancellable,
876 gfu_main_refresh_remote_cb,
877 self);
1019878 }
1020879
1021880 gfu_main_show_install_loading (self, FALSE);
1022 return TRUE;
1023881 }
1024882
1025883 static void
1026884 gfu_main_activate_refresh_metadata (GSimpleAction *simple, GVariant *parameter, gpointer user_data)
1027885 {
1028886 GfuMain *self = (GfuMain *) user_data;
1029 g_autoptr(GError) error = NULL;
1030 if (!gfu_main_download_metadata (self, &error))
1031 gfu_main_error_dialog (self, _("Failed to download metadata"), error->message);
1032 }
1033
1034 static gboolean
1035 gfu_main_install_release_to_device (GfuMain *self,
1036 FwupdDevice *dev,
1037 FwupdRelease *rel,
1038 GError **error)
1039 {
1040 GPtrArray *checksums;
1041 const gchar *remote_id;
1042 const gchar *uri_tmp;
1043 g_autofree gchar *fn = NULL;
1044 g_autofree gchar *uri_str = NULL;
1045 g_autofree gchar *install_str = NULL;
1046 g_autoptr(SoupURI) uri = NULL;
1047
1048 /* work out what remote-specific URI fields this should use */
1049 uri_tmp = fwupd_release_get_uri (rel);
1050 remote_id = fwupd_release_get_remote_id (rel);
1051 if (remote_id != NULL) {
1052 g_autoptr(FwupdRemote) remote = NULL;
1053 remote = fwupd_client_get_remote_by_id (self->client,
1054 remote_id,
1055 NULL,
1056 error);
1057 if (remote == NULL)
1058 return FALSE;
1059
1060 /* local and directory remotes have the firmware already */
1061 if (fwupd_remote_get_kind (remote) == FWUPD_REMOTE_KIND_LOCAL) {
1062 const gchar *fn_cache = fwupd_remote_get_filename_cache (remote);
1063 g_autofree gchar *path = g_path_get_dirname (fn_cache);
1064
1065 fn = g_build_filename (path, uri_tmp, NULL);
1066 } else if (fwupd_remote_get_kind (remote) == FWUPD_REMOTE_KIND_DIRECTORY) {
1067 fn = g_strdup (uri_tmp + 7);
1068 }
1069 /* install with flags chosen by the user */
1070 if (fn != NULL) {
1071 return fwupd_client_install (self->client,
1072 fwupd_device_get_id (dev),
1073 fn, self->flags, NULL, error);
1074 }
1075
1076 uri_str = fwupd_remote_build_firmware_uri (remote, uri_tmp, error);
1077 if (uri_str == NULL)
1078 return FALSE;
1079 } else {
1080 uri_str = g_strdup (uri_tmp);
1081 }
1082
1083 /* download file */
1084 g_debug ("Downloading %s for %s...\n",
1085 fwupd_release_get_version (rel),
1086 fwupd_device_get_name (dev));
1087 gfu_main_set_install_loading_label (self, _("Preparing to download file..."));
1088 /* place in gfu cache directory */
1089 fn = gfu_get_user_cache_path (uri_str);
1090 /* TRANSLATORS: creating directory for the firmware download */
1091 gfu_main_set_install_loading_label (self, _("Creating cache path..."));
1092 if (!gfu_common_mkdir_parent (fn, error))
1093 return FALSE;
1094 checksums = fwupd_release_get_checksums (rel);
1095 uri = soup_uri_new (uri_str);
1096 if (!gfu_main_download_file (self, uri, fn,
1097 fwupd_checksum_get_best (checksums),
1098 error))
1099 return FALSE;
1100 /* if the device specifies ONLY_OFFLINE automatically set this flag */
1101 if (fwupd_device_has_flag (dev, FWUPD_DEVICE_FLAG_ONLY_OFFLINE))
1102 self->flags |= FWUPD_INSTALL_FLAG_OFFLINE;
1103 install_str = gfu_operation_to_string (self->current_operation, dev);
1104 gfu_main_set_install_loading_label (self, install_str);
1105 g_timer_start (self->time_elapsed);
1106 return fwupd_client_install (self->client,
1107 fwupd_device_get_id (dev), fn,
1108 self->flags, NULL, error);
887
888 gfu_main_set_install_loading_label (self, _("Refreshing remotes..."));
889 gfu_main_show_install_loading (self, TRUE);
890 fwupd_client_get_remotes_async (self->client,
891 self->cancellable,
892 gfu_main_get_remotes_cb,
893 self);
1109894 }
1110895
1111896 /* used to retrieve the current device post-install */
1115900 } GfuPostInstallHelper;
1116901
1117902 static void
903 gfu_main_show_update_message (GfuMain *self, const gchar *str)
904 {
905 GtkWindow *window;
906 GtkWidget *dialog;
907
908 window = GTK_WINDOW (gtk_builder_get_object (self->builder, "dialog_main"));
909 dialog = gtk_message_dialog_new (window,
910 GTK_DIALOG_MODAL,
911 GTK_MESSAGE_QUESTION,
912 GTK_BUTTONS_YES_NO,
913 /* TRANSLATORS: prompting a reboot to do something */
914 "%s", _("The update requires further action"));
915 gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), "%s", str);
916 gtk_dialog_run (GTK_DIALOG (dialog));
917 gtk_widget_destroy (dialog);
918 }
919
920 static void
1118921 gfu_main_update_devices_post_install_cb (GObject *source_object, GAsyncResult *res, gpointer user_data)
1119922 {
1120923 GtkContainer *w;
1121924 GtkWidget *l = NULL;
1122 GPtrArray *devices;
1123 GfuPostInstallHelper *helper = (GfuPostInstallHelper*)user_data;
1124 g_autoptr(GError) error = NULL;
1125 g_autoptr(GVariant) tmp = g_dbus_proxy_call_finish (helper->self->proxy, res, &error);
925 g_autoptr(GPtrArray) devices = NULL;
926 GfuPostInstallHelper *helper = (GfuPostInstallHelper*) user_data;
927 g_autoptr(GError) error = NULL;
1126928
1127929 /* clear out device list */
1128930 w = GTK_CONTAINER (gtk_builder_get_object (helper->self->builder, "listbox_main"));
1129931 gtk_list_box_unselect_all (GTK_LIST_BOX (w));
1130932 gtk_container_foreach (w, (GtkCallback) gfu_main_remove_row, w);
1131933
1132 if (tmp == NULL) {
934 devices = fwupd_client_get_devices_finish (FWUPD_CLIENT (source_object), res, &error);
935 if (devices == NULL) {
1133936 gfu_main_error_dialog (helper->self, _("Failed to load device list"), error->message);
1134937 return;
1135938 }
1136
1137 devices = fwupd_device_array_from_variant (tmp);
1138939
1139940 /* create a row in the listbox for each updatable device */
1140941 for (guint i = 0; i < devices->len; i++) {
1156957 }
1157958 }
1158959
960 /* show any manual action required */
961 if (helper->self->current_message != NULL) {
962 gfu_main_show_update_message (helper->self, helper->self->current_message);
963 g_clear_pointer (&helper->self->current_message, g_free);
964 }
965
1159966 /* reboot or shutdown if necessary (UEFI update) */
1160967 gfu_main_reboot_shutdown_prompt (helper->self);
1161968
1166973 }
1167974
1168975 /* update release list */
1169 g_dbus_proxy_call (helper->self->proxy,
1170 "GetReleases",
1171 g_variant_new ("(s)", helper->device_id),
1172 G_DBUS_CALL_FLAGS_NONE,
1173 -1,
1174 helper->self->cancellable,
1175 (GAsyncReadyCallback) gfu_main_update_releases_cb,
1176 helper->self);
976 fwupd_client_get_releases_async (helper->self->client,
977 helper->device_id,
978 helper->self->cancellable,
979 (GAsyncReadyCallback) gfu_main_update_releases_cb,
980 helper->self);
981 }
982
983 static void
984 gfu_main_install_release_cb (GObject *source, GAsyncResult *res, gpointer user_data)
985 {
986 GfuMain *self = (GfuMain *) user_data;
987 g_autoptr(GError) error = NULL;
988 GfuPostInstallHelper *helper = NULL;
989 GtkWidget *dialog;
990 GtkWidget *window;
991
992 if (!fwupd_client_install_bytes_finish (FWUPD_CLIENT (source), res, &error)) {
993 gfu_main_error_dialog (self, _("Failed to install firmware"), error->message);
994 gfu_main_show_install_loading (self, FALSE);
995 return;
996 }
997
998 /* create helper struct */
999 helper = g_new0 (GfuPostInstallHelper, 1);
1000 helper->self = self;
1001 helper->device_id = fwupd_device_get_id (self->device);
1002
1003 /* update device list */
1004 fwupd_client_get_devices_async (self->client,
1005 self->cancellable,
1006 gfu_main_update_devices_post_install_cb,
1007 helper);
1008
1009 gfu_main_show_install_loading (self, FALSE);
1010
1011 g_debug ("Installation complete.\n");
1012 // FIXME: device-changed signal
1013
1014 if (fwupd_device_get_flags (self->device) & FWUPD_DEVICE_FLAG_NEEDS_SHUTDOWN ||
1015 fwupd_device_get_flags (self->device) & FWUPD_DEVICE_FLAG_NEEDS_REBOOT)
1016 return;
1017
1018 window = GTK_WIDGET (gtk_builder_get_object (self->builder, "dialog_main"));
1019 dialog = gtk_message_dialog_new (GTK_WINDOW (window),
1020 GTK_DIALOG_MODAL,
1021 GTK_MESSAGE_INFO,
1022 GTK_BUTTONS_OK,
1023 /* TRANSLATORS: inform the user that the installation was successful onto the device */
1024 "%s", _("Installation successful"));
1025 gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
1026 _("Installed firmware version %s on %s"),
1027 fwupd_release_get_version (self->release),
1028 fwupd_device_get_name (self->device));
1029
1030 gtk_dialog_run (GTK_DIALOG (dialog));
1031 gtk_widget_destroy (dialog);
1032 self->flags = FWUPD_INSTALL_FLAG_NONE;
11771033 }
11781034
11791035 static void
12261082 gtk_dialog_add_button (GTK_DIALOG (dialog), _("Downgrade"), GTK_RESPONSE_OK);
12271083 }
12281084 }
1229 #if FWUPD_CHECK_VERSION(1,3,3)
12301085 if (fwupd_device_has_flag (self->device, FWUPD_DEVICE_FLAG_USABLE_DURING_UPDATE))
12311086 gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
12321087 _("The device will remain usable for the duration of the update"));
12331088 else
12341089 gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
12351090 _("The device will be unusable while the update is installing"));
1236 #else
1237 gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
1238 reinstall? _("Reinstall this firmware file?"): _("Install this firmware file?"));
1239 #endif
12401091
12411092 /* handle dialog response */
12421093 switch (gtk_dialog_run (GTK_DIALOG (dialog))) {
12431094 case GTK_RESPONSE_OK:
12441095 {
1245 /* keep track of which device is being installed upon */
1246 g_autoptr(GString) device_id = g_string_new (NULL);
1247 g_string_assign (device_id, fwupd_device_get_id (self->device));
1248
12491096 gtk_widget_destroy (dialog);
12501097
12511098 /* begin installing, show loading animation */
12521099 gfu_main_show_install_loading (self, TRUE);
1253
1254 if (!gfu_main_install_release_to_device (self, self->device, self->release, &error)) {
1255 gfu_main_show_install_loading (self, FALSE);
1256 gfu_main_error_dialog (self, _("Failed to install firmware release"), error->message);
1257 } else {
1258 /* create helper struct */
1259 GfuPostInstallHelper *helper = g_new0 (GfuPostInstallHelper, 1);
1260 guint64 flags = fwupd_device_get_flags (self->device);
1261 helper->self = self;
1262 helper->device_id = device_id->str;
1263
1264 /* update device list */
1265 g_dbus_proxy_call (self->proxy,
1266 "GetDevices",
1267 NULL,
1268 G_DBUS_CALL_FLAGS_NONE,
1269 -1,
1270 self->cancellable,
1271 (GAsyncReadyCallback) gfu_main_update_devices_post_install_cb,
1272 helper);
1273
1274 gfu_main_show_install_loading (self, FALSE);
1275
1276 g_debug ("Installation complete.\n");
1277 // FIXME: device-changed signal
1278
1279 if (flags & FWUPD_DEVICE_FLAG_NEEDS_SHUTDOWN ||
1280 flags & FWUPD_DEVICE_FLAG_NEEDS_REBOOT)
1281 break;
1282
1283 dialog = gtk_message_dialog_new (GTK_WINDOW (window),
1284 GTK_DIALOG_MODAL,
1285 GTK_MESSAGE_INFO,
1286 GTK_BUTTONS_OK,
1287 /* TRANSLATORS: inform the user that the installation was successful onto the device */
1288 "%s", _("Installation successful"));
1289 gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
1290 _("Installed firmware version %s on %s"),
1291 fwupd_release_get_version (self->release),
1292 fwupd_device_get_name (self->device));
1293
1294 gtk_dialog_run (GTK_DIALOG (dialog));
1295 gtk_widget_destroy (dialog);
1296 }
1297 self->flags = FWUPD_INSTALL_FLAG_NONE;
1100 gfu_main_set_install_loading_label (self, _("Downloading file..."));
1101 fwupd_client_install_release2_async (self->client,
1102 self->device,
1103 self->release,
1104 self->flags,
1105 FWUPD_CLIENT_DOWNLOAD_FLAG_NONE,
1106 self->cancellable,
1107 gfu_main_install_release_cb,
1108 self);
12981109 break;
12991110 }
13001111 case GTK_RESPONSE_CANCEL:
13701181 }
13711182
13721183 static void
1184 gfu_main_verify_update_cb (GObject *source, GAsyncResult *res, gpointer user_data)
1185 {
1186 GfuMain *self = (GfuMain *) user_data;
1187 g_autoptr(GError) error = NULL;
1188
1189 if (!fwupd_client_verify_update_finish (FWUPD_CLIENT (source), res, &error)) {
1190 /* TRANSLATORS: verify means checking the actual checksum of the firmware */
1191 gfu_main_error_dialog (self, _("Failed to update checksums"), error->message);
1192 return;
1193 }
1194 gfu_main_refresh_ui (self);
1195 }
1196
1197 static void
13731198 gfu_main_device_verify_update_cb (GtkWidget *widget, GfuMain *self)
13741199 {
13751200 GtkWidget *dialog;
13761201 GtkWidget *window = GTK_WIDGET (gtk_builder_get_object (self->builder, "dialog_main"));
1377 g_autoptr(GError) error = NULL;
13781202
13791203 dialog = gtk_message_dialog_new (GTK_WINDOW (window),
13801204 GTK_DIALOG_MODAL,
13871211 switch (gtk_dialog_run (GTK_DIALOG (dialog))) {
13881212 case GTK_RESPONSE_YES:
13891213 gtk_widget_destroy (dialog);
1390 g_clear_error (&error);
1391 if (!fwupd_client_verify_update (self->client,
1392 fwupd_device_get_id (self->device),
1393 self->cancellable,
1394 &error)) {
1395 /* TRANSLATORS: verify means checking the actual checksum of the firmware */
1396 gfu_main_error_dialog (self, _("Failed to update checksums"), error->message);
1397 }
1398 gfu_main_refresh_ui (self);
1214 fwupd_client_verify_update_async (self->client,
1215 fwupd_device_get_id (self->device),
1216 self->cancellable,
1217 gfu_main_verify_update_cb,
1218 self);
13991219 return;
14001220 default:
14011221 gtk_widget_destroy (dialog);
14841304
14851305 /* async call for releases */
14861306 if (fwupd_device_has_flag (self->device, FWUPD_DEVICE_FLAG_UPDATABLE)) {
1487 g_dbus_proxy_call (self->proxy,
1488 "GetReleases",
1489 g_variant_new ("(s)", fwupd_device_get_id (self->device)),
1490 G_DBUS_CALL_FLAGS_NONE,
1491 -1,
1492 self->cancellable,
1493 (GAsyncReadyCallback) gfu_main_update_releases_cb,
1494 self);
1307 fwupd_client_get_releases_async (self->client,
1308 fwupd_device_get_id (self->device),
1309 self->cancellable,
1310 (GAsyncReadyCallback) gfu_main_update_releases_cb,
1311 self);
14951312 }
14961313
14971314 gfu_main_refresh_ui (self);
15351352 }
15361353
15371354 static void
1538 gfu_main_signals_cb (GDBusProxy *proxy,
1539 const gchar *sender_name,
1540 const gchar *signal_name,
1541 GVariant *parameters,
1542 GfuMain *self)
1543 {
1544 g_autoptr(FwupdDevice) dev = NULL;
1545 if (g_strcmp0 (signal_name, "DeviceAdded") == 0) {
1546 dev = fwupd_device_from_variant (parameters);
1547 g_debug ("Emitting ::device-added(%s)",
1548 fwupd_device_get_id (dev));
1549 gfu_main_device_added_cb (self->client, dev, self);
1550 return;
1551 }
1552 if (g_strcmp0 (signal_name, "DeviceRemoved") == 0) {
1553 dev = fwupd_device_from_variant (parameters);
1554 g_debug ("Emitting ::device-removed(%s)",
1555 fwupd_device_get_id (dev));
1556 gfu_main_device_removed_cb (self->client, dev, self);
1557 return;
1558 }
1559 if (g_strcmp0 (signal_name, "DeviceChanged") == 0) {
1560 FwupdStatus status = fwupd_client_get_status (self->client);
1561 gint percentage;
1562 g_autoptr(GString) status_str = g_string_new (NULL);
1563 g_autofree gchar *device_str = NULL;
1564
1565 dev = fwupd_device_from_variant (parameters);
1566
1567 /* update progress */
1568 percentage = fwupd_client_get_percentage (self->client);
1569 g_string_append_printf (status_str, "%s: %d%%\n",
1570 gfu_status_to_string (status),
1571 percentage);
1572
1573 /* once we have good data show an estimate of time remaining */
1574 if (gfu_main_estimate_ready (self, percentage)) {
1575 g_autofree gchar *remaining = gfu_main_time_remaining_str (self);
1576 if (remaining != NULL)
1577 g_string_append_printf (status_str, "%s…", remaining);
1578 }
1579 gfu_main_set_install_status_label (self, status_str->str);
1580
1581 /* same as last time, so ignore */
1582 if (self->device != NULL &&
1583 fwupd_device_compare (self->device, dev) == 0)
1355 gfu_main_set_feature_flags_cb (GObject *source, GAsyncResult *res, gpointer user_data)
1356 {
1357 GfuMain *self = (GfuMain *) user_data;
1358 g_autoptr(GError) error = NULL;
1359 if (!fwupd_client_set_feature_flags_finish (FWUPD_CLIENT (source), res, &error)) {
1360 g_warning ("%s", error->message);
1361 if (g_error_matches (error,
1362 FWUPD_ERROR,
1363 FWUPD_ERROR_NOT_SUPPORTED)) {
1364 gfu_main_error_fatal (self, _("The fwupd service is not available for your OS."));
15841365 return;
1585
1586 device_str = gfu_operation_to_string (self->current_operation,
1587 dev);
1588 gfu_main_set_install_loading_label (self, device_str);
1589
1590 return;
1591 }
1592
1593 g_debug ("Unknown signal name '%s' from %s", signal_name, sender_name);
1594 }
1595
1596 static void
1597 gfu_main_proxy_new_cb (GObject *source_object, GAsyncResult *res, gpointer user_data)
1598 {
1599 g_autoptr(GError) error = NULL;
1366 }
1367 }
1368 fwupd_client_get_devices_async (self->client, self->cancellable,
1369 gfu_main_update_devices_cb, self);
1370 fwupd_client_get_remotes_async (self->client, self->cancellable,
1371 gfu_main_update_remotes_cb, self);
1372 }
1373
1374 static void
1375 gfu_main_unlock_cb (GObject *source, GAsyncResult *res, gpointer user_data)
1376 {
16001377 GfuMain *self = (GfuMain *) user_data;
1601 self->proxy = g_dbus_proxy_new_for_bus_finish (res, &error);
1602
1603 if (self->proxy == NULL) {
1604 gfu_main_error_dialog (self, _("Error connecting to fwupd"), error->message);
1605 return;
1606 }
1607
1608 /* async call for devices */
1609 g_dbus_proxy_call (self->proxy,
1610 "GetDevices",
1611 NULL,
1612 G_DBUS_CALL_FLAGS_NONE,
1613 -1,
1614 self->cancellable,
1615 (GAsyncReadyCallback) gfu_main_update_devices_cb,
1616 self);
1617
1618 /* async call for remotes */
1619 g_dbus_proxy_call (self->proxy,
1620 "GetRemotes",
1621 NULL,
1622 G_DBUS_CALL_FLAGS_NONE,
1623 -1,
1624 self->cancellable,
1625 (GAsyncReadyCallback) gfu_main_update_remotes_cb,
1626 self);
1627
1628 /* connecting signals for updating devices */
1629 g_signal_connect (self->proxy, "g-signal",
1630 G_CALLBACK (gfu_main_signals_cb), self);
1378 g_autoptr(GError) error = NULL;
1379
1380 if (!fwupd_client_verify_update_finish (FWUPD_CLIENT (source), res, &error)) {
1381 gfu_main_error_dialog (self, _("Failed to unlock device"), error->message);
1382 return;
1383 }
1384 gfu_main_reboot_shutdown_prompt (self);
16311385 }
16321386
16331387 static void
16341388 gfu_main_device_unlock_cb (GtkWidget *widget, GfuMain *self)
16351389 {
1636 g_autoptr(GError) error = NULL;
1637 if (!fwupd_client_unlock (self->client,
1638 fwupd_device_get_id (self->device),
1639 self->cancellable,
1640 &error)) {
1641 gfu_main_error_dialog (self, _("Failed to unlock device"), error->message);
1642 } else {
1643 gfu_main_reboot_shutdown_prompt (self);
1644 }
1390 fwupd_client_unlock_async (self->client,
1391 fwupd_device_get_id (self->device),
1392 self->cancellable,
1393 gfu_main_unlock_cb,
1394 self);
16451395 }
16461396
16471397 static void
16551405 {
16561406 if (response_id == GTK_RESPONSE_CLOSE)
16571407 gtk_info_bar_set_revealed (infobar, FALSE);
1408 }
1409
1410 static void
1411 gfu_main_client_connect_cb (GObject *source, GAsyncResult *res, gpointer user_data)
1412 {
1413 GfuMain *self = (GfuMain *) user_data;
1414 g_autoptr(GError) error = NULL;
1415
1416 /* get result */
1417 if (!fwupd_client_connect_finish (FWUPD_CLIENT (source), res, &error)) {
1418 g_warning ("%s", error->message);
1419 gfu_main_error_fatal (self, _("The fwupd service is not available for your OS."));
1420 return;
1421 }
1422
1423 /* get data */
1424 fwupd_client_set_feature_flags_async (self->client,
1425 FWUPD_FEATURE_FLAG_UPDATE_ACTION,
1426 self->cancellable,
1427 gfu_main_set_feature_flags_cb, self);
16581428 }
16591429
16601430 static void
17291499 gfu_main_refresh_ui (self);
17301500 gtk_widget_show (main_window);
17311501
1732 g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM,
1733 G_DBUS_PROXY_FLAGS_NONE,
1734 NULL,
1735 FWUPD_DBUS_SERVICE,
1736 FWUPD_DBUS_PATH,
1737 FWUPD_DBUS_INTERFACE,
1738 self->cancellable,
1739 (GAsyncReadyCallback) gfu_main_proxy_new_cb,
1740 self);
1502 /* connect to fwupd */
1503 fwupd_client_connect_async (self->client, self->cancellable,
1504 gfu_main_client_connect_cb, self);
1505 }
1506
1507 static void
1508 gfu_main_client_device_changed_cb (FwupdClient *client,
1509 FwupdDevice *device,
1510 GfuMain *self)
1511 {
1512 FwupdStatus status = fwupd_client_get_status (self->client);
1513 gint percentage;
1514 g_autoptr(GString) status_str = g_string_new (NULL);
1515 g_autofree gchar *device_str = NULL;
1516
1517 if (self->current_message == NULL) {
1518 const gchar *tmp = fwupd_device_get_update_message (device);
1519 if (tmp != NULL)
1520 self->current_message = g_strdup (tmp);
1521 }
1522
1523 /* update progress */
1524 percentage = fwupd_client_get_percentage (self->client);
1525 g_string_append_printf (status_str, "%s: %d%%\n",
1526 gfu_status_to_string (status),
1527 percentage);
1528
1529 /* once we have good data show an estimate of time remaining */
1530 if (gfu_main_estimate_ready (self, percentage)) {
1531 g_autofree gchar *remaining = gfu_main_time_remaining_str (self);
1532 if (remaining != NULL)
1533 g_string_append_printf (status_str, "%s…", remaining);
1534 }
1535 gfu_main_set_install_status_label (self, status_str->str);
1536
1537 /* same as last time, so ignore */
1538 if (self->device != NULL &&
1539 fwupd_device_compare (self->device, device) == 0)
1540 return;
1541
1542 device_str = gfu_operation_to_string (self->current_operation, device);
1543 gfu_main_set_install_loading_label (self, device_str);
17411544 }
17421545
17431546 static void
17571560 g_object_unref (self->application);
17581561 if (self->releases != NULL)
17591562 g_ptr_array_unref (self->releases);
1760 if (self->proxy != NULL)
1761 g_object_unref (self->proxy);
1762 if (self->soup_session != NULL)
1763 g_object_unref (self->soup_session);
17641563 g_timer_destroy (self->time_elapsed);
1564 g_free (self->current_message);
17651565 g_free (self);
17661566 }
17671567
18001600
18011601 self->cancellable = g_cancellable_new ();
18021602 self->client = fwupd_client_new ();
1603 fwupd_client_set_user_agent_for_package (self->client, GETTEXT_PACKAGE, VERSION);
1604 g_signal_connect (self->client, "notify::percentage",
1605 G_CALLBACK (gfu_main_client_percentage_changed_cb), self);
1606 g_signal_connect (self->client, "device-changed",
1607 G_CALLBACK (gfu_main_client_device_changed_cb), self);
1608 g_signal_connect (self->client, "device-added",
1609 G_CALLBACK (gfu_main_device_added_cb), self);
1610 g_signal_connect (self->client, "device-removed",
1611 G_CALLBACK (gfu_main_device_removed_cb), self);
1612
18031613 self->time_elapsed = g_timer_new ();
18041614
18051615 /* ensure single instance */
00 <?xml version="1.0" encoding="UTF-8"?>
1 <!-- Generated with glade 3.22.1 -->
1 <!-- Generated with glade 3.36.0 -->
22 <interface>
33 <requires lib="gtk+" version="3.20"/>
44 <object class="GtkApplicationWindow" id="dialog_main">
66 <property name="height_request">600</property>
77 <property name="can_focus">False</property>
88 <property name="icon_name">computer</property>
9 <child type="titlebar">
10 <object class="GtkHeaderBar" id="header">
11 <property name="visible">True</property>
12 <property name="can_focus">False</property>
13 <property name="title" translatable="yes">Firmware</property>
14 <property name="show_close_button">True</property>
15 <child>
16 <object class="GtkButton" id="button_back">
17 <property name="visible">True</property>
18 <property name="can_focus">True</property>
19 <child internal-child="accessible">
20 <object class="AtkObject" id="button_back_accessible">
21 <property name="accessible-name" translatable="yes">Go back</property>
22 </object>
23 </child>
24 <style>
25 <class name="image-button"/>
26 </style>
27 <child>
28 <object class="GtkImage" id="back_image">
29 <property name="visible">True</property>
30 <property name="can_focus">False</property>
31 <property name="icon_name">go-previous-symbolic</property>
32 <property name="icon_size">1</property>
33 </object>
34 </child>
35 <style>
36 <class name="image-button"/>
37 </style>
38 </object>
39 </child>
40 <child>
41 <object class="GtkMenuButton" id="menu_button">
42 <property name="visible">True</property>
43 <property name="can_focus">True</property>
44 <property name="sensitive">True</property>
45 <property name="menu_model">primary_menu</property>
46 <child>
47 <object class="GtkImage">
48 <property name="visible">True</property>
49 <property name="icon_name">open-menu-symbolic</property>
50 <property name="icon_size">1</property>
51 </object>
52 </child>
53 </object>
54 <packing>
55 <property name="pack-type">end</property>
56 </packing>
57 </child>
58 </object>
59 </child>
609 <child>
6110 <object class="GtkBox" id="box_main_infobar">
6211 <property name="visible">True</property>
6413 <property name="orientation">vertical</property>
6514 <child>
6615 <object class="GtkInfoBar" id="infobar_enable_lvfs">
67 <property name="visible">True</property>
6816 <property name="can_focus">False</property>
6917 <property name="orientation">vertical</property>
7018 <property name="message_type">question</property>
482430 <property name="can_focus">False</property>
483431 <property name="halign">start</property>
484432 <property name="label">REPLACED</property>
433 <property name="wrap">True</property>
485434 <property name="selectable">True</property>
486435 </object>
487436 <packing>
529478 <style>
530479 <class name="dim-label"/>
531480 </style>
532 </object>
533 <packing>
481 </object>
482 <packing>
534483 <property name="left_attach">0</property>
535484 <property name="top_attach">5</property>
536485 </packing>
541490 <property name="can_focus">False</property>
542491 <property name="halign">start</property>
543492 <property name="label">REPLACED</property>
544 <property name="selectable">False</property>
545 </object>
546 <packing>
493 </object>
494 <packing>
547495 <property name="left_attach">1</property>
548496 <property name="top_attach">5</property>
549497 </packing>
578526 <child>
579527 <object class="GtkButton" id="button_verify_update">
580528 <property name="label" translatable="yes">Update checksums</property>
581 <property name="visible">False</property>
582 <property name="sensitive">True</property>
583529 <property name="can_focus">True</property>
584530 <property name="receives_default">True</property>
585531 </object>
604550 <child>
605551 <object class="GtkButton" id="button_releases">
606552 <property name="label" translatable="yes">Show Releases</property>
607 <property name="visible">False</property>
608 <property name="sensitive">True</property>
609553 <property name="can_focus">True</property>
610554 <property name="receives_default">True</property>
611555 </object>
14021346 </packing>
14031347 </child>
14041348 <child>
1405 <object class="GtkBox" id="box_no_devices_found">
1349 <object class="GtkBox" id="box_error">
14061350 <property name="visible">True</property>
14071351 <property name="can_focus">False</property>
14081352 <property name="halign">center</property>
14181362 <property name="pixel_size">64</property>
14191363 <property name="icon_name">face-sad-symbolic</property>
14201364 <property name="icon_size">6</property>
1365 <style>
1366 <class name="dim-label"/>
1367 </style>
14211368 </object>
14221369 <packing>
14231370 <property name="expand">False</property>
14261373 </packing>
14271374 </child>
14281375 <child>
1429 <object class="GtkLabel">
1376 <object class="GtkLabel" id="label_error">
14301377 <property name="visible">True</property>
14311378 <property name="can_focus">False</property>
14321379 <property name="halign">center</property>
14441391 </child>
14451392 </object>
14461393 <packing>
1447 <property name="name">nodevices</property>
1394 <property name="name">error</property>
14481395 <property name="title" translatable="yes">No Devices</property>
14491396 <property name="position">3</property>
14501397 </packing>
14531400 <packing>
14541401 <property name="expand">True</property>
14551402 <property name="fill">True</property>
1403 <property name="position">1</property>
1404 </packing>
1405 </child>
1406 </object>
1407 </child>
1408 <child type="titlebar">
1409 <object class="GtkHeaderBar" id="header">
1410 <property name="visible">True</property>
1411 <property name="can_focus">False</property>
1412 <property name="title" translatable="yes">Firmware</property>
1413 <property name="show_close_button">True</property>
1414 <child>
1415 <object class="GtkButton" id="button_back">
1416 <property name="visible">True</property>
1417 <property name="can_focus">True</property>
1418 <property name="receives_default">False</property>
1419 <child>
1420 <object class="GtkImage" id="back_image">
1421 <property name="visible">True</property>
1422 <property name="can_focus">False</property>
1423 <property name="icon_name">go-previous-symbolic</property>
1424 <property name="icon_size">1</property>
1425 </object>
1426 </child>
1427 <style>
1428 <class name="image-button"/>
1429 </style>
1430 </object>
1431 </child>
1432 <child>
1433 <object class="GtkMenuButton" id="menu_button">
1434 <property name="visible">True</property>
1435 <property name="can_focus">True</property>
1436 <property name="receives_default">False</property>
1437 <property name="menu_model">primary_menu</property>
1438 <child>
1439 <object class="GtkImage">
1440 <property name="visible">True</property>
1441 <property name="can_focus">False</property>
1442 <property name="icon_name">open-menu-symbolic</property>
1443 <property name="icon_size">1</property>
1444 </object>
1445 </child>
1446 </object>
1447 <packing>
1448 <property name="pack_type">end</property>
14561449 <property name="position">1</property>
14571450 </packing>
14581451 </child>
2121 libgtk,
2222 libfwupd,
2323 libxmlb,
24 libsoup,
2524 ],
2625 c_args : cargs,
2726 install : true,
0 libjcat
01 libxmlb
2 fwupd
0 [wrap-git]
1 directory = fwupd
2 url = https://github.com/fwupd/fwupd.git
3 revision = master
0 [wrap-git]
1 directory = gcab
2 url = https://gitlab.gnome.org/GNOME/gcab.git
3 revision = b55268ac1020cd6c033acb52f2e6ae984bf5c9fd
0 [wrap-git]
1 directory = libjcat
2 url = https://github.com/hughsie/libjcat.git
3 revision = 0.1.0