2004-08-25 Dan Williams <dcbw@redhat.com>

* info-daemon/NetworkManagerInfo.[ch]
		- Remove "get_next_priority" function

	* info-daemon/NetworkManagerInfoDbus.[ch]
		- Convert "priority" functions to "timestamp"


git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@69 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
Dan Williams 2004-08-25 22:43:16 +00:00
parent 846b78966b
commit 8ce1a2efc9
3 changed files with 13 additions and 56 deletions

View file

@ -40,47 +40,6 @@
#include "NetworkManagerInfoPassphraseDialog.h"
/*
* nmi_get_next_priority
*
* Gets the next available worse priority
*
*/
int nmi_get_next_priority (NMIAppInfo *info)
{
GSList *dir_list = NULL;
GSList *element = NULL;
int worst_prio = 0;
g_return_val_if_fail (info != NULL, 999);
/* List all allowed access points that gconf knows about */
element = dir_list = gconf_client_all_dirs (info->gconf_client, NMI_GCONF_TRUSTED_NETWORKS_PATH, NULL);
if (!dir_list)
return (10);
while (element)
{
gchar key[100];
GConfValue *value;
g_snprintf (&key[0], 99, "%s/priority", (char *)(element->data));
if ((value = gconf_client_get (info->gconf_client, key, NULL)))
{
if (worst_prio < gconf_value_get_int (value))
worst_prio = gconf_value_get_int (value);
gconf_value_free (value);
}
g_free (element->data);
element = g_slist_next (element);
}
g_slist_free (dir_list);
return (worst_prio + 10);
}
/*
* nmi_gconf_notify_callback
*

View file

@ -49,6 +49,4 @@ typedef struct NMIAppInfo NMIAppInfo;
#define NMI_GCONF_TRUSTED_NETWORKS_PATH "/system/networking/wireless/trusted_networks"
#define NMI_GCONF_PREFERRED_NETWORKS_PATH "/system/networking/wireless/preferred_networks"
int nmi_get_next_priority (NMIAppInfo *info);
#endif

View file

@ -280,13 +280,13 @@ static DBusMessage *nmi_dbus_get_networks (NMIAppInfo *info, DBusMessage *messag
/*
* nmi_dbus_get_network_prio
* nmi_dbus_get_network_timestamp
*
* If the specified network exists, get its priority from gconf
* If the specified network exists, get its timestamp from gconf
* and pass it back as a dbus message.
*
*/
static DBusMessage *nmi_dbus_get_network_prio (NMIAppInfo *info, DBusMessage *message)
static DBusMessage *nmi_dbus_get_network_timestamp (NMIAppInfo *info, DBusMessage *message)
{
DBusMessage *reply_message = NULL;
gchar *key = NULL;
@ -305,7 +305,7 @@ static DBusMessage *nmi_dbus_get_network_prio (NMIAppInfo *info, DBusMessage *me
|| (strlen (network) <= 0))
{
reply_message = nmi_dbus_create_error_message (message, NMI_DBUS_INTERFACE, "InvalidArguments",
"NetworkManagerInfo::get*NetworkPriority called with invalid arguments.");
"NetworkManagerInfo::getNetworkTimestamp called with invalid arguments.");
return (reply_message);
}
@ -316,21 +316,21 @@ static DBusMessage *nmi_dbus_get_network_prio (NMIAppInfo *info, DBusMessage *me
default: return (NULL);
}
/* Grab priority key for our access point from GConf */
key = g_strdup_printf ("%s/%s/priority", path, network);
/* Grab timestamp key for our access point from GConf */
key = g_strdup_printf ("%s/%s/timestamp", path, network);
value = gconf_client_get (info->gconf_client, key, NULL);
g_free (key);
if (value)
{
reply_message = dbus_message_new_method_return (message);
dbus_message_append_args (reply_message, DBUS_TYPE_UINT32, gconf_value_get_int (value), DBUS_TYPE_INVALID);
dbus_message_append_args (reply_message, DBUS_TYPE_INT32, gconf_value_get_int (value), DBUS_TYPE_INVALID);
gconf_value_free (value);
}
else
{
reply_message = nmi_dbus_create_error_message (message, NMI_DBUS_INTERFACE, "BadNetworkData",
"NetworkManagerInfo::get*NetworkPriority could not access data for network '%s'", network);
"NetworkManagerInfo::getNetworkTimestamp could not access data for network '%s'", network);
}
dbus_free (network);
@ -364,7 +364,7 @@ static DBusMessage *nmi_dbus_get_network_essid (NMIAppInfo *info, DBusMessage *m
|| (strlen (network) <= 0))
{
reply_message = nmi_dbus_create_error_message (message, NMI_DBUS_INTERFACE, "InvalidArguments",
"NetworkManagerInfo::get*NetworkEssid called with invalid arguments.");
"NetworkManagerInfo::getNetworkEssid called with invalid arguments.");
return (reply_message);
}
@ -389,7 +389,7 @@ static DBusMessage *nmi_dbus_get_network_essid (NMIAppInfo *info, DBusMessage *m
else
{
reply_message = nmi_dbus_create_error_message (message, NMI_DBUS_INTERFACE, "BadNetworkData",
"NetworkManagerInfo::get*NetworkEssid could not access data for network '%s'", network);
"NetworkManagerInfo::getNetworkEssid could not access data for network '%s'", network);
}
dbus_free (network);
@ -423,7 +423,7 @@ static DBusMessage *nmi_dbus_get_network_key (NMIAppInfo *info, DBusMessage *mes
|| (strlen (network) <= 0))
{
reply_message = nmi_dbus_create_error_message (message, NMI_DBUS_INTERFACE, "InvalidArguments",
"NetworkManagerInfo::get*NetworkKey called with invalid arguments.");
"NetworkManagerInfo::getNetworkKey called with invalid arguments.");
return (reply_message);
}
@ -487,8 +487,8 @@ static DBusHandlerResult nmi_dbus_nmi_message_handler (DBusConnection *connectio
}
else if (strcmp ("getNetworks", method) == 0)
reply_message = nmi_dbus_get_networks (info, message);
else if (strcmp ("getNetworkPriority", method) == 0)
reply_message = nmi_dbus_get_network_prio (info, message);
else if (strcmp ("getNetworkTimestamp", method) == 0)
reply_message = nmi_dbus_get_network_timestamp (info, message);
else if (strcmp ("getNetworkEssid", method) == 0)
reply_message = nmi_dbus_get_network_essid (info, message);
else if (strcmp ("getNetworkKey", method) == 0)