From 7f21476233a2cd6491a650ff7b012a91f1bb2ed4 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Tue, 27 Nov 2007 17:18:41 +0000 Subject: [PATCH] 2007-11-27 Dan Williams * src/nm-dbus-manager.h src/nm-hal-manager.c - Include the correct headers now that NetworkManagerDbusUtils.h doesn't do it for them * src/Makefile.am src/NetworkManagerDbusUtils.c src/NetworkManagerDbusUtils.h - Remove these two source files; they are unused git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3111 4912f4e0-d625-0410-9fb7-b9a5a253dbdc --- ChangeLog | 12 +++ src/Makefile.am | 2 - src/NetworkManagerDbusUtils.c | 180 ---------------------------------- src/NetworkManagerDbusUtils.h | 68 ------------- src/nm-dbus-manager.h | 2 +- src/nm-hal-manager.c | 3 + 6 files changed, 16 insertions(+), 251 deletions(-) delete mode 100644 src/NetworkManagerDbusUtils.c delete mode 100644 src/NetworkManagerDbusUtils.h diff --git a/ChangeLog b/ChangeLog index b4a9a7a86b..f60fbaa6cd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2007-11-27 Dan Williams + + * src/nm-dbus-manager.h + src/nm-hal-manager.c + - Include the correct headers now that NetworkManagerDbusUtils.h doesn't + do it for them + + * src/Makefile.am + src/NetworkManagerDbusUtils.c + src/NetworkManagerDbusUtils.h + - Remove these two source files; they are unused + 2007-11-27 Dan Williams * src/vpn-manager/nm-vpn-manager.c diff --git a/src/Makefile.am b/src/Makefile.am index 675cde2d86..f8c30de2ed 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -32,8 +32,6 @@ NetworkManager_SOURCES = \ nm-device-802-11-wireless.h \ NetworkManagerAP.c \ NetworkManagerAP.h \ - NetworkManagerDbusUtils.c \ - NetworkManagerDbusUtils.h \ NetworkManagerDialup.h \ nm-dbus-manager.h \ nm-dbus-manager.c \ diff --git a/src/NetworkManagerDbusUtils.c b/src/NetworkManagerDbusUtils.c deleted file mode 100644 index a705a293d6..0000000000 --- a/src/NetworkManagerDbusUtils.c +++ /dev/null @@ -1,180 +0,0 @@ -/* NetworkManager -- Network link manager - * - * Dan Williams - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * (C) Copyright 2005 Red Hat, Inc. - */ - -#include -#include -#include "NetworkManagerDbusUtils.h" - - -struct NMDbusMethodList -{ - guint32 refcount; - GHashTable * methods; - - char * path; - gboolean is_fallback; - - DBusObjectPathMessageFunction handler_func; - gpointer user_data; - DBusFreeFunction user_data_free_func; -}; - - -/** - * @param path DBus object path for which the handler applies - * @param is_fallback whether the handlers should be registered as a fallback - */ -NMDbusMethodList * -nm_dbus_method_list_new (const char *path, - gboolean is_fallback, - gpointer user_data, - DBusFreeFunction user_data_free_func) -{ - NMDbusMethodList * list; - - g_return_val_if_fail (path != NULL, NULL); - - list = g_slice_new0 (NMDbusMethodList); - - list->refcount = 1; - list->path = g_strdup (path); - list->is_fallback = is_fallback; - list->user_data = user_data; - list->user_data_free_func = user_data_free_func; - list->methods = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); - - return list; -} - -void -nm_dbus_method_list_ref (NMDbusMethodList *list) -{ - g_return_if_fail (list != NULL); - - list->refcount += 1; -} - -void -nm_dbus_method_list_unref (NMDbusMethodList *list) -{ - g_return_if_fail (list != NULL); - g_return_if_fail (list->refcount >= 1); - - list->refcount -= 1; - if (list->refcount <= 0) { - if (list->user_data && list->user_data_free_func) - (*list->user_data_free_func)(list->user_data); - g_hash_table_destroy (list->methods); - memset (list, 0, sizeof (NMDbusMethodList)); - g_slice_free (NMDbusMethodList, list); - } -} - -DBusObjectPathMessageFunction -nm_dbus_method_list_get_custom_handler_func (NMDbusMethodList *list) -{ - g_return_val_if_fail (list != NULL, NULL); - - return list->handler_func; -} - -gpointer -nm_dbus_method_list_get_user_data (NMDbusMethodList *list) -{ - g_return_val_if_fail (list != NULL, NULL); - - return list->user_data; -} - -/** - * @param handler_func NULL, or handler function which overrides the default one - */ -void -nm_dbus_method_list_set_custom_handler_func (NMDbusMethodList *list, - DBusObjectPathMessageFunction handler_func) -{ - g_return_if_fail (list != NULL); - g_return_if_fail (handler_func != NULL); - g_return_if_fail (list->handler_func == NULL); - - list->handler_func = handler_func; -} - -void -nm_dbus_method_list_add_method (NMDbusMethodList *list, - const char *method, - NMDBusHandleMessageFunc callback) -{ - g_return_if_fail (list != NULL); - g_return_if_fail (list->methods != NULL); - g_return_if_fail (method != NULL); - g_return_if_fail (callback != NULL); - - g_hash_table_insert (list->methods, g_strdup (method), callback); -} - - -gboolean -nm_dbus_method_list_dispatch (NMDbusMethodList *list, - DBusConnection *connection, - DBusMessage *message, - gpointer user_data, - DBusMessage **reply) -{ - NMDBusHandleMessageFunc callback = NULL; - const char * method; - - g_return_val_if_fail (list != NULL, FALSE); - g_return_val_if_fail (list->methods != NULL, FALSE); - g_return_val_if_fail (connection != NULL, FALSE); - g_return_val_if_fail (message != NULL, FALSE); - - if (reply) - *reply = NULL; - - if (!(method = dbus_message_get_member (message))) - return FALSE; - - if (!(callback = g_hash_table_lookup (list->methods, method))) - return FALSE; - - /* Dispatch the method call */ - *reply = (*callback) (connection, message, user_data); - - return TRUE; -} - -gboolean -nm_dbus_method_list_get_is_fallback (NMDbusMethodList *list) -{ - g_return_val_if_fail (list != NULL, FALSE); - - return list->is_fallback; -} - -const char * -nm_dbus_method_list_get_path (NMDbusMethodList *list) -{ - g_return_val_if_fail (list != NULL, NULL); - - return list->path; -} - diff --git a/src/NetworkManagerDbusUtils.h b/src/NetworkManagerDbusUtils.h deleted file mode 100644 index 53b5bd0c4b..0000000000 --- a/src/NetworkManagerDbusUtils.h +++ /dev/null @@ -1,68 +0,0 @@ -/* NetworkManager -- Network link manager - * - * Dan Williams - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * (C) Copyright 2005 Red Hat, Inc. - */ - -#ifndef NETWORK_MANAGER_DBUS_UTILS_H -#define NETWORK_MANAGER_DBUS_UTILS_H - -#include -#include -#include -#include - -typedef struct NMDbusMethodList NMDbusMethodList; - - -typedef DBusMessage * (* NMDBusHandleMessageFunc) (DBusConnection * connection, - DBusMessage * message, - gpointer user_data); - - -NMDbusMethodList * nm_dbus_method_list_new (const char *path, - gboolean is_fallback, - gpointer user_data, - DBusFreeFunction user_data_free_func); - -void nm_dbus_method_list_ref (NMDbusMethodList *list); - -void nm_dbus_method_list_unref (NMDbusMethodList *list); - -DBusObjectPathMessageFunction nm_dbus_method_list_get_custom_handler_func (NMDbusMethodList *list); - -gpointer nm_dbus_method_list_get_user_data (NMDbusMethodList *list); - -void nm_dbus_method_list_set_custom_handler_func (NMDbusMethodList *list, - DBusObjectPathMessageFunction handler_func); - -void nm_dbus_method_list_add_method (NMDbusMethodList *list, - const char *method, - NMDBusHandleMessageFunc callback); - -gboolean nm_dbus_method_list_dispatch (NMDbusMethodList *list, - DBusConnection *connection, - DBusMessage *message, - gpointer user_data, - DBusMessage **reply); - -gboolean nm_dbus_method_list_get_is_fallback (NMDbusMethodList *list); - -const char * nm_dbus_method_list_get_path (NMDbusMethodList *list); - -#endif diff --git a/src/nm-dbus-manager.h b/src/nm-dbus-manager.h index c190e4b33f..9852af73a3 100644 --- a/src/nm-dbus-manager.h +++ b/src/nm-dbus-manager.h @@ -23,9 +23,9 @@ #define __NM_DBUS_MANAGER_H__ #include "config.h" -#include "NetworkManagerDbusUtils.h" #include #include +#include G_BEGIN_DECLS diff --git a/src/nm-hal-manager.c b/src/nm-hal-manager.c index d1aedf16f1..3f63c62f1a 100644 --- a/src/nm-hal-manager.c +++ b/src/nm-hal-manager.c @@ -4,6 +4,9 @@ #include #include #include +#include +#include + #include "nm-hal-manager.h" #include "nm-dbus-manager.h" #include "nm-utils.h"