libnm/proxy: use int type for proxy.method property

The method field is set from (only) via a GObject property setter,
which sets a value of type int. As we afterwards validate that the
value is in a valid range, we should use a suitable type to hold
the value to begin with. Of course, in almost all cases is the
underlying type of the enum already int.
This commit is contained in:
Thomas Haller 2019-12-13 17:22:26 +01:00
parent 1cab6367b2
commit 358e743513

View file

@ -36,7 +36,7 @@ NM_GOBJECT_PROPERTIES_DEFINE_BASE (
typedef struct {
char *pac_url;
char *pac_script;
NMSettingProxyMethod method;
int method;
bool browser_only:1;
} NMSettingProxyPrivate;
@ -119,11 +119,8 @@ static gboolean
verify (NMSetting *setting, NMConnection *connection, GError **error)
{
NMSettingProxyPrivate *priv = NM_SETTING_PROXY_GET_PRIVATE (setting);
NMSettingProxyMethod method;
method = priv->method;
if (!NM_IN_SET (method,
if (!NM_IN_SET (priv->method,
NM_SETTING_PROXY_METHOD_NONE,
NM_SETTING_PROXY_METHOD_AUTO)) {
g_set_error (error,
@ -134,7 +131,7 @@ verify (NMSetting *setting, NMConnection *connection, GError **error)
return FALSE;
}
if (method != NM_SETTING_PROXY_METHOD_AUTO) {
if (priv->method != NM_SETTING_PROXY_METHOD_AUTO) {
if (priv->pac_url) {
g_set_error (error,
NM_CONNECTION_ERROR,