static void proxy_new_cb (GObject *source, GAsyncResult *result, gpointer user_data) { EmpathyWebcredentialsMonitor *self; TpWeakRef *wr = user_data; GError *error = NULL; self = tp_weak_ref_dup_object (wr); if (self == NULL) goto out; self->priv->proxy = g_dbus_proxy_new_for_bus_finish (result, &error); if (self->priv->proxy == NULL) { g_debug ("Failed to create webcredentials proxy: %s", error->message); g_error_free (error); goto out; } update_failures (self); g_signal_connect (self->priv->proxy, "g-properties-changed", G_CALLBACK (properties_changed_cb), self); out: tp_weak_ref_destroy (wr); g_clear_object (&self); }
static void properties_changed_cb (GDBusProxy *proxy, GVariant *changed_properties, GStrv invalidated_properties, EmpathyWebcredentialsMonitor *self) { if (g_variant_lookup_value (changed_properties, FAILURES_PROP, NULL) == NULL) return; update_failures (self); }
int update_aberrant_CF( rrd_t *rrd, rrd_value_t pdp_val, enum cf_en current_cf, unsigned long cdp_idx, unsigned long rra_idx, unsigned long ds_idx, unsigned short CDP_scratch_idx, rrd_value_t *seasonal_coef) { static hw_functions_t hw_multiplicative_functions = { hw_multiplicative_calculate_prediction, hw_multiplicative_calculate_intercept, hw_calculate_slope, hw_multiplicative_calculate_seasonality, hw_multiplicative_init_seasonality, hw_calculate_seasonal_deviation, hw_init_seasonal_deviation, 1.0 /* identity value */ }; static hw_functions_t hw_additive_functions = { hw_additive_calculate_prediction, hw_additive_calculate_intercept, hw_calculate_slope, hw_additive_calculate_seasonality, hw_additive_init_seasonality, hw_calculate_seasonal_deviation, hw_init_seasonal_deviation, 0.0 /* identity value */ }; rrd->cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val = pdp_val; switch (current_cf) { case CF_HWPREDICT: return update_hwpredict(rrd, cdp_idx, rra_idx, ds_idx, CDP_scratch_idx, &hw_additive_functions); case CF_MHWPREDICT: return update_hwpredict(rrd, cdp_idx, rra_idx, ds_idx, CDP_scratch_idx, &hw_multiplicative_functions); case CF_DEVPREDICT: return update_devpredict(rrd, cdp_idx, rra_idx, ds_idx, CDP_scratch_idx); case CF_SEASONAL: switch (cf_conv(rrd->rra_def[hw_dep_idx(rrd, rra_idx)].cf_nam)) { case CF_HWPREDICT: return update_seasonal(rrd, cdp_idx, rra_idx, ds_idx, CDP_scratch_idx, seasonal_coef, &hw_additive_functions); case CF_MHWPREDICT: return update_seasonal(rrd, cdp_idx, rra_idx, ds_idx, CDP_scratch_idx, seasonal_coef, &hw_multiplicative_functions); default: return -1; } case CF_DEVSEASONAL: switch (cf_conv(rrd->rra_def[hw_dep_idx(rrd, rra_idx)].cf_nam)) { case CF_HWPREDICT: return update_devseasonal(rrd, cdp_idx, rra_idx, ds_idx, CDP_scratch_idx, seasonal_coef, &hw_additive_functions); case CF_MHWPREDICT: return update_devseasonal(rrd, cdp_idx, rra_idx, ds_idx, CDP_scratch_idx, seasonal_coef, &hw_multiplicative_functions); default: return -1; } case CF_FAILURES: switch (cf_conv (rrd->rra_def[hw_dep_idx(rrd, hw_dep_idx(rrd, rra_idx))]. cf_nam)) { case CF_HWPREDICT: return update_failures(rrd, cdp_idx, rra_idx, ds_idx, CDP_scratch_idx, &hw_additive_functions); case CF_MHWPREDICT: return update_failures(rrd, cdp_idx, rra_idx, ds_idx, CDP_scratch_idx, &hw_multiplicative_functions); default: return -1; } case CF_AVERAGE: default: return 0; } return -1; }