Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/bz-application.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ struct _BzApplication
GtkStringList *txt_blocklists;
gboolean flathub_remote_initialized;
gboolean running;
gboolean had_cache_on_init;
guint periodic_timeout_source;
int n_entries_incoming;
int n_remotes_syncing;
Expand Down Expand Up @@ -1238,6 +1239,8 @@ init_fiber (GWeakRef *wr)
bz_weak_release),
NULL);

self->had_cache_on_init = g_list_model_get_n_items (G_LIST_MODEL (self->groups)) > 0;

flathub_cache_file = fiber_dup_cache_file ("flathub-cache", &flathub_cache, &local_error);
if (flathub_cache_file != NULL)
{
Expand Down Expand Up @@ -2178,7 +2181,7 @@ init_fiber_finally (DexFuture *future,
bz_track_weak (self),
bz_weak_release);

if (!bz_state_info_get_metered_connection (self->state))
if (!bz_state_info_get_metered_connection (self->state) || !self->had_cache_on_init)
{
g_autoptr (DexFuture) sync_future = NULL;

Expand Down
11 changes: 11 additions & 0 deletions src/bz-window.blp
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,17 @@ template $BzWindow: Adw.ApplicationWindow {
button-label: _("Refresh Manually");
button-clicked => $sync_cb(template);
}

Adw.Banner {
sensitive: bind $invert_boolean(template.state as <$BzStateInfo>.syncing as <bool>) as <bool>;
revealed: bind $logical_and(
$invert_boolean(template.state as <$BzStateInfo>.recently-synced as <bool>) as <bool>,
$logical_and(template.state as <$BzStateInfo>.metered_connection as <bool>, template.state as <$BzStateInfo>.have_connection as <bool>) as <bool>
) as <bool>;
title: _("Network connection is metered — automatic refreshes disabled");
button-label: _("Refresh Manually");
button-clicked => $sync_cb(template);
}
}

[bottom]
Expand Down
Loading