Mercurial > projects > package-update-indicator
view pui-types.c.in @ 31:9905d4ae351c
Fix continuos loop of update checks if the refresh cache interval is 0
If the interval for refreshing the cache is set to 0 each check for available
updates refreshes the cache and causes an "updates-changed" signal to be
emitted after a short delay which in turn triggers another check for updates.
The "updates-changed" signal does not actually mean that the number of
available updates has changed but rather that the package metadata cache has
been invalidated. Fix this by blocking the "updates-changed" signal handler
from when a periodic or irregular check is started until 4 seconds after it has
finished. This is necessary since the signal will be delivered with a delay
after a transaction has been completed.
In addition prevent checks for updates triggered by the "updates-changed"
signal from refreshing the cache even the interval is 0 since the emission of
the signal implies that the cache has just been refreshed.
author | Guido Berhoerster <guido+pui@berhoerster.name> |
---|---|
date | Thu, 29 Aug 2019 13:48:47 +0200 |
parents | adba37525ee5 |
children |
line wrap: on
line source
/*** BEGIN file-header ***/ #include "pui-types.h" /*** END file-header ***/ /*** BEGIN file-production ***/ /* enumerations from "@filename@" */ #include "@filename@" /*** END file-production ***/ /*** BEGIN value-header ***/ GType @enum_name@_get_type (void) { static volatile gsize g_define_type_id__volatile; GType g_@type@_type_id; if (g_once_init_enter(&g_define_type_id__volatile)) { static const G@Type@Value values[] = { /*** END value-header ***/ /*** BEGIN value-production ***/ { @VALUENAME@, "@VALUENAME@", "@valuenick@" }, /*** END value-production ***/ /*** BEGIN value-tail ***/ { 0 } }; g_@type@_type_id = g_@type@_register_static( g_intern_static_string("@EnumName@"), values); g_once_init_leave(&g_define_type_id__volatile, g_@type@_type_id); } return (g_define_type_id__volatile); } /*** END value-tail ***/ /*** BEGIN file-tail ***/ gchar * pui_types_enum_to_string(GType type, gint value) { GTypeClass *type_class; GEnumValue *enum_value; type_class = g_type_class_ref(type); g_return_val_if_fail(G_IS_ENUM_CLASS(type_class), NULL); enum_value = g_enum_get_value(G_ENUM_CLASS(type_class), value); if (enum_value == NULL) { return (g_strdup_printf("%d", value)); } return (g_strdup(enum_value->value_nick)); } /*** END file-tail ***/