Skip to content

Commit

Permalink
- Fix issue where Google Fonts cache is never updated if connection i…
Browse files Browse the repository at this point in the history
…s not active at startup, Flatpak builds hit this issue everytime.
  • Loading branch information
JerryCasiano committed Dec 4, 2020
1 parent b3435a7 commit 2b9ed42
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 10 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
0.8.2 -> 0.8.3

- Fixes an issue where if a network connection is not available at startup
Google Fonts information will never be updated. Flatpak builds hit this issue
everytime. Regular installations can simply restart to work around this bug.

0.8.1 -> 0.8.2

- Revert change incompatible with older Vala versions
Expand Down
2 changes: 1 addition & 1 deletion build-aux/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

PACKAGE_NAME = font-manager
PACKAGE_VERSION = 0.8.2
PACKAGE_VERSION = 0.8.3

ABS_TOP_SRCDIR = $(shell realpath ../)
ABS_SRCDIR = $(shell realpath .)
Expand Down
2 changes: 1 addition & 1 deletion debian/changelog
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
font-manager (0.8.2-1ubuntu1) UNRELEASED; urgency=medium
font-manager (0.8.3-1ubuntu1) UNRELEASED; urgency=medium

* Refer to https://github.com/FontManager/master/commits/master.

Expand Down
4 changes: 2 additions & 2 deletions fedora/font-manager.spec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
%global MajorVersion 0
%global MinorVersion 8
%global PatchVersion 2
%global PatchVersion 3
%global build_timestamp %{lua: print(os.date("%Y%m%d"))}
%global DBusName org.gnome.FontManager
%global DBusName2 org.gnome.FontViewer
Expand Down Expand Up @@ -141,5 +141,5 @@ appstream-util validate-relax --nonet %{buildroot}/%{_datadir}/metainfo/*.appdat
%{_libdir}/thunarx-3/thunar-%{name}.so

%changelog
* Tue Dec 1 2020 JerryCasiano <JerryCasiano@gmail.com> 0.8.2-1
* Tue Dec 1 2020 JerryCasiano <JerryCasiano@gmail.com> 0.8.3-1
- Refer to https://github.com/FontManager/font-manager/commits/master for changes.
4 changes: 2 additions & 2 deletions lib/unicode/Unicode.vapi
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* Unicode-0.8.2.vapi generated by vapigen, do not modify. */
/* Unicode-0.8.3.vapi generated by vapigen, do not modify. */

[CCode (cprefix = "Unicode", gir_namespace = "Unicode", gir_version = "0.8.2", lower_case_cprefix = "unicode_")]
[CCode (cprefix = "Unicode", gir_namespace = "Unicode", gir_version = "0.8.3", lower_case_cprefix = "unicode_")]
namespace Unicode {
[CCode (cheader_filename = "unicode-character-map.h", type_id = "unicode_character_map_get_type ()")]
public class CharacterMap : Gtk.DrawingArea, Atk.Implementor, Gtk.Buildable, Gtk.Scrollable {
Expand Down
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
project('font-manager', ['c', 'vala'], license: 'GPL3', version: '0.8.2')
project('font-manager', ['c', 'vala'], license: 'GPL3', version: '0.8.3')

if meson.version().version_compare('< 0.50')
error('Meson version is @0@ but project requires >= 0.50'.format(meson.version()))
Expand Down
5 changes: 3 additions & 2 deletions org.gnome.FontManager.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
app-id: org.gnome.FontManager
runtime: org.gnome.Platform
runtime-version: 'master'
runtime-version: '3.38'
sdk: org.gnome.Sdk

command: font-manager
Expand All @@ -9,6 +9,7 @@ finish-args:
- --socket=wayland
- --socket=fallback-x11
- --share=ipc
- --share=network

# XDG Data/Fonts location
- --filesystem=xdg-data/fonts:create
Expand All @@ -32,5 +33,5 @@ modules:
- -Dreproducible=true
sources:
- type: git
url: https://github.com/FontManager/font-manager.git
path: .

11 changes: 10 additions & 1 deletion src/font-manager/web/google/GoogleFonts.vala
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ namespace FontManager.GoogleFonts {
[GtkChild] Gtk.Paned filter_pane;
[GtkChild] PreviewPane preview_pane;

bool cache_checked = false;
bool _connected_ = false;
bool _visible_ = false;
uint http_status = Soup.Status.OK;
Expand Down Expand Up @@ -124,7 +125,13 @@ namespace FontManager.GoogleFonts {
font_list_pane.select_first_row();
font_list_pane.place_holder.hide();
} catch (Error e) {
show_http_status(_("Error procesing data"), e.message, null, "dialog-error-symbolic");
if (cache_checked)
show_http_status(_("Error procesing data"), e.message, null, "dialog-error-symbolic");
else
update_font_list_cache.begin((obj, res) => {
update_font_list_cache.end(res);
populate_font_model();
});
}
} else {
if (http_status > 0 && http_status < 100) {
Expand Down Expand Up @@ -194,12 +201,14 @@ namespace FontManager.GoogleFonts {
DateTime created = new DateTime.from_unix_local((int64) ctime);
if (now.difference(created) > TimeSpan.DAY)
update_font_list_cache.begin((obj, res) => { update_font_list_cache.end(res); });
cache_checked = true;
return;
} catch (Error e) {
warning("Failed to query file information : %s : %s", cache, e.message);
}
}
update_font_list_cache.begin((obj, res) => { update_font_list_cache.end(res); });
cache_checked = true;
return;
}

Expand Down

0 comments on commit 2b9ed42

Please sign in to comment.