mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-28 15:40:10 +01:00
2005-08-30 Dan Williams <dcbw@redhat.com>
* gnome/applet/applet-dbus.[ch] - Remove all the nmwa_dbus_call_method_xxxx functions since they weren't being used anyway git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@911 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
parent
41885daa5b
commit
9871d317d9
3 changed files with 6 additions and 303 deletions
|
|
@ -1,3 +1,9 @@
|
|||
2005-08-30 Dan Williams <dcbw@redhat.com>
|
||||
|
||||
* gnome/applet/applet-dbus.[ch]
|
||||
- Remove all the nmwa_dbus_call_method_xxxx functions since
|
||||
they weren't being used anyway
|
||||
|
||||
2005-08-30 Bastien Nocera <hadess@hadess.net>
|
||||
|
||||
* test/nmtestdevices.c: (print_usage), (main):
|
||||
|
|
|
|||
|
|
@ -97,302 +97,6 @@ static int deal_with_dbus_error (const char *function, const char *method, DBusE
|
|||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* nmwa_dbus_call_method_string
|
||||
*
|
||||
* Do a method call on NetworkManager that returns a string.
|
||||
*
|
||||
* Returns: RETURN_SUCCESS on success
|
||||
* RETURN_FAILURE on failure
|
||||
* RETURN_NO_NM if NetworkManager service no longer exists
|
||||
*/
|
||||
int nmwa_dbus_call_method_string (DBusConnection *con, const char *path, const char *interface, const char *method, gboolean is_obj_path, char **string)
|
||||
{
|
||||
DBusMessage * message;
|
||||
DBusMessage * reply;
|
||||
DBusError error;
|
||||
char * dbus_string = NULL;
|
||||
|
||||
g_return_val_if_fail (con != NULL, RETURN_FAILURE);
|
||||
g_return_val_if_fail (path != NULL, RETURN_FAILURE);
|
||||
g_return_val_if_fail (method != NULL, RETURN_FAILURE);
|
||||
g_return_val_if_fail (string != NULL, RETURN_FAILURE);
|
||||
g_return_val_if_fail (*string == NULL, RETURN_FAILURE);
|
||||
|
||||
if (!(message = dbus_message_new_method_call (NM_DBUS_SERVICE, path, interface, method)))
|
||||
{
|
||||
nm_warning ("nmwa_dbus_call_method_string(): Couldn't allocate the dbus message\n");
|
||||
return (RETURN_FAILURE);
|
||||
}
|
||||
|
||||
dbus_error_init (&error);
|
||||
reply = dbus_connection_send_with_reply_and_block (con, message, -1, &error);
|
||||
dbus_message_unref (message);
|
||||
if (dbus_error_is_set (&error))
|
||||
{
|
||||
int ret = deal_with_dbus_error (__FUNCTION__, method, &error);
|
||||
dbus_error_free (&error);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
if (reply == NULL)
|
||||
{
|
||||
nm_warning ("nmwa_dbus_call_method_string(): dbus reply message was NULL\n" );
|
||||
return (RETURN_FAILURE);
|
||||
}
|
||||
|
||||
dbus_error_init (&error);
|
||||
dbus_message_get_args (reply, &error, is_obj_path ? DBUS_TYPE_OBJECT_PATH : DBUS_TYPE_STRING, &dbus_string, DBUS_TYPE_INVALID);
|
||||
if (dbus_error_is_set (&error))
|
||||
{
|
||||
nm_warning ("nmwa_dbus_call_method_string(): error while getting args: name='%s' message='%s'\n", error.name, error.message);
|
||||
if (dbus_error_is_set (&error))
|
||||
dbus_error_free (&error);
|
||||
dbus_message_unref (reply);
|
||||
return (RETURN_FAILURE);
|
||||
}
|
||||
|
||||
*string = g_strdup (dbus_string);
|
||||
|
||||
dbus_message_unref (reply);
|
||||
return (RETURN_SUCCESS);
|
||||
}
|
||||
|
||||
/*
|
||||
* nmwa_dbus_call_method_uint32
|
||||
*
|
||||
* Do a method call on NetworkManager that returns a DBUS_TYPE_UINT32.
|
||||
*
|
||||
* Returns: RETURN_SUCCESS on success
|
||||
* RETURN_FAILURE on failure
|
||||
* RETURN_NO_NM if NetworkManager service no longer exists
|
||||
*/
|
||||
int nmwa_dbus_call_method_uint32 (DBusConnection *con, const char *path, const char *interface, const char *method, guint32 *num)
|
||||
{
|
||||
DBusMessage * message;
|
||||
DBusMessage * reply;
|
||||
DBusError error;
|
||||
|
||||
g_return_val_if_fail (con != NULL, RETURN_FAILURE);
|
||||
g_return_val_if_fail (path != NULL, RETURN_FAILURE);
|
||||
g_return_val_if_fail (method != NULL, RETURN_FAILURE);
|
||||
g_return_val_if_fail (num != NULL, RETURN_FAILURE);
|
||||
|
||||
if (!(message = dbus_message_new_method_call (NM_DBUS_SERVICE, path, interface, method)))
|
||||
{
|
||||
nm_warning ("nmwa_dbus_call_method_uint32(): Couldn't allocate the dbus message\n");
|
||||
return (RETURN_FAILURE);
|
||||
}
|
||||
|
||||
dbus_error_init (&error);
|
||||
reply = dbus_connection_send_with_reply_and_block (con, message, -1, &error);
|
||||
dbus_message_unref (message);
|
||||
if (dbus_error_is_set (&error))
|
||||
{
|
||||
int ret = deal_with_dbus_error (__FUNCTION__, method, &error);
|
||||
dbus_error_free (&error);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
if (reply == NULL)
|
||||
{
|
||||
nm_warning ("nmwa_dbus_call_method_uint32(): dbus reply message was NULL\n" );
|
||||
return (RETURN_FAILURE);
|
||||
}
|
||||
|
||||
dbus_error_init (&error);
|
||||
dbus_message_get_args (reply, &error, DBUS_TYPE_UINT32, num, DBUS_TYPE_INVALID);
|
||||
dbus_message_unref (reply);
|
||||
if (dbus_error_is_set (&error))
|
||||
{
|
||||
nm_warning ("nnmwa_dbus_call_method_uint32(): error while getting args: name='%s' message='%s'\n", error.name, error.message);
|
||||
if (dbus_error_is_set (&error))
|
||||
dbus_error_free (&error);
|
||||
return (RETURN_FAILURE);
|
||||
}
|
||||
|
||||
return (RETURN_SUCCESS);
|
||||
}
|
||||
|
||||
/*
|
||||
* nmwa_dbus_call_method_int32
|
||||
*
|
||||
* Do a method call on NetworkManager that returns a DBUS_TYPE_INT32.
|
||||
*
|
||||
* Returns: RETURN_SUCCESS on success
|
||||
* RETURN_FAILURE on failure
|
||||
* RETURN_NO_NM if NetworkManager service no longer exists
|
||||
*/
|
||||
int nmwa_dbus_call_method_int32 (DBusConnection *con, const char *path, const char *interface, const char *method, gint32 *num)
|
||||
{
|
||||
DBusMessage * message;
|
||||
DBusMessage * reply;
|
||||
DBusError error;
|
||||
|
||||
g_return_val_if_fail (con != NULL, RETURN_FAILURE);
|
||||
g_return_val_if_fail (path != NULL, RETURN_FAILURE);
|
||||
g_return_val_if_fail (method != NULL, RETURN_FAILURE);
|
||||
g_return_val_if_fail (num != NULL, RETURN_FAILURE);
|
||||
|
||||
if (!(message = dbus_message_new_method_call (NM_DBUS_SERVICE, path, interface, method)))
|
||||
{
|
||||
nm_warning ("nmwa_dbus_call_method_int32(): Couldn't allocate the dbus message\n");
|
||||
return (RETURN_FAILURE);
|
||||
}
|
||||
|
||||
dbus_error_init (&error);
|
||||
reply = dbus_connection_send_with_reply_and_block (con, message, -1, &error);
|
||||
dbus_message_unref (message);
|
||||
if (dbus_error_is_set (&error))
|
||||
{
|
||||
int ret = deal_with_dbus_error (__FUNCTION__, method, &error);
|
||||
dbus_error_free (&error);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
if (reply == NULL)
|
||||
{
|
||||
nm_warning ("nmwa_dbus_call_method_int32(): dbus reply message was NULL\n" );
|
||||
return (RETURN_FAILURE);
|
||||
}
|
||||
|
||||
dbus_error_init (&error);
|
||||
dbus_message_get_args (reply, &error, DBUS_TYPE_INT32, num, DBUS_TYPE_INVALID);
|
||||
dbus_message_unref (reply);
|
||||
if (dbus_error_is_set (&error))
|
||||
{
|
||||
nm_warning ("nnmwa_dbus_call_method_int32(): error while getting args: name='%s' message='%s'\n", error.name, error.message);
|
||||
if (dbus_error_is_set (&error))
|
||||
dbus_error_free (&error);
|
||||
return (RETURN_FAILURE);
|
||||
}
|
||||
|
||||
return (RETURN_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* nmwa_dbus_call_method_boolean
|
||||
*
|
||||
* Do a method call on NetworkManager that returns a DBUS_TYPE_BOOLEAN.
|
||||
*
|
||||
* Returns: RETURN_SUCCESS on success
|
||||
* RETURN_FAILURE on failure
|
||||
* RETURN_NO_NM if NetworkManager service no longer exists
|
||||
*/
|
||||
int nmwa_dbus_call_method_boolean (DBusConnection *con, const char *path, const char *interface, const char *method, gboolean *num)
|
||||
{
|
||||
DBusMessage * message;
|
||||
DBusMessage * reply;
|
||||
DBusError error;
|
||||
|
||||
g_return_val_if_fail (con != NULL, RETURN_FAILURE);
|
||||
g_return_val_if_fail (path != NULL, RETURN_FAILURE);
|
||||
g_return_val_if_fail (method != NULL, RETURN_FAILURE);
|
||||
g_return_val_if_fail (num != NULL, RETURN_FAILURE);
|
||||
|
||||
if (!(message = dbus_message_new_method_call (NM_DBUS_SERVICE, path, interface, method)))
|
||||
{
|
||||
nm_warning ("nmwa_dbus_call_method_boolean(): Couldn't allocate the dbus message\n");
|
||||
return (RETURN_FAILURE);
|
||||
}
|
||||
|
||||
dbus_error_init (&error);
|
||||
reply = dbus_connection_send_with_reply_and_block (con, message, -1, &error);
|
||||
dbus_message_unref (message);
|
||||
if (dbus_error_is_set (&error))
|
||||
{
|
||||
int ret = deal_with_dbus_error (__FUNCTION__, method, &error);
|
||||
dbus_error_free (&error);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
if (reply == NULL)
|
||||
{
|
||||
nm_warning ("nmwa_dbus_call_method_boolean(): dbus reply message was NULL\n" );
|
||||
return (RETURN_FAILURE);
|
||||
}
|
||||
|
||||
dbus_error_init (&error);
|
||||
dbus_message_get_args (reply, &error, DBUS_TYPE_BOOLEAN, num, DBUS_TYPE_INVALID);
|
||||
dbus_message_unref (reply);
|
||||
if (dbus_error_is_set (&error))
|
||||
{
|
||||
nm_warning ("nnmwa_dbus_call_method_boolean(): error while getting args: name='%s' message='%s'\n", error.name, error.message);
|
||||
if (dbus_error_is_set (&error))
|
||||
dbus_error_free (&error);
|
||||
return (RETURN_FAILURE);
|
||||
}
|
||||
|
||||
return (RETURN_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* nmwa_dbus_call_method_string_array
|
||||
*
|
||||
* Do a method call on NetworkManager that returns a string array.
|
||||
*
|
||||
* Returns: RETURN_SUCCESS on success
|
||||
* RETURN_FAILURE on failure
|
||||
* RETURN_NO_NM if NetworkManager service no longer exists
|
||||
*/
|
||||
int nmwa_dbus_call_method_string_array (DBusConnection *con, const char *path, const char *interface, const char *method,
|
||||
gboolean is_obj_path, char ***array, guint32 *array_len)
|
||||
{
|
||||
DBusMessage * message;
|
||||
DBusMessage * reply;
|
||||
DBusError error;
|
||||
char ** dbus_array;
|
||||
int dbus_array_len;
|
||||
|
||||
g_return_val_if_fail (con != NULL, RETURN_FAILURE);
|
||||
g_return_val_if_fail (path != NULL, RETURN_FAILURE);
|
||||
g_return_val_if_fail (method != NULL, RETURN_FAILURE);
|
||||
g_return_val_if_fail (array != NULL, RETURN_FAILURE);
|
||||
g_return_val_if_fail (*array == NULL, RETURN_FAILURE);
|
||||
g_return_val_if_fail (array_len != NULL, RETURN_FAILURE);
|
||||
|
||||
if (!(message = dbus_message_new_method_call (NM_DBUS_SERVICE, path, interface, method)))
|
||||
{
|
||||
nm_warning ("nmwa_dbus_call_method_string_array(): Couldn't allocate the dbus message\n");
|
||||
return (RETURN_FAILURE);
|
||||
}
|
||||
|
||||
dbus_error_init (&error);
|
||||
reply = dbus_connection_send_with_reply_and_block (con, message, -1, &error);
|
||||
dbus_message_unref (message);
|
||||
if (dbus_error_is_set (&error))
|
||||
{
|
||||
int ret = deal_with_dbus_error (__FUNCTION__, method, &error);
|
||||
dbus_error_free (&error);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
if (reply == NULL)
|
||||
{
|
||||
nm_warning ("nmwa_dbus_call_method_string_array(): dbus reply message was NULL\n" );
|
||||
return (RETURN_FAILURE);
|
||||
}
|
||||
|
||||
dbus_error_init (&error);
|
||||
dbus_message_get_args (reply, &error, DBUS_TYPE_ARRAY, is_obj_path ? DBUS_TYPE_OBJECT_PATH : DBUS_TYPE_STRING, &dbus_array, &dbus_array_len, DBUS_TYPE_INVALID);
|
||||
if (dbus_error_is_set (&error))
|
||||
{
|
||||
nm_warning ("nnmwa_dbus_call_method_string_array(): error while getting args: name='%s' message='%s'\n", error.name, error.message);
|
||||
dbus_message_unref (reply);
|
||||
if (dbus_error_is_set (&error))
|
||||
dbus_error_free (&error);
|
||||
return (RETURN_FAILURE);
|
||||
}
|
||||
|
||||
*array = g_strdupv (dbus_array);
|
||||
*array_len = dbus_array_len;
|
||||
dbus_free_string_array (dbus_array);
|
||||
|
||||
dbus_message_unref (reply);
|
||||
return (RETURN_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -42,13 +42,6 @@ static inline gboolean message_is_error (DBusMessage *msg)
|
|||
return (dbus_message_get_type (msg) == DBUS_MESSAGE_TYPE_ERROR);
|
||||
}
|
||||
|
||||
int nmwa_dbus_call_method_string (DBusConnection *con, const char *path, const char *interface, const char *method, gboolean is_obj_path, char **string);
|
||||
int nmwa_dbus_call_method_uint32 (DBusConnection *con, const char *path, const char *interface, const char *method, guint32 *num);
|
||||
int nmwa_dbus_call_method_int32 (DBusConnection *con, const char *path, const char *interface, const char *method, gint32 *num);
|
||||
int nmwa_dbus_call_method_boolean (DBusConnection *con, const char *path, const char *interface, const char *method, gboolean *num);
|
||||
int nmwa_dbus_call_method_string_array (DBusConnection *con, const char *path, const char *interface, const char *method,
|
||||
gboolean is_obj_path, char ***array, guint32 *array_len);
|
||||
|
||||
DBusMessage * nmwa_dbus_create_error_message (DBusMessage *message, const char *exception_namespace, const char *exception, const char *format, ...);
|
||||
|
||||
void nmwa_dbus_init_helper (NMWirelessApplet *applet);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue