proxy: reorder parts in nm-proxy-config.c and nm-pacrunner-manager.c

This commit is contained in:
Thomas Haller 2016-10-04 11:58:32 +02:00
parent 132234bb79
commit 107089327c
3 changed files with 21 additions and 35 deletions

View file

@ -297,8 +297,8 @@ typedef struct _NMDevicePrivate {
char * dhcp_anycast_address;
/* Proxy Configuration */
NMProxyConfig * proxy_config;
NMPacRunnerManager * pacrunner_manager;
NMProxyConfig *proxy_config;
NMPacRunnerManager *pacrunner_manager;
/* IP4 configuration info */
NMIP4Config * ip4_config; /* Combined config from VPN, settings, and device */

View file

@ -28,12 +28,12 @@
#include "nm-ip4-config.h"
#include "nm-ip6-config.h"
NM_DEFINE_SINGLETON_INSTANCE (NMPacRunnerManager);
#define PACRUNNER_DBUS_SERVICE "org.pacrunner"
#define PACRUNNER_DBUS_INTERFACE "org.pacrunner.Manager"
#define PACRUNNER_DBUS_PATH "/org/pacrunner/manager"
/*****************************************************************************/
struct remove_data {
char *iface;
char *path;
@ -59,18 +59,11 @@ struct _NMPacRunnerManagerClass {
G_DEFINE_TYPE (NMPacRunnerManager, nm_pac_runner_manager, G_TYPE_OBJECT)
#define NM_PACRUNNER_MANAGER_GET_PRIVATE(self) \
({ \
/* preserve the const-ness of self. Unfortunately, that
* way, @self cannot be a void pointer */ \
typeof (self) _self = (self); \
\
/* Get compiler error if variable is of wrong type */ \
_nm_unused const NMPacRunnerManager *_self2 = (_self); \
\
nm_assert (NM_IS_PACRUNNER_MANAGER (_self)); \
&_self->_priv; \
})
#define NM_PACRUNNER_MANAGER_GET_PRIVATE(self) _NM_GET_PRIVATE (self, NMPacRunnerManager, NM_IS_PACRUNNER_MANAGER)
/*****************************************************************************/
NM_DEFINE_SINGLETON_GETTER (NMPacRunnerManager, nm_pac_runner_manager_get, NM_TYPE_PACRUNNER_MANAGER);
/*****************************************************************************/
@ -432,7 +425,7 @@ nm_pac_runner_manager_remove (NMPacRunnerManager *self, const char *iface)
}
}
NM_DEFINE_SINGLETON_GETTER (NMPacRunnerManager, nm_pac_runner_manager_get, NM_TYPE_PACRUNNER_MANAGER);
/*****************************************************************************/
static void
nm_pac_runner_manager_init (NMPacRunnerManager *self)

View file

@ -26,6 +26,8 @@
#include "nm-core-internal.h"
/*****************************************************************************/
typedef struct {
NMProxyConfigMethod method;
gboolean browser_only;
@ -44,27 +46,10 @@ struct _NMProxyConfigClass {
G_DEFINE_TYPE (NMProxyConfig, nm_proxy_config, G_TYPE_OBJECT)
#define NM_PROXY_CONFIG_GET_PRIVATE(self) \
({ \
/* preserve the const-ness of self. Unfortunately, that
* way, @self cannot be a void pointer */ \
typeof (self) _self = (self); \
\
/* Get compiler error if variable is of wrong type */ \
_nm_unused const NMProxyConfig *_self2 = (_self); \
\
nm_assert (NM_IS_PROXY_CONFIG (_self)); \
&_self->_priv; \
})
#define NM_PROXY_CONFIG_GET_PRIVATE(self) _NM_GET_PRIVATE (self, NMProxyConfig, NM_IS_PROXY_CONFIG)
/*****************************************************************************/
NMProxyConfig *
nm_proxy_config_new (void)
{
return NM_PROXY_CONFIG (g_object_new (NM_TYPE_PROXY_CONFIG, NULL));
}
void
nm_proxy_config_set_method (NMProxyConfig *config, NMProxyConfigMethod method)
{
@ -165,6 +150,8 @@ nm_proxy_config_get_pac_script (const NMProxyConfig *config)
return priv->pac_script;
}
/*****************************************************************************/
static void
nm_proxy_config_init (NMProxyConfig *config)
{
@ -173,6 +160,12 @@ nm_proxy_config_init (NMProxyConfig *config)
priv->method = NM_PROXY_CONFIG_METHOD_NONE;
}
NMProxyConfig *
nm_proxy_config_new (void)
{
return NM_PROXY_CONFIG (g_object_new (NM_TYPE_PROXY_CONFIG, NULL));
}
static void
finalize (GObject *object)
{