static void reload_proxy_settings (GsPlugin *plugin, GCancellable *cancellable) { GsPluginData *priv = gs_plugin_get_data (plugin); g_autofree gchar *proxy_http = NULL; g_autofree gchar *proxy_ftp = NULL; g_autoptr(GPermission) permission = NULL; /* only if we can achieve the action *without* an auth dialog */ permission = gs_utils_get_permission ("org.freedesktop.packagekit." "system-network-proxy-configure"); if (permission == NULL) { g_debug ("not setting proxy as no permission"); return; } if (!g_permission_get_allowed (permission)) { g_debug ("not setting proxy as no auth requested"); return; } proxy_http = get_proxy_http (plugin); proxy_ftp = get_proxy_ftp (plugin); g_debug ("Setting proxies (http: %s, ftp: %s)", proxy_http, proxy_ftp); pk_control_set_proxy_async (priv->control, proxy_http, proxy_ftp, cancellable, set_proxy_cb, plugin); }
gboolean gs_plugin_setup (GsPlugin *plugin, GCancellable *cancellable, GError **error) { GsPluginData *priv = gs_plugin_get_data (plugin); priv->monitor = pk_offline_get_prepared_monitor (cancellable, error); if (priv->monitor == NULL) { gs_utils_error_convert_gio (error); return FALSE; } g_signal_connect (priv->monitor, "changed", G_CALLBACK (gs_plugin_systemd_updates_changed_cb), plugin); /* check if we have permission to trigger the update */ priv->permission = gs_utils_get_permission ( "org.freedesktop.packagekit.trigger-offline-update"); if (priv->permission != NULL) { g_signal_connect (priv->permission, "notify", G_CALLBACK (gs_plugin_systemd_updates_permission_cb), plugin); } return TRUE; }