libnm-glib: NMSettingsInterface::add_connection() should take an NMConnection
instead of an NMSettingsConnectionInterface, because we won't always have an object that implements NMSettingsConnectionInterface. Plus, since NMConnection is a prerequisite of NMSettingsConnectionInterface, the NMConnection will always be there anyway.
This commit is contained in:
@@ -226,7 +226,7 @@ add_connection_done (DBusGProxy *proxy,
|
|||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
add_connection (NMSettingsInterface *settings,
|
add_connection (NMSettingsInterface *settings,
|
||||||
NMSettingsConnectionInterface *connection,
|
NMConnection *connection,
|
||||||
NMSettingsAddConnectionFunc callback,
|
NMSettingsAddConnectionFunc callback,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
@@ -240,7 +240,7 @@ add_connection (NMSettingsInterface *settings,
|
|||||||
info->callback = callback;
|
info->callback = callback;
|
||||||
info->callback_data = user_data;
|
info->callback_data = user_data;
|
||||||
|
|
||||||
new_settings = nm_connection_to_hash (NM_CONNECTION (connection));
|
new_settings = nm_connection_to_hash (connection);
|
||||||
org_freedesktop_NetworkManagerSettings_add_connection_async (priv->proxy,
|
org_freedesktop_NetworkManagerSettings_add_connection_async (priv->proxy,
|
||||||
new_settings,
|
new_settings,
|
||||||
add_connection_done,
|
add_connection_done,
|
||||||
|
@@ -112,7 +112,7 @@ nm_settings_interface_get_connection_by_path (NMSettingsInterface *settings,
|
|||||||
/**
|
/**
|
||||||
* nm_settings_interface_add_connection:
|
* nm_settings_interface_add_connection:
|
||||||
* @settings: a object implementing %NMSettingsInterface
|
* @settings: a object implementing %NMSettingsInterface
|
||||||
* @connection: the settings to add; note that this objects settings will be
|
* @connection: the settings to add; note that this object's settings will be
|
||||||
* added, not the object itself
|
* added, not the object itself
|
||||||
* @callback: callback to be called when the add operation completes
|
* @callback: callback to be called when the add operation completes
|
||||||
* @user_data: caller-specific data passed to @callback
|
* @user_data: caller-specific data passed to @callback
|
||||||
@@ -123,14 +123,14 @@ nm_settings_interface_get_connection_by_path (NMSettingsInterface *settings,
|
|||||||
**/
|
**/
|
||||||
gboolean
|
gboolean
|
||||||
nm_settings_interface_add_connection (NMSettingsInterface *settings,
|
nm_settings_interface_add_connection (NMSettingsInterface *settings,
|
||||||
NMSettingsConnectionInterface *connection,
|
NMConnection *connection,
|
||||||
NMSettingsAddConnectionFunc callback,
|
NMSettingsAddConnectionFunc callback,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (settings != NULL, FALSE);
|
g_return_val_if_fail (settings != NULL, FALSE);
|
||||||
g_return_val_if_fail (NM_IS_SETTINGS_INTERFACE (settings), FALSE);
|
g_return_val_if_fail (NM_IS_SETTINGS_INTERFACE (settings), FALSE);
|
||||||
g_return_val_if_fail (connection != NULL, FALSE);
|
g_return_val_if_fail (connection != NULL, FALSE);
|
||||||
g_return_val_if_fail (NM_IS_SETTINGS_CONNECTION_INTERFACE (connection), FALSE);
|
g_return_val_if_fail (NM_IS_CONNECTION (connection), FALSE);
|
||||||
g_return_val_if_fail (callback != NULL, FALSE);
|
g_return_val_if_fail (callback != NULL, FALSE);
|
||||||
|
|
||||||
if (NM_SETTINGS_INTERFACE_GET_INTERFACE (settings)->add_connection) {
|
if (NM_SETTINGS_INTERFACE_GET_INTERFACE (settings)->add_connection) {
|
||||||
|
@@ -67,7 +67,7 @@ struct _NMSettingsInterface {
|
|||||||
const char *path);
|
const char *path);
|
||||||
|
|
||||||
gboolean (*add_connection) (NMSettingsInterface *settings,
|
gboolean (*add_connection) (NMSettingsInterface *settings,
|
||||||
NMSettingsConnectionInterface *connection,
|
NMConnection *connection,
|
||||||
NMSettingsAddConnectionFunc callback,
|
NMSettingsAddConnectionFunc callback,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
|
|
||||||
@@ -85,7 +85,7 @@ NMSettingsConnectionInterface *nm_settings_interface_get_connection_by_path (NMS
|
|||||||
const char *path);
|
const char *path);
|
||||||
|
|
||||||
gboolean nm_settings_interface_add_connection (NMSettingsInterface *settings,
|
gboolean nm_settings_interface_add_connection (NMSettingsInterface *settings,
|
||||||
NMSettingsConnectionInterface *connection,
|
NMConnection *connection,
|
||||||
NMSettingsAddConnectionFunc callback,
|
NMSettingsAddConnectionFunc callback,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
|
|
||||||
|
@@ -143,7 +143,7 @@ nm_settings_service_get_connection_by_path (NMSettingsService *self,
|
|||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
add_connection (NMSettingsInterface *settings,
|
add_connection (NMSettingsInterface *settings,
|
||||||
NMSettingsConnectionInterface *connection,
|
NMConnection *connection,
|
||||||
NMSettingsAddConnectionFunc callback,
|
NMSettingsAddConnectionFunc callback,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
@@ -202,7 +202,7 @@ impl_settings_add_connection (NMSettingsService *self,
|
|||||||
|
|
||||||
if (NM_SETTINGS_SERVICE_GET_CLASS (self)->add_connection) {
|
if (NM_SETTINGS_SERVICE_GET_CLASS (self)->add_connection) {
|
||||||
NM_SETTINGS_SERVICE_GET_CLASS (self)->add_connection (NM_SETTINGS_SERVICE (self),
|
NM_SETTINGS_SERVICE_GET_CLASS (self)->add_connection (NM_SETTINGS_SERVICE (self),
|
||||||
NM_SETTINGS_CONNECTION_INTERFACE (tmp),
|
tmp,
|
||||||
context,
|
context,
|
||||||
dbus_add_connection_cb,
|
dbus_add_connection_cb,
|
||||||
context);
|
context);
|
||||||
|
@@ -52,7 +52,7 @@ typedef struct {
|
|||||||
GSList * (*list_connections) (NMSettingsService *self);
|
GSList * (*list_connections) (NMSettingsService *self);
|
||||||
|
|
||||||
void (*add_connection) (NMSettingsService *self,
|
void (*add_connection) (NMSettingsService *self,
|
||||||
NMSettingsConnectionInterface *connection,
|
NMConnection *connection,
|
||||||
DBusGMethodInvocation *context, /* Only present for D-Bus calls */
|
DBusGMethodInvocation *context, /* Only present for D-Bus calls */
|
||||||
NMSettingsAddConnectionFunc callback,
|
NMSettingsAddConnectionFunc callback,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
|
@@ -643,7 +643,7 @@ out:
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
add_connection (NMSettingsService *service,
|
add_connection (NMSettingsService *service,
|
||||||
NMSettingsConnectionInterface *connection,
|
NMConnection *connection,
|
||||||
DBusGMethodInvocation *context, /* Only present for D-Bus calls */
|
DBusGMethodInvocation *context, /* Only present for D-Bus calls */
|
||||||
NMSettingsAddConnectionFunc callback,
|
NMSettingsAddConnectionFunc callback,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
@@ -663,7 +663,7 @@ add_connection (NMSettingsService *service,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
call = polkit_call_new (self, context, NM_CONNECTION (connection), callback, user_data, NULL);
|
call = polkit_call_new (self, context, connection, callback, user_data, NULL);
|
||||||
g_assert (call);
|
g_assert (call);
|
||||||
polkit_authority_check_authorization (priv->authority,
|
polkit_authority_check_authorization (priv->authority,
|
||||||
call->subject,
|
call->subject,
|
||||||
|
Reference in New Issue
Block a user