Remove applet; its in network-manager-applet SVN module now

git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2263 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
Dan Williams 2007-02-02 20:56:13 +00:00
parent 05ff9994f2
commit bf0b6ee410
155 changed files with 0 additions and 18106 deletions

View file

@ -1,3 +0,0 @@
Makefile
Makefile.in
nm-applet

View file

@ -1,136 +0,0 @@
SUBDIRS=icons
NULL=
INCLUDES = -I${top_srcdir} -I${top_srcdir}/utils -I${top_srcdir}/include -I${top_srcdir}/libnm-util
bin_PROGRAMS = nm-applet
nm_applet_CPPFLAGS = \
$(DBUS_CFLAGS) \
$(GTHREAD_CFLAGS) \
$(HAL_CFLAGS) \
$(DBUS_GLIB_CFLAGS) \
$(GLADE_CFLAGS) \
$(GTK_CFLAGS) \
$(GCONF_CFLAGS) \
$(LIBGNOMEUI_CFLAGS) \
$(GNOME_KEYRING_CFLAGS) \
-DICONDIR=\""$(datadir)/icons"\" \
-DGLADEDIR=\""$(gladedir)"\" \
-DBINDIR=\""$(bindir)"\" \
-DSYSCONFDIR=\""$(sysconfdir)"\" \
-DAUTOSTARTDIR=\""$(datadir)/gnome/autostart"\" \
-DVPN_NAME_FILES_DIR=\""$(sysconfdir)/NetworkManager/VPN"\" \
-DDBUS_API_SUBJECT_TO_CHANGE \
-DGNOMELOCALEDIR=\"$(datadir)/locale\" \
$(DISABLE_DEPRECATED) \
$(NULL)
if WITH_NOTIFY
nm_applet_CPPFLAGS += $(NOTIFY_CFLAGS)
endif
nm_applet_SOURCES = \
main.c \
applet.c \
applet.h \
applet-compat.c \
applet-compat.h \
applet-dbus.c \
applet-dbus.h \
applet-dbus-devices.c \
applet-dbus-devices.h \
applet-dbus-vpn.c \
applet-dbus-vpn.h \
applet-dbus-info.c \
applet-dbus-info.h \
wireless-network.c \
wireless-network.h \
nm-device.c \
nm-device.h \
other-network-dialog.c \
other-network-dialog.h \
passphrase-dialog.c \
passphrase-dialog.h \
menu-items.c \
menu-items.h \
vpn-password-dialog.c \
vpn-password-dialog.h \
vpn-connection.c \
vpn-connection.h \
wireless-security-manager.c \
wireless-security-manager.h \
wireless-security-option.c \
wireless-security-option.h \
wso-none.c \
wso-none.h \
wso-private.h \
wso-wep-ascii.c \
wso-wep-ascii.h \
wso-wep-hex.c \
wso-wep-hex.h \
wso-wep-passphrase.c \
wso-wep-passphrase.h \
wso-wpa-eap.c \
wso-wpa-eap.h \
wso-wpa-psk.c \
wso-wpa-psk.h \
wso-leap.c \
wso-leap.h \
nm-gconf-wso.c \
nm-gconf-wso.h \
nm-gconf-wso-private.h \
nm-gconf-wso-wep.c \
nm-gconf-wso-wep.h \
nm-gconf-wso-wpa-eap.c \
nm-gconf-wso-wpa-eap.h \
nm-gconf-wso-wpa-psk.c \
nm-gconf-wso-wpa-psk.h \
nm-gconf-wso-leap.c \
nm-gconf-wso-leap.h \
gconf-helpers.c \
gconf-helpers.h \
$(NULL)
#if !HAVE_GTK_2_10
nm_applet_SOURCES += \
eggtrayicon.c \
eggtrayicon.h
#endif
if WITH_NOTIFY
nm_applet_SOURCES += applet-notifications.c applet-notifications.h
endif
nm_applet_LDADD = \
$(DBUS_LIBS) \
$(HAL_LIBS) \
$(GTHREAD_LIBS) \
$(GLADE_LIBS) \
$(DBUS_GLIB_LIBS) \
$(GTK_LIBS) \
$(GCONF_LIBS) \
$(LIBGNOMEUI_LIBS) \
$(GNOME_KEYRING_LIBS) \
$(top_builddir)/utils/libnmutils.la \
$(top_builddir)/libnm-util/libnm-util.la \
$(NULL)
if WITH_NOTIFY
nm_applet_LDADD += $(NOTIFY_LIBS)
endif
gladedir = $(datadir)/nm-applet
glade_DATA = applet.glade keyring.png
dbusservicedir = $(DBUS_SYS_DIR)
dbusservice_DATA = nm-applet.conf
CLEANFILES = $(server_DATA) *.bak *.gladep
EXTRA_DIST = \
$(dbusservice_DATA) \
$(glade_DATA) \
$(NULL)

View file

@ -1,399 +0,0 @@
/* NetworkManager -- Network link manager
*
* Dan Williams <dcbw@redhat.com>
*
* 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 <glib.h>
#include <glib/gi18n.h>
#include <dbus/dbus.h>
#include <gconf/gconf-client.h>
#include <gnome-keyring.h>
#include <iwlib.h>
#include "applet.h"
#include "applet-compat.h"
#include "gconf-helpers.h"
#include "nm-utils.h"
#include "cipher.h"
#include "cipher-wep-hex.h"
#include "cipher-wep-ascii.h"
#include "cipher-wep-passphrase.h"
/*
* Authentication modes
*/
typedef enum NMDeviceAuthMethod
{
NM_DEVICE_AUTH_METHOD_UNKNOWN = 0,
NM_DEVICE_AUTH_METHOD_NONE,
NM_DEVICE_AUTH_METHOD_OPEN_SYSTEM,
NM_DEVICE_AUTH_METHOD_SHARED_KEY
} NMDeviceAuthMethod;
/*
* Encryption key types
*/
typedef enum NMEncKeyType
{
NM_ENC_TYPE_UNKNOWN = 0,
NM_ENC_TYPE_NONE,
NM_ENC_TYPE_HEX_KEY,
NM_ENC_TYPE_ASCII_KEY,
NM_ENC_TYPE_128_BIT_PASSPHRASE
/* FIXME: WPA and 802.1x support */
} NMEncKeyType;
#define WEP_PREFIX "wep_"
static void
unset_nm_gconf_key (GConfClient *client,
const char *escaped_network,
const char *key_name)
{
char * key;
g_return_if_fail (client != NULL);
g_return_if_fail (escaped_network != NULL);
g_return_if_fail (key_name != NULL);
key = g_strdup_printf ("%s/%s/%s",
GCONF_PATH_WIRELESS_NETWORKS,
escaped_network,
key_name);
gconf_client_unset (client, key, NULL);
g_free (key);
}
static void
set_entry_cipher (GConfClient *client,
const char *escaped_network,
int we_cipher)
{
char *key;
g_return_if_fail (client != NULL);
g_return_if_fail (escaped_network != NULL);
key = g_strdup_printf ("%s/%s/we_cipher", GCONF_PATH_WIRELESS_NETWORKS, escaped_network);
gconf_client_set_int (client, key, we_cipher, NULL);
g_free (key);
}
static void
convert_entry_auth_algorithm (GConfClient *client,
const char *escaped_network)
{
char * key;
int int_auth_method;
NMDeviceAuthMethod auth_method = NM_DEVICE_AUTH_METHOD_OPEN_SYSTEM;
int we_auth_alg = IW_AUTH_ALG_OPEN_SYSTEM;
g_return_if_fail (client != NULL);
g_return_if_fail (escaped_network != NULL);
if (nm_gconf_get_int_helper (client,
GCONF_PATH_WIRELESS_NETWORKS,
"auth_method",
escaped_network,
&int_auth_method))
auth_method = (NMDeviceAuthMethod) int_auth_method;
if (auth_method == NM_DEVICE_AUTH_METHOD_SHARED_KEY)
we_auth_alg = IW_AUTH_ALG_SHARED_KEY;
key = g_strdup_printf ("%s/%s/%sauth_algorithm",
GCONF_PATH_WIRELESS_NETWORKS,
escaped_network,
WEP_PREFIX);
gconf_client_set_int (client, key, we_auth_alg, NULL);
g_free (key);
/* Remove the old auth_method key */
unset_nm_gconf_key (client, escaped_network, "auth_method");
}
static char *
get_key_from_keyring (const char *essid, int *item_id)
{
GnomeKeyringResult ret;
GList * found_list = NULL;
GnomeKeyringFound * found;
char * key;
g_return_val_if_fail (essid != NULL, NULL);
ret = gnome_keyring_find_itemsv_sync (GNOME_KEYRING_ITEM_GENERIC_SECRET,
&found_list,
"essid",
GNOME_KEYRING_ATTRIBUTE_TYPE_STRING,
essid,
NULL);
if (ret != GNOME_KEYRING_RESULT_OK)
return NULL;
found = (GnomeKeyringFound *) found_list->data;
key = g_strdup (found->secret);
if (item_id)
*item_id = found->item_id;
gnome_keyring_found_list_free (found_list);
return key;
}
static void
set_key_in_keyring (const char *essid,
const char *key)
{
GnomeKeyringAttributeList * attributes;
GnomeKeyringAttribute attr;
GnomeKeyringResult ret;
const char * name;
guint32 item_id;
name = g_strdup_printf (_("Passphrase for wireless network %s"), essid);
attributes = gnome_keyring_attribute_list_new ();
attr.name = g_strdup ("essid");
attr.type = GNOME_KEYRING_ATTRIBUTE_TYPE_STRING;
attr.value.string = g_strdup (essid);
g_array_append_val (attributes, attr);
ret = gnome_keyring_item_create_sync (NULL,
GNOME_KEYRING_ITEM_GENERIC_SECRET,
name,
attributes,
key,
TRUE,
&item_id);
if (ret != GNOME_KEYRING_RESULT_OK)
{
nm_warning ("%s:%d (%s): Error converting encryption key for '%s'. Ret=%d",
__FILE__, __LINE__, __func__, essid, ret);
}
gnome_keyring_attribute_list_free (attributes);
}
static void
convert_no_encryption (GConfClient *client,
const char *escaped_network)
{
g_return_if_fail (client != NULL);
g_return_if_fail (escaped_network != NULL);
set_entry_cipher (client, escaped_network, IW_AUTH_CIPHER_NONE);
/* Remove the old auth_method key if it's present */
unset_nm_gconf_key (client, escaped_network, "auth_method");
}
static void
generic_convert_wep_entry (GConfClient *client,
const char *escaped_network,
const char *essid,
IEEE_802_11_Cipher *first_cipher,
IEEE_802_11_Cipher *second_cipher)
{
char * key;
int key_item_id = -1;
int real_we_cipher = IW_AUTH_CIPHER_WEP104;
IEEE_802_11_Cipher * real_cipher = NULL;
char * hashed_key = NULL;
g_return_if_fail (client != NULL);
g_return_if_fail (escaped_network != NULL);
g_return_if_fail (essid != NULL);
g_return_if_fail (first_cipher != NULL);
key = get_key_from_keyring (essid, &key_item_id);
/* Try to validate key with first cipher */
if (ieee_802_11_cipher_validate (first_cipher, essid, key) == 0)
{
if ((hashed_key = ieee_802_11_cipher_hash (first_cipher, essid, key)))
real_cipher = first_cipher;
}
if (second_cipher && !hashed_key)
{
/* Try second cipher then */
if (ieee_802_11_cipher_validate (second_cipher, essid, key) == 0)
if ((hashed_key = ieee_802_11_cipher_hash (second_cipher, essid, key)))
real_cipher = second_cipher;
}
if (real_cipher && hashed_key)
{
real_we_cipher = ieee_802_11_cipher_get_we_cipher (real_cipher);
/* Set the converted key in the keyring */
set_key_in_keyring (essid, hashed_key);
}
else
{
/* Couldn't convert the key, so remove it from
* the keyring and let the user enter it later.
*/
nm_warning ("%s:%d (%s): Could not convert old WEP key for network '%s'.",
__FILE__, __LINE__, __func__, essid);
gnome_keyring_item_delete_sync (NULL, key_item_id);
}
g_free (key);
/* Set new WE cipher */
set_entry_cipher (client, escaped_network, real_we_cipher);
/* Set the authentication algorithm */
convert_entry_auth_algorithm (client, escaped_network);
}
static void
convert_one_entry (GConfClient *client,
const char *essid)
{
int we_cipher;
GConfValue * addrs_value = NULL;
char * escaped_network;
char * key;
int int_key_type;
NMEncKeyType key_type = NM_ENC_TYPE_NONE;
IEEE_802_11_Cipher * first_cipher = NULL;
IEEE_802_11_Cipher * second_cipher = NULL;
g_return_if_fail (client != NULL);
g_return_if_fail (essid != NULL);
if (!(escaped_network = gconf_escape_key (essid, strlen (essid))) || strlen (escaped_network) < 0)
{
nm_warning ("%s:%d (%s): couldn't unescape network name '%s'.",
__FILE__, __LINE__, __func__, essid);
return;
}
/* Ignore any entry that looks like it doesn't need conversion */
if (nm_gconf_get_int_helper (client,
GCONF_PATH_WIRELESS_NETWORKS,
"we_cipher",
escaped_network,
&we_cipher))
goto out;
/* Grab the key type off this old entry so we know how to convert it */
if (nm_gconf_get_int_helper (client,
GCONF_PATH_WIRELESS_NETWORKS,
"key_type",
escaped_network,
&int_key_type))
{
key_type = (NMEncKeyType) int_key_type;
}
/* Convert the list of stored access point BSSIDs */
key = g_strdup_printf ("%s/%s/addresses", GCONF_PATH_WIRELESS_NETWORKS, escaped_network);
if ((addrs_value = gconf_client_get (client, key, NULL)))
{
if ((addrs_value->type == GCONF_VALUE_LIST) && (gconf_value_get_list_type (addrs_value) == GCONF_VALUE_STRING))
{
GSList * list;
char * conv_key;
list = gconf_client_get_list (client, key, GCONF_VALUE_STRING, NULL);
conv_key = g_strdup_printf ("%s/%s/bssids", GCONF_PATH_WIRELESS_NETWORKS, escaped_network);
gconf_client_set_list (client, conv_key, GCONF_VALUE_STRING, list, NULL);
g_free (conv_key);
g_slist_foreach (list, (GFunc) g_free, NULL);
g_slist_free (list);
}
gconf_value_free (addrs_value);
}
gconf_client_unset (client, key, NULL);
g_free (key);
/* Convert security information, if any */
switch (key_type)
{
case NM_ENC_TYPE_UNKNOWN:
case NM_ENC_TYPE_NONE:
convert_no_encryption (client, escaped_network);
break;
case NM_ENC_TYPE_HEX_KEY:
first_cipher = cipher_wep128_hex_new ();
second_cipher = cipher_wep64_hex_new ();
break;
case NM_ENC_TYPE_ASCII_KEY:
first_cipher = cipher_wep128_ascii_new ();
second_cipher = cipher_wep64_ascii_new ();
break;
case NM_ENC_TYPE_128_BIT_PASSPHRASE:
first_cipher = cipher_wep128_passphrase_new ();
second_cipher = cipher_wep64_passphrase_new ();
break;
default:
break;
}
if (first_cipher)
{
/* Do the actual key conversion */
generic_convert_wep_entry (client, escaped_network, essid, first_cipher, second_cipher);
ieee_802_11_cipher_unref (first_cipher);
if (second_cipher)
ieee_802_11_cipher_unref (second_cipher);
}
unset_nm_gconf_key (client, escaped_network, "key_type");
out:
g_free (escaped_network);
return;
}
void
nma_compat_convert_oldformat_entries (GConfClient *client)
{
GSList * dir_list = NULL;
GSList * elt;
g_return_if_fail (client != NULL);
if (!(dir_list = gconf_client_all_dirs (client, GCONF_PATH_WIRELESS_NETWORKS, NULL)))
return;
for (elt = dir_list; elt; elt = g_slist_next (elt))
{
char key[100];
GConfValue * value;
char * dir = (char *) (elt->data);
g_snprintf (&key[0], 99, "%s/essid", dir);
if ((value = gconf_client_get (client, key, NULL)))
{
if (value->type == GCONF_VALUE_STRING)
{
const char *essid = gconf_value_get_string (value);
convert_one_entry (client, essid);
}
gconf_value_free (value);
}
g_free (dir);
}
g_slist_free (dir_list);
}

View file

@ -1,30 +0,0 @@
/* NetworkManager -- Network link manager
*
* Dan Williams <dcbw@redhat.com>
*
* 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 APPLET_COMPAT_H
#define APPLET_COMPAT_H
#include <glib.h>
#include <gconf/gconf-client.h>
void nma_compat_convert_oldformat_entries (GConfClient *client);
#endif /* APPLET_COMPAT_H */

File diff suppressed because it is too large Load diff

View file

@ -1,57 +0,0 @@
/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
/* NetworkManager Wireless Applet -- Display wireless access points and allow user control
*
* Dan Williams <dcbw@redhat.com>
*
* 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 2004-2005 Red Hat, Inc.
*/
#ifndef APPLET_DBUS_DEVICES_H
#define APPLET_DBUS_DEVICES_H
#include <glib.h>
#include <dbus/dbus.h>
#include "NetworkManager.h"
#include "applet.h"
#include "nm-device.h"
#include "wireless-network.h"
#include "wireless-security-option.h"
void nma_dbus_update_one_vpn_connection (DBusConnection *connection, const char *name, NMApplet *applet, gboolean is_active);
void nma_dbus_update_vpn_connections (NMApplet *applet);
gboolean nma_dbus_update_device_strength (NMApplet *applet);
void nma_dbus_update_nm_state (NMApplet *applet);
void nma_dbus_update_devices (NMApplet *applet);
void nma_dbus_update_dialup (NMApplet *applet);
void nma_dbus_dialup_activate_connection (NMApplet *applet, const char *name);
void nma_dbus_dialup_deactivate_connection (NMApplet *applet, const char *name);
void nma_dbus_device_update_one_device (NMApplet *applet, const char *dev_path);
void nma_dbus_device_activated (NMApplet *applet, const char *dev_path, const char *essid);
void nma_dbus_device_deactivated (NMApplet *applet, const char *dev_path);
void nma_dbus_device_remove_one_device (NMApplet *applet, const char *dev_path);
void nma_dbus_device_update_one_network (NMApplet *applet, const char *dev_path, const char *net_path, const char *active_net_path);
void nma_dbus_device_remove_one_network (NMApplet *applet, const char *dev_path, const char *net_path);
void nma_dbus_update_strength (NMApplet *applet, const char *dev_path, const char *net_path, int strength);
void nma_dbus_set_device (DBusConnection *connection, NetworkDevice *dev, const char *essid, gboolean fallback, WirelessSecurityOption *opt);
void nma_dbus_create_network (DBusConnection *connection, NetworkDevice *dev, const char *essid, WirelessSecurityOption *opt);
void nma_free_data_model (NMApplet *applet);
#endif

File diff suppressed because it is too large Load diff

View file

@ -1,44 +0,0 @@
/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
/* NetworkManager Wireless Applet -- Display wireless access points and allow user control
*
* Dan Williams <dcbw@redhat.com>
*
* 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 2004-2005 Red Hat, Inc.
*/
#ifndef APPLET_DBUS_INFO_H
#define APPLET_DBUS_INFO_H
#include <dbus/dbus.h>
#include "nm-device.h"
#include "wireless-network.h"
#include "NetworkManager.h"
#include "nm-gconf-wso.h"
DBusHandlerResult nmi_dbus_info_message_handler (DBusConnection *connection, DBusMessage *message, void *user_data);
void nmi_dbus_return_user_key (DBusConnection *connection, DBusMessage *message, NMGConfWSO *security);
void nmi_dbus_signal_update_network (DBusConnection *connection, const char *network, NMNetworkType type);
void nmi_dbus_signal_update_vpn_connection (DBusConnection *connection, const char *name);
void nmi_dbus_signal_user_interface_activated (DBusConnection *connection);
DBusMethodDispatcher * nmi_dbus_nmi_methods_setup (void);
#endif

View file

@ -1,377 +0,0 @@
/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
/* NetworkManager Wireless Applet -- Display wireless access points and allow user control
*
* Dan Williams <dcbw@redhat.com>
*
* 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 2004-2005 Red Hat, Inc.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <glib/gi18n.h>
#include <stdio.h>
#include <string.h>
#include <dbus/dbus.h>
#include "applet-dbus-vpn.h"
#include "applet-dbus.h"
#include "applet.h"
#include "vpn-connection.h"
#include "nm-utils.h"
static void nma_free_vpn_connections (NMApplet *applet);
void
nma_dbus_vpn_set_last_attempt_status (NMApplet *applet, const char *vpn_name, gboolean last_attempt_success)
{
char *gconf_key;
char *escaped_name;
VPNConnection *vpn;
if ((vpn = nma_vpn_connection_find_by_name (applet->vpn_connections, vpn_name)))
{
escaped_name = gconf_escape_key (vpn_name, strlen (vpn_name));
gconf_key = g_strdup_printf ("%s/%s/last_attempt_success", GCONF_PATH_VPN_CONNECTIONS, escaped_name);
gconf_client_set_bool (applet->gconf_client, gconf_key, last_attempt_success, NULL);
g_free (gconf_key);
g_free (escaped_name);
}
}
/*
* nma_dbus_vpn_update_vpn_connection_stage
*
* Sets the activation stage for a dbus vpn connection.
*/
void nma_dbus_vpn_update_vpn_connection_stage (NMApplet *applet, const char *vpn_name, NMVPNActStage vpn_stage)
{
VPNConnection *vpn;
g_return_if_fail (applet != NULL);
if ((vpn = nma_vpn_connection_find_by_name (applet->vpn_connections, vpn_name)))
{
nma_vpn_connection_set_stage (vpn, vpn_stage);
if (vpn_stage == NM_VPN_ACT_STAGE_ACTIVATED)
{
/* set the 'last_attempt_success' key in gconf so we DON'T prompt for password next time */
nma_dbus_vpn_set_last_attempt_status (applet, vpn_name, TRUE);
}
}
}
typedef struct VpnPropsCBData
{
NMApplet * applet;
char * name;
} VpnPropsCBData;
static void free_vpn_props_cb_data (VpnPropsCBData *data)
{
if (data)
{
g_free (data->name);
memset (data, 0, sizeof (VpnPropsCBData));
g_free (data);
}
}
static gint vpn_sorter (gconstpointer a,
gconstpointer b) {
VPNConnection *va = (VPNConnection *)a;
VPNConnection *vb = (VPNConnection *)b;
return strcmp(nma_vpn_connection_get_name(va),
nma_vpn_connection_get_name(vb));
}
/*
* nma_dbus_vpn_properties_cb
*
* Callback for each VPN connection we called "getVPNConnectionProperties" on.
*
*/
static void nma_dbus_vpn_properties_cb (DBusPendingCall *pcall, void *user_data)
{
DBusMessage * reply;
VpnPropsCBData * cb_data = user_data;
NMApplet * applet;
const char * name;
const char * user_name;
const char * service;
NMVPNActStage stage;
dbus_uint32_t stage_int;
g_return_if_fail (pcall != NULL);
g_return_if_fail (cb_data != NULL);
g_return_if_fail (cb_data->applet != NULL);
g_return_if_fail (cb_data->name != NULL);
nm_dbus_send_with_callback_replied (pcall, __func__);
applet = cb_data->applet;
if (!(reply = dbus_pending_call_steal_reply (pcall)))
goto out;
if (message_is_error (reply))
{
DBusError err;
dbus_error_init (&err);
dbus_set_error_from_message (&err, reply);
nm_warning ("dbus returned an error.\n (%s) %s\n", err.name, err.message);
dbus_error_free (&err);
dbus_message_unref (reply);
goto out;
}
if (dbus_message_get_args (reply, NULL, DBUS_TYPE_STRING, &name, DBUS_TYPE_STRING, &user_name,
DBUS_TYPE_STRING, &service, DBUS_TYPE_UINT32, &stage_int, DBUS_TYPE_INVALID))
{
VPNConnection * vpn;
stage = (NMVPNActStage) stage_int;
/* If its already there, update the service, otherwise add it to the list */
if ((vpn = nma_vpn_connection_find_by_name (applet->vpn_connections, name)))
{
nma_vpn_connection_set_service (vpn, service);
nma_vpn_connection_set_stage (vpn, stage);
}
else
{
vpn = nma_vpn_connection_new (name);
nma_vpn_connection_set_service (vpn, service);
nma_vpn_connection_set_stage (vpn, stage);
applet->vpn_connections = g_slist_insert_sorted (applet->vpn_connections, vpn, vpn_sorter);
}
}
dbus_message_unref (reply);
out:
dbus_pending_call_unref (pcall);
}
/*
* nma_dbus_vpn_update_one_vpn_connection
*
* Get properties on one VPN connection
*
*/
void nma_dbus_vpn_update_one_vpn_connection (NMApplet *applet, const char *vpn_name)
{
DBusMessage * message;
g_return_if_fail (applet != NULL);
g_return_if_fail (vpn_name != NULL);
nma_get_first_active_vpn_connection (applet);
if ((message = dbus_message_new_method_call (NM_DBUS_SERVICE, NM_DBUS_PATH_VPN, NM_DBUS_INTERFACE_VPN, "getVPNConnectionProperties")))
{
VpnPropsCBData * cb_data = g_malloc0 (sizeof (VpnPropsCBData));
dbus_message_append_args (message, DBUS_TYPE_STRING, &vpn_name, DBUS_TYPE_INVALID);
cb_data->applet = applet;
cb_data->name = g_strdup (vpn_name);
nm_dbus_send_with_callback (applet->connection, message,
nma_dbus_vpn_properties_cb, cb_data,
(DBusFreeFunction) free_vpn_props_cb_data, __func__);
dbus_message_unref (message);
}
}
/*
* nma_dbus_vpn_update_vpn_connections_cb
*
* nma_dbus_vpn_update_vpn_connections callback.
*
*/
static void nma_dbus_vpn_update_vpn_connections_cb (DBusPendingCall *pcall, void *user_data)
{
DBusMessage * reply;
NMApplet * applet = (NMApplet *) user_data;
char ** vpn_names;
int num_vpn_names;
g_return_if_fail (pcall != NULL);
g_return_if_fail (applet != NULL);
nm_dbus_send_with_callback_replied (pcall, __func__);
if (!(reply = dbus_pending_call_steal_reply (pcall)))
goto out;
if (dbus_message_is_error (reply, NM_DBUS_NO_VPN_CONNECTIONS))
{
dbus_message_unref (reply);
goto out;
}
if (message_is_error (reply))
{
DBusError err;
dbus_error_init (&err);
dbus_set_error_from_message (&err, reply);
nm_warning ("dbus returned an error.\n (%s) %s\n", err.name, err.message);
dbus_error_free (&err);
dbus_message_unref (reply);
goto out;
}
if (dbus_message_get_args (reply, NULL, DBUS_TYPE_ARRAY, DBUS_TYPE_STRING, &vpn_names, &num_vpn_names, DBUS_TYPE_INVALID))
{
char ** item;
/* For each connection, fire off a "getVPNConnectionProperties" call */
for (item = vpn_names; *item; item++)
nma_dbus_vpn_update_one_vpn_connection (applet, *item);
dbus_free_string_array (vpn_names);
}
dbus_message_unref (reply);
out:
dbus_pending_call_unref (pcall);
}
/*
* nma_dbus_vpn_update_vpn_connections
*
* Do a full update of vpn connections from NetworkManager
*
*/
void nma_dbus_vpn_update_vpn_connections (NMApplet *applet)
{
DBusMessage * message;
nma_free_vpn_connections (applet);
nma_get_first_active_vpn_connection (applet);
if ((message = dbus_message_new_method_call (NM_DBUS_SERVICE, NM_DBUS_PATH_VPN, NM_DBUS_INTERFACE_VPN, "getVPNConnections")))
{
nm_dbus_send_with_callback (applet->connection, message,
nma_dbus_vpn_update_vpn_connections_cb, applet, NULL, __func__);
dbus_message_unref (message);
}
}
/*
* nma_dbus_vpn_remove_one_vpn_connection
*
* Remove one vpn connection from the list
*
*/
void nma_dbus_vpn_remove_one_vpn_connection (NMApplet *applet, const char *vpn_name)
{
VPNConnection * vpn;
g_return_if_fail (applet != NULL);
g_return_if_fail (vpn_name != NULL);
if ((vpn = nma_vpn_connection_find_by_name (applet->vpn_connections, vpn_name)))
{
applet->vpn_connections = g_slist_remove (applet->vpn_connections, vpn);
nma_vpn_connection_unref (vpn);
}
}
static void nma_free_vpn_connections (NMApplet *applet)
{
g_return_if_fail (applet != NULL);
if (applet->vpn_connections)
{
g_slist_foreach (applet->vpn_connections, (GFunc) nma_vpn_connection_unref, NULL);
g_slist_free (applet->vpn_connections);
applet->vpn_connections = NULL;
}
}
/*
* nma_dbus_vpn_activate_connection
*
* Tell NetworkManager to activate a particular VPN connection.
*
*/
void nma_dbus_vpn_activate_connection (DBusConnection *connection, const char *name, GSList *passwords)
{
DBusMessage *message;
DBusMessageIter iter;
DBusMessageIter iter_array;
g_return_if_fail (connection != NULL);
g_return_if_fail (name != NULL);
g_return_if_fail (passwords != NULL);
if ((message = dbus_message_new_method_call (NM_DBUS_SERVICE, NM_DBUS_PATH_VPN, NM_DBUS_INTERFACE_VPN, "activateVPNConnection")))
{
GSList *i;
nm_info ("Activating VPN connection '%s'.", name);
dbus_message_iter_init_append (message, &iter);
dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &name);
dbus_message_iter_open_container (&iter, DBUS_TYPE_ARRAY, DBUS_TYPE_STRING_AS_STRING, &iter_array);
for (i = passwords; i != NULL; i = g_slist_next (i)) {
dbus_message_iter_append_basic (&iter_array, DBUS_TYPE_STRING, &(i->data));
}
dbus_message_iter_close_container (&iter, &iter_array);
dbus_connection_send (connection, message, NULL);
}
else
nm_warning ("Couldn't allocate the dbus message");
}
/*
* nma_dbus_deactivate_vpn_connection
*
* Tell NetworkManager to deactivate the currently active VPN connection.
*
*/
void nma_dbus_vpn_deactivate_connection (DBusConnection *connection)
{
DBusMessage *message;
g_return_if_fail (connection != NULL);
if ((message = dbus_message_new_method_call (NM_DBUS_SERVICE, NM_DBUS_PATH_VPN, NM_DBUS_INTERFACE_VPN, "deactivateVPNConnection")))
{
nm_info ("Deactivating the current VPN connection.");
dbus_connection_send (connection, message, NULL);
}
else
nm_warning ("Couldn't allocate the dbus message");
}

View file

@ -1,40 +0,0 @@
/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
/* NetworkManager Wireless Applet -- Display wireless access points and allow user control
*
* Dan Williams <dcbw@redhat.com>
*
* 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 2004-2005 Red Hat, Inc.
*/
#ifndef APPLET_DBUS_VPN_H
#define APPLET_DBUS_VPN_H
#include <glib.h>
#include <dbus/dbus.h>
#include "vpn-connection.h"
void nma_dbus_vpn_set_last_attempt_status (NMApplet *applet, const char *vpn_name, gboolean last_attempt_success);
void nma_dbus_vpn_update_one_vpn_connection (NMApplet *applet, const char *vpn_name);
void nma_dbus_vpn_update_vpn_connections (NMApplet *applet);
void nma_dbus_vpn_remove_one_vpn_connection (NMApplet *applet, const char *vpn_name);
void nma_dbus_vpn_activate_connection (DBusConnection *connection, const char *name, GSList *passwords);
void nma_dbus_vpn_deactivate_connection (DBusConnection *connection);
void nma_dbus_vpn_update_vpn_connection_stage (NMApplet *applet, const char *vpn_name, NMVPNActStage vpn_state);
#endif

View file

@ -1,489 +0,0 @@
/* NetworkManager Wireless Applet -- Display wireless access points and allow user control
*
* Dan Williams <dcbw@redhat.com>
*
* 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 2004 Red Hat, Inc.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <glib.h>
#include <glib/gi18n.h>
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include <math.h>
#include <dbus/dbus.h>
#include <dbus/dbus-glib-lowlevel.h>
#include "applet.h"
#include "applet-dbus.h"
#include "applet-dbus-devices.h"
#include "applet-dbus-vpn.h"
#include "applet-dbus-info.h"
#include "vpn-connection.h"
#include "passphrase-dialog.h"
#include "nm-utils.h"
#define DBUS_NO_SERVICE_ERROR "org.freedesktop.DBus.Error.ServiceDoesNotExist"
/*
* nma_dbus_filter
*
*/
static DBusHandlerResult nma_dbus_filter (DBusConnection *connection, DBusMessage *message, void *user_data)
{
NMApplet * applet = (NMApplet *)user_data;
gboolean handled = TRUE;
const char * object_path;
const char * member;
const char * interface;
g_return_val_if_fail (applet != NULL, DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
g_return_val_if_fail (connection != NULL, DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
g_return_val_if_fail (message != NULL, DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
if (!(object_path = dbus_message_get_path (message)))
return FALSE;
if (!(member = dbus_message_get_member (message)))
return FALSE;
if (!(interface = dbus_message_get_interface (message)))
return FALSE;
/* nm_info ("signal(): got signal op='%s' member='%s' interface='%s'", object_path, member, interface); */
if (dbus_message_is_signal (message, DBUS_INTERFACE_LOCAL, "Disconnected"))
{
dbus_connection_unref (applet->connection);
applet->connection = NULL;
nma_set_running (applet, FALSE);
if (!applet->connection_timeout_id)
nma_start_dbus_connection_watch (applet);
}
else if (dbus_message_is_signal (message, DBUS_INTERFACE_DBUS, "NameOwnerChanged"))
{
char *service;
char *old_owner;
char *new_owner;
if (dbus_message_get_args (message, NULL,
DBUS_TYPE_STRING, &service,
DBUS_TYPE_STRING, &old_owner,
DBUS_TYPE_STRING, &new_owner,
DBUS_TYPE_INVALID))
{
if (strcmp (service, NM_DBUS_SERVICE) == 0)
{
gboolean old_owner_good = (old_owner && (strlen (old_owner) > 0));
gboolean new_owner_good = (new_owner && (strlen (new_owner) > 0));
if (!old_owner_good && new_owner_good && !applet->nm_running)
{
/* NetworkManager started up */
nma_set_running (applet, TRUE);
nma_set_state (applet, NM_STATE_DISCONNECTED);
nma_dbus_update_nm_state (applet);
nma_dbus_update_devices (applet);
nma_dbus_update_dialup (applet);
nma_dbus_vpn_update_vpn_connections (applet);
/* Immediate redraw */
nma_update_state (applet);
}
else if (old_owner_good && !new_owner_good)
{
nma_set_state (applet, NM_STATE_DISCONNECTED);
nma_set_running (applet, FALSE);
nmi_passphrase_dialog_destroy (applet);
/* One last redraw to capture new state before sleeping */
nma_update_state (applet);
}
}
}
}
else if (dbus_message_is_signal (message, NM_DBUS_INTERFACE, NM_DBUS_SIGNAL_STATE_CHANGE))
{
NMState state = NM_STATE_UNKNOWN;
if (dbus_message_get_args (message, NULL, DBUS_TYPE_UINT32, &state, DBUS_TYPE_INVALID))
{
NetworkDevice *act_dev = nma_get_first_active_device (applet->device_list);
/* If we've switched to connecting, update the active device to ensure that we have
* valid wireless network information for it.
*/
if (state == NM_STATE_CONNECTING && act_dev && network_device_is_wireless (act_dev))
{
nma_dbus_device_update_one_device (applet, network_device_get_nm_path (act_dev));
}
nma_set_state (applet, state);
}
}
else if ( dbus_message_is_signal (message, NM_DBUS_INTERFACE, "DeviceAdded")
|| dbus_message_is_signal (message, NM_DBUS_INTERFACE, "DeviceActivating")
|| dbus_message_is_signal (message, NM_DBUS_INTERFACE, "DeviceCarrierOn")
|| dbus_message_is_signal (message, NM_DBUS_INTERFACE, "DeviceCarrierOff"))
{
char *path = NULL;
if (dbus_message_get_args (message, NULL, DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID))
nma_dbus_device_update_one_device (applet, path);
}
else if (dbus_message_is_signal (message, NM_DBUS_INTERFACE, "DeviceNowActive"))
{
char *path = NULL;
char *essid = NULL;
if (dbus_message_get_args (message, NULL, DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_STRING, &essid, DBUS_TYPE_INVALID))
nma_dbus_device_activated (applet, path, essid);
else if (dbus_message_get_args (message, NULL, DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID))
nma_dbus_device_activated (applet, path, NULL);
}
else if (dbus_message_is_signal (message, NM_DBUS_INTERFACE, "DeviceNoLongerActive"))
{
char *path = NULL;
if (dbus_message_get_args (message, NULL, DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID))
nma_dbus_device_deactivated (applet, path);
}
else if (dbus_message_is_signal (message, NM_DBUS_INTERFACE, "DeviceRemoved"))
{
char *path = NULL;
if (dbus_message_get_args (message, NULL, DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID))
nma_dbus_device_remove_one_device (applet, path);
}
else if ( dbus_message_is_signal (message, NM_DBUS_INTERFACE_VPN, "VPNConnectionAdded")
|| dbus_message_is_signal (message, NM_DBUS_INTERFACE_VPN, "VPNConnectionUpdate")) /* VPN connection properties changed */
{
char *name = NULL;
if (dbus_message_get_args (message, NULL, DBUS_TYPE_STRING, &name, DBUS_TYPE_INVALID))
nma_dbus_vpn_update_one_vpn_connection (applet, name);
}
else if (dbus_message_is_signal (message, NM_DBUS_INTERFACE_VPN, "VPNConnectionStateChange")) /* Active VPN connection changed */
{
char * name = NULL;
NMVPNActStage vpn_stage;
dbus_uint32_t vpn_stage_int;
if (dbus_message_get_args (message, NULL, DBUS_TYPE_STRING, &name, DBUS_TYPE_UINT32, &vpn_stage_int, DBUS_TYPE_INVALID))
{
vpn_stage = (NMVPNActStage) vpn_stage_int;
nma_dbus_vpn_update_vpn_connection_stage (applet, name, vpn_stage);
}
}
else if (dbus_message_is_signal (message, NM_DBUS_INTERFACE_VPN, "VPNConnectionRemoved"))
{
char *name = NULL;
if (dbus_message_get_args (message, NULL, DBUS_TYPE_STRING, &name, DBUS_TYPE_INVALID))
nma_dbus_vpn_remove_one_vpn_connection (applet, name);
}
else if (dbus_message_is_signal (message, NM_DBUS_INTERFACE, "WirelessNetworkAppeared"))
{
char *dev_path = NULL;
char *net_path = NULL;
if (dbus_message_get_args (message, NULL, DBUS_TYPE_OBJECT_PATH, &dev_path, DBUS_TYPE_OBJECT_PATH, &net_path, DBUS_TYPE_INVALID))
nma_dbus_device_update_one_network (applet, dev_path, net_path, NULL);
}
else if (dbus_message_is_signal (message, NM_DBUS_INTERFACE, "WirelessNetworkDisappeared"))
{
char *dev_path = NULL;
char *net_path = NULL;
if (dbus_message_get_args (message, NULL, DBUS_TYPE_OBJECT_PATH, &dev_path, DBUS_TYPE_OBJECT_PATH, &net_path, DBUS_TYPE_INVALID))
nma_dbus_device_remove_one_network (applet, dev_path, net_path);
}
else if (dbus_message_is_signal (message, NM_DBUS_INTERFACE, "WirelessNetworkStrengthChanged"))
{
char * dev_path = NULL;
char * net_path = NULL;
int strength = -1;
if (dbus_message_get_args (message, NULL, DBUS_TYPE_OBJECT_PATH, &dev_path, DBUS_TYPE_OBJECT_PATH, &net_path, DBUS_TYPE_INT32, &strength, DBUS_TYPE_INVALID))
nma_dbus_update_strength (applet, dev_path, net_path, strength);
}
else if (dbus_message_is_signal (message, NM_DBUS_INTERFACE, "DeviceStrengthChanged"))
{
char *dev_path = NULL;
int strength = -1;
if (dbus_message_get_args (message, NULL, DBUS_TYPE_OBJECT_PATH, &dev_path, DBUS_TYPE_INT32, &strength, DBUS_TYPE_INVALID))
nma_dbus_update_strength (applet, dev_path, NULL, strength);
}
else if ( dbus_message_is_signal (message, NM_DBUS_INTERFACE_VPN, NM_DBUS_VPN_SIGNAL_LOGIN_FAILED)
|| dbus_message_is_signal (message, NM_DBUS_INTERFACE_VPN, NM_DBUS_VPN_SIGNAL_LAUNCH_FAILED)
|| dbus_message_is_signal (message, NM_DBUS_INTERFACE_VPN, NM_DBUS_VPN_SIGNAL_CONNECT_FAILED)
|| dbus_message_is_signal (message, NM_DBUS_INTERFACE_VPN, NM_DBUS_VPN_SIGNAL_VPN_CONFIG_BAD)
|| dbus_message_is_signal (message, NM_DBUS_INTERFACE_VPN, NM_DBUS_VPN_SIGNAL_IP_CONFIG_BAD))
{
char *vpn_name;
char *error_msg;
if (dbus_message_get_args (message, NULL, DBUS_TYPE_STRING, &vpn_name, DBUS_TYPE_STRING, &error_msg, DBUS_TYPE_INVALID)) {
nma_show_vpn_failure_alert (applet, member, vpn_name, error_msg);
/* clear the 'last_attempt_success' key in gconf so we prompt for password next time */
nma_dbus_vpn_set_last_attempt_status (applet, vpn_name, FALSE);
}
}
else if (dbus_message_is_signal (message, NM_DBUS_INTERFACE_VPN, NM_DBUS_VPN_SIGNAL_LOGIN_BANNER))
{
char *vpn_name;
char *banner;
if (dbus_message_get_args (message, NULL, DBUS_TYPE_STRING, &vpn_name, DBUS_TYPE_STRING, &banner, DBUS_TYPE_INVALID))
{
char *stripped = g_strstrip (g_strdup (banner));
nma_show_vpn_login_banner (applet, vpn_name, stripped);
g_free (stripped);
/* set the 'last_attempt_success' key in gconf so we DON'T prompt for password next time */
nma_dbus_vpn_set_last_attempt_status (applet, vpn_name, TRUE);
}
}
else if (dbus_message_is_signal (message, NM_DBUS_INTERFACE, "DeviceActivationFailed"))
{
char *dev = NULL;
char *net = NULL;
if (!dbus_message_get_args (message, NULL, DBUS_TYPE_STRING, &dev, DBUS_TYPE_STRING, &net, DBUS_TYPE_INVALID))
dbus_message_get_args (message, NULL, DBUS_TYPE_STRING, &dev, DBUS_TYPE_INVALID);
if (dev && net)
{
char *string = g_strdup_printf (_("Connection to the wireless network '%s' failed."), net);
nma_schedule_warning_dialog (applet, string);
g_free (string);
}
else if (dev)
nma_schedule_warning_dialog (applet, _("Connection to the wired network failed."));
}
else if (dbus_message_is_signal (message, NM_DBUS_INTERFACE, "DeviceActivationStage"))
{
char * dev_path = NULL;
NMActStage stage;
if (dbus_message_get_args (message, NULL, DBUS_TYPE_OBJECT_PATH, &dev_path, DBUS_TYPE_UINT32, &stage, DBUS_TYPE_INVALID))
{
NetworkDevice *dev;
if ((dev = nma_get_device_for_nm_path (applet->device_list, dev_path)))
network_device_set_act_stage (dev, stage);
}
}
else
handled = FALSE;
return (handled ? DBUS_HANDLER_RESULT_HANDLED : DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
}
/*
* nma_dbus_nm_is_running
*
* Ask dbus whether or not NetworkManager is running
*
*/
static gboolean nma_dbus_nm_is_running (DBusConnection *connection)
{
DBusError error;
gboolean exists;
g_return_val_if_fail (connection != NULL, FALSE);
dbus_error_init (&error);
exists = dbus_bus_name_has_owner (connection, NM_DBUS_SERVICE, &error);
if (dbus_error_is_set (&error))
dbus_error_free (&error);
return (exists);
}
/*
* nma_dbus_init
*
* Initialize a connection to NetworkManager if we can get one
*
*/
static DBusConnection * nma_dbus_init (NMApplet *applet)
{
DBusConnection * connection = NULL;
DBusError error;
DBusObjectPathVTable vtable = { NULL, &nmi_dbus_info_message_handler, NULL, NULL, NULL, NULL };
int acquisition;
dbus_bool_t success = FALSE;
g_return_val_if_fail (applet != NULL, NULL);
dbus_error_init (&error);
connection = dbus_bus_get (DBUS_BUS_SYSTEM, &error);
if (dbus_error_is_set (&error)) {
nm_warning ("%s raised:\n %s\n\n", error.name, error.message);
goto error;
}
dbus_error_init (&error);
acquisition = dbus_bus_request_name (connection,
NMI_DBUS_SERVICE,
DBUS_NAME_FLAG_REPLACE_EXISTING,
&error);
if (dbus_error_is_set (&error)) {
nm_warning ("could not acquire its service. dbus_bus_acquire_service()"
" says: '%s'",
error.message);
goto error;
}
if (acquisition == DBUS_REQUEST_NAME_REPLY_EXISTS)
goto error;
success = dbus_connection_register_object_path (connection,
NMI_DBUS_PATH,
&vtable,
applet);
if (!success) {
nm_warning ("could not register a messgae handler for the"
" NetworkManagerInfo service. Not enough memory?");
goto error;
}
success = dbus_connection_add_filter (connection, nma_dbus_filter, applet, NULL);
if (!success)
goto error;
dbus_connection_set_exit_on_disconnect (connection, FALSE);
dbus_connection_setup_with_g_main (connection, NULL);
dbus_error_init (&error);
dbus_bus_add_match(connection,
"type='signal',"
"interface='" DBUS_INTERFACE_DBUS "',"
"sender='" DBUS_SERVICE_DBUS "'",
&error);
if (dbus_error_is_set (&error)) {
nm_warning ("Could not register signal handlers. '%s'",
error.message);
goto error;
}
dbus_error_init (&error);
dbus_bus_add_match(connection,
"type='signal',"
"interface='" NM_DBUS_INTERFACE "',"
"path='" NM_DBUS_PATH "',"
"sender='" NM_DBUS_SERVICE "'",
&error);
if (dbus_error_is_set (&error)) {
nm_warning ("Could not register signal handlers. '%s'",
error.message);
goto error;
}
dbus_error_init (&error);
dbus_bus_add_match(connection,
"type='signal',"
"interface='" NM_DBUS_INTERFACE_VPN "',"
"path='" NM_DBUS_PATH_VPN "',"
"sender='" NM_DBUS_SERVICE "'",
&error);
if (dbus_error_is_set (&error)) {
nm_warning ("Could not register signal handlers. '%s'",
error.message);
goto error;
}
return connection;
error:
if (dbus_error_is_set (&error))
dbus_error_free (&error);
if (connection)
dbus_connection_unref (connection);
return NULL;
}
/*
* nma_dbus_connection_watcher
*
* Try to reconnect if we ever get disconnected from the bus
*
*/
static gboolean
nma_dbus_connection_watcher (gpointer user_data)
{
NMApplet * applet = (NMApplet *)user_data;
g_return_val_if_fail (applet != NULL, TRUE);
nma_dbus_init_helper (applet);
if (applet->connection) {
applet->connection_timeout_id = 0;
return FALSE; /* Remove timeout */
}
return TRUE;
}
void
nma_start_dbus_connection_watch (NMApplet *applet)
{
if (applet->connection_timeout_id)
g_source_remove (applet->connection_timeout_id);
applet->connection_timeout_id = g_timeout_add (5000,
(GSourceFunc) nma_dbus_connection_watcher,
applet);
}
/*
* nma_dbus_init_helper
*
* Set up the applet's NMI dbus methods and dbus connection
*
*/
void
nma_dbus_init_helper (NMApplet *applet)
{
g_return_if_fail (applet != NULL);
applet->connection = nma_dbus_init (applet);
if (applet->connection) {
if (applet->connection_timeout_id) {
g_source_remove (applet->connection_timeout_id);
applet->connection_timeout_id = 0;
}
if (nma_dbus_nm_is_running (applet->connection)) {
nma_set_running (applet, TRUE);
nma_dbus_update_nm_state (applet);
nma_dbus_update_devices (applet);
nma_dbus_update_dialup (applet);
nma_dbus_vpn_update_vpn_connections (applet);
/* Immediate redraw */
nma_update_state (applet);
}
}
}

View file

@ -1,44 +0,0 @@
/* NetworkManager Wireless Applet -- Display wireless access points and allow user control
*
* Dan Williams <dcbw@redhat.com>
*
* 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 2004 Red Hat, Inc.
*/
#ifndef APPLET_DBUS_H
#define APPLET_DBUS_H
#include <dbus/dbus.h>
#include <dbus/dbus-glib.h>
#include "NetworkManager.h"
#include "applet.h"
static inline gboolean message_is_error (DBusMessage *msg)
{
g_return_val_if_fail (msg != NULL, FALSE);
return (dbus_message_get_type (msg) == DBUS_MESSAGE_TYPE_ERROR);
}
void nma_dbus_init_helper (NMApplet *applet);
void nma_start_dbus_connection_watch (NMApplet *applet);
void nma_dbus_enable_wireless (NMApplet *applet, gboolean enabled);
void nma_dbus_enable_networking (NMApplet *applet, gboolean enabled);
void nma_free_gui_data_model (NMApplet *applet);
void nma_free_dbus_data_model (NMApplet *applet);
#endif

View file

@ -1,58 +0,0 @@
/* NetworkManager -- Network link manager
*
* Christopher Aillon <caillon@redhat.com>
*
* 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 <libnotify/notify.h>
#include "applet.h"
#include "applet-notifications.h"
void
nma_send_event_notification (NMApplet *applet,
NotifyUrgency urgency,
const char *summary,
const char *message,
const char *icon)
{
const char *notify_icon;
g_return_if_fail (applet != NULL);
g_return_if_fail (summary != NULL);
g_return_if_fail (message != NULL);
if (!notify_is_initted ())
notify_init ("NetworkManager");
if (applet->notification != NULL) {
notify_notification_close (applet->notification, NULL);
g_object_unref (applet->notification);
}
notify_icon = icon ? icon : GTK_STOCK_NETWORK;
#ifdef HAVE_STATUS_ICON
applet->notification = notify_notification_new_with_status_icon (summary, message, notify_icon, applet->status_icon);
#else
applet->notification = notify_notification_new (summary, message, notify_icon, GTK_WIDGET (applet->tray_icon));
#endif /* HAVE_STATUS_ICON */
notify_notification_set_urgency (applet->notification, urgency);
notify_notification_show (applet->notification, NULL);
}

View file

@ -1,41 +0,0 @@
/* NetworkManager -- Network link manager
*
* Christopher Aillon <caillon@redhat.com>
*
* 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 NM_NOTIFICATION_H__
#define NM_NOTIFICATION_H__
#include "config.h"
#ifdef ENABLE_NOTIFY
#include <libnotify/notify.h>
#include "applet.h"
void
nma_send_event_notification (NMApplet *applet,
NotifyUrgency urgency,
const char *summary,
const char *message,
const char *icon);
#endif /* ENABLE_NOTIFY */
#endif /* NM_NOTIFICATION_H__ */

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,177 +0,0 @@
/* NetworkManager Wireless Applet -- Display wireless access points and allow user control
*
* Dan Williams <dcbw@redhat.com>
*
* 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 2004 Red Hat, Inc.
*/
#ifndef APPLET_H
#define APPLET_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <gtk/gtk.h>
#include <gconf/gconf-client.h>
#include <glade/glade.h>
#include <dbus/dbus.h>
#include <dbus/dbus-glib.h>
#include <net/ethernet.h>
#ifdef GDK_WINDOWING_X11
#include <gdk/gdkx.h>
#endif
#ifndef HAVE_STATUS_ICON
#include "eggtrayicon.h"
#endif
#include "nm-device.h"
#include "wireless-network.h"
#include "dbus-method-dispatcher.h"
#ifdef ENABLE_NOTIFY
#include <libnotify/notify.h>
#endif
/*
* Preference locations
*/
#define GCONF_PATH_WIRELESS_NETWORKS "/system/networking/wireless/networks"
#define GCONF_PATH_WIRELESS "/system/networking/wireless"
#define GCONF_PATH_VPN_CONNECTIONS "/system/networking/vpn_connections"
#define GCONF_PATH_PREFS "/apps/NetworkManagerApplet"
typedef struct VPNConnection VPNConnection;
#define NM_TYPE_APPLET (nma_get_type())
#define NM_APPLET(object) (G_TYPE_CHECK_INSTANCE_CAST((object), NM_TYPE_APPLET, NMApplet))
#define NM_APPLET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), NM_TYPE_APPLET, NMAppletClass))
#define NM_IS_APPLET(object) (G_TYPE_CHECK_INSTANCE_TYPE((object), NM_TYPE_APPLET))
#define NM_IS_APPLET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), NM_TYPE_APPLET))
#define NM_APPLET_GET_CLASS(object)(G_TYPE_INSTANCE_GET_CLASS((object), NM_TYPE_APPLET, NMAppletClass))
typedef struct
{
GObjectClass parent_class;
} NMAppletClass;
/*
* Applet instance data
*
*/
typedef struct
{
GObject parent_instance;
DBusConnection * connection;
DBusMethodDispatcher * nmi_methods;
GConfClient * gconf_client;
guint gconf_prefs_notify_id;
guint gconf_vpn_notify_id;
char * glade_file;
guint redraw_timeout_id;
guint connection_timeout_id;
/* Data model elements */
gboolean is_adhoc;
gboolean wireless_enabled;
gboolean nm_running;
gboolean icons_loaded;
NMState nm_state;
GSList * device_list;
GSList * dialup_list;
GSList * vpn_connections;
GtkIconTheme * icon_theme;
GdkPixbuf * no_connection_icon;
GdkPixbuf * wired_icon;
GdkPixbuf * adhoc_icon;
GdkPixbuf * wireless_00_icon;
GdkPixbuf * wireless_25_icon;
GdkPixbuf * wireless_50_icon;
GdkPixbuf * wireless_75_icon;
GdkPixbuf * wireless_100_icon;
#define NUM_CONNECTING_STAGES 3
#define NUM_CONNECTING_FRAMES 11
GdkPixbuf * network_connecting_icons[NUM_CONNECTING_STAGES][NUM_CONNECTING_FRAMES];
#define NUM_VPN_CONNECTING_FRAMES 14
GdkPixbuf * vpn_connecting_icons[NUM_VPN_CONNECTING_FRAMES];
GdkPixbuf * vpn_lock_icon;
/* Animation stuff */
int animation_step;
guint animation_id;
/* Direct UI elements */
#ifdef HAVE_STATUS_ICON
GtkStatusIcon * status_icon;
int size;
#else
EggTrayIcon * tray_icon;
GtkWidget * pixmap;
GtkWidget * event_box;
GtkTooltips * tooltips;
#endif /* HAVE_STATUS_ICON */
GtkWidget * top_menu_item;
GtkWidget * dropdown_menu;
GtkWidget * vpn_menu;
GtkSizeGroup * encryption_size_group;
GtkWidget * context_menu;
GtkWidget * enable_networking_item;
GtkWidget * stop_wireless_item;
GtkWidget * info_menu_item;
GtkWidget * passphrase_dialog;
GladeXML * info_dialog_xml;
#ifdef ENABLE_NOTIFY
NotifyNotification* notification;
#endif
} NMApplet;
typedef struct
{
NMApplet * applet;
NetworkDevice * dev;
GladeXML * xml;
} DriverNotifyCBData;
NetworkDevice * nma_get_device_for_nm_path (GSList *dev_list, const char *nm_dev);
NMApplet * nma_new (void);
void nma_schedule_warning_dialog (NMApplet *applet, const char *msg);
gboolean nma_driver_notify (gpointer user_data);
void nma_show_vpn_failure_alert (NMApplet *applet, const char *member, const char *vpn_name, const char *error_msg);
void nma_show_vpn_login_banner (NMApplet *applet, const char *vpn_name, const char *banner);
NetworkDevice * nma_get_first_active_device (GSList *dev_list);
VPNConnection * nma_get_first_active_vpn_connection (NMApplet *applet);
void nma_enable_wireless_set_active (NMApplet *applet);
void nma_set_state (NMApplet *applet, NMState state);
void nma_set_running (NMApplet *applet, gboolean running);
void nma_update_state (NMApplet *applet);
int nm_null_safe_strcmp (const char *s1, const char *s2);
#endif

View file

@ -1,560 +0,0 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/* eggtrayicon.c
* Copyright (C) 2002 Anders Carlsson <andersca@gnu.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <config.h>
#include <string.h>
#include <glib/gi18n.h>
#include "eggtrayicon.h"
#include <gdkconfig.h>
#if defined (GDK_WINDOWING_X11)
#include <gdk/gdkx.h>
#include <X11/Xatom.h>
#elif defined (GDK_WINDOWING_WIN32)
#include <gdk/gdkwin32.h>
#endif
#ifndef EGG_COMPILATION
#ifndef _
#define _(x) dgettext (GETTEXT_PACKAGE, x)
#define N_(x) x
#endif
#else
#define _(x) x
#define N_(x) x
#endif
#define SYSTEM_TRAY_REQUEST_DOCK 0
#define SYSTEM_TRAY_BEGIN_MESSAGE 1
#define SYSTEM_TRAY_CANCEL_MESSAGE 2
#define SYSTEM_TRAY_ORIENTATION_HORZ 0
#define SYSTEM_TRAY_ORIENTATION_VERT 1
enum {
PROP_0,
PROP_ORIENTATION
};
static GtkPlugClass *parent_class = NULL;
static void egg_tray_icon_init (EggTrayIcon *icon);
static void egg_tray_icon_class_init (EggTrayIconClass *klass);
static void egg_tray_icon_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec);
static void egg_tray_icon_realize (GtkWidget *widget);
static void egg_tray_icon_unrealize (GtkWidget *widget);
static void egg_tray_icon_add (GtkContainer *container,
GtkWidget *widget);
#ifdef GDK_WINDOWING_X11
static void egg_tray_icon_update_manager_window (EggTrayIcon *icon,
gboolean dock_if_realized);
static void egg_tray_icon_manager_window_destroyed (EggTrayIcon *icon);
#endif
GType
egg_tray_icon_get_type (void)
{
static GType our_type = 0;
if (our_type == 0)
{
static const GTypeInfo our_info =
{
sizeof (EggTrayIconClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) egg_tray_icon_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (EggTrayIcon),
0, /* n_preallocs */
(GInstanceInitFunc) egg_tray_icon_init,
NULL /* value_table */
};
our_type = g_type_register_static (GTK_TYPE_PLUG, "EggTrayIcon", &our_info, 0);
}
return our_type;
}
static void
egg_tray_icon_init (EggTrayIcon *icon)
{
icon->stamp = 1;
icon->orientation = GTK_ORIENTATION_HORIZONTAL;
gtk_widget_add_events (GTK_WIDGET (icon), GDK_PROPERTY_CHANGE_MASK);
}
static void
egg_tray_icon_class_init (EggTrayIconClass *klass)
{
GObjectClass *gobject_class = (GObjectClass *)klass;
GtkWidgetClass *widget_class = (GtkWidgetClass *)klass;
GtkContainerClass *container_class = (GtkContainerClass *)klass;
parent_class = g_type_class_peek_parent (klass);
gobject_class->get_property = egg_tray_icon_get_property;
widget_class->realize = egg_tray_icon_realize;
widget_class->unrealize = egg_tray_icon_unrealize;
container_class->add = egg_tray_icon_add;
g_object_class_install_property (gobject_class,
PROP_ORIENTATION,
g_param_spec_enum ("orientation",
_("Orientation"),
_("The orientation of the tray."),
GTK_TYPE_ORIENTATION,
GTK_ORIENTATION_HORIZONTAL,
G_PARAM_READABLE));
#if defined (GDK_WINDOWING_X11)
/* Nothing */
#elif defined (GDK_WINDOWING_WIN32)
g_warning ("Port eggtrayicon to Win32");
#else
g_warning ("Port eggtrayicon to this GTK+ backend");
#endif
}
static void
egg_tray_icon_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
EggTrayIcon *icon = EGG_TRAY_ICON (object);
switch (prop_id)
{
case PROP_ORIENTATION:
g_value_set_enum (value, icon->orientation);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
#ifdef GDK_WINDOWING_X11
static void
egg_tray_icon_get_orientation_property (EggTrayIcon *icon)
{
Display *xdisplay;
Atom type;
int format;
union {
gulong *prop;
guchar *prop_ch;
} prop = { NULL };
gulong nitems;
gulong bytes_after;
int error, result;
g_assert (icon->manager_window != None);
xdisplay = GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (GTK_WIDGET (icon)));
gdk_error_trap_push ();
type = None;
result = XGetWindowProperty (xdisplay,
icon->manager_window,
icon->orientation_atom,
0, G_MAXLONG, FALSE,
XA_CARDINAL,
&type, &format, &nitems,
&bytes_after, &(prop.prop_ch));
error = gdk_error_trap_pop ();
if (error || result != Success)
return;
if (type == XA_CARDINAL)
{
GtkOrientation orientation;
orientation = (prop.prop [0] == SYSTEM_TRAY_ORIENTATION_HORZ) ?
GTK_ORIENTATION_HORIZONTAL :
GTK_ORIENTATION_VERTICAL;
if (icon->orientation != orientation)
{
icon->orientation = orientation;
g_object_notify (G_OBJECT (icon), "orientation");
}
}
if (prop.prop)
XFree (prop.prop);
}
static GdkFilterReturn
egg_tray_icon_manager_filter (GdkXEvent *xevent, GdkEvent *event, gpointer user_data)
{
EggTrayIcon *icon = user_data;
XEvent *xev = (XEvent *)xevent;
if (xev->xany.type == ClientMessage &&
xev->xclient.message_type == icon->manager_atom &&
xev->xclient.data.l[1] == icon->selection_atom)
{
egg_tray_icon_update_manager_window (icon, TRUE);
}
else if (xev->xany.window == icon->manager_window)
{
if (xev->xany.type == PropertyNotify &&
xev->xproperty.atom == icon->orientation_atom)
{
egg_tray_icon_get_orientation_property (icon);
}
if (xev->xany.type == DestroyNotify)
{
egg_tray_icon_manager_window_destroyed (icon);
}
}
return GDK_FILTER_CONTINUE;
}
#endif
static void
egg_tray_icon_unrealize (GtkWidget *widget)
{
#ifdef GDK_WINDOWING_X11
EggTrayIcon *icon = EGG_TRAY_ICON (widget);
GdkWindow *root_window;
if (icon->manager_window != None)
{
GdkWindow *gdkwin;
gdkwin = gdk_window_lookup_for_display (gtk_widget_get_display (widget),
icon->manager_window);
gdk_window_remove_filter (gdkwin, egg_tray_icon_manager_filter, icon);
}
root_window = gdk_screen_get_root_window (gtk_widget_get_screen (widget));
gdk_window_remove_filter (root_window, egg_tray_icon_manager_filter, icon);
if (GTK_WIDGET_CLASS (parent_class)->unrealize)
(* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget);
#endif
}
#ifdef GDK_WINDOWING_X11
static void
egg_tray_icon_send_manager_message (EggTrayIcon *icon,
long message,
Window window,
long data1,
long data2,
long data3)
{
XClientMessageEvent ev;
Display *display;
ev.type = ClientMessage;
ev.window = window;
ev.message_type = icon->system_tray_opcode_atom;
ev.format = 32;
ev.data.l[0] = gdk_x11_get_server_time (GTK_WIDGET (icon)->window);
ev.data.l[1] = message;
ev.data.l[2] = data1;
ev.data.l[3] = data2;
ev.data.l[4] = data3;
display = GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (GTK_WIDGET (icon)));
gdk_error_trap_push ();
XSendEvent (display,
icon->manager_window, False, NoEventMask, (XEvent *)&ev);
XSync (display, False);
gdk_error_trap_pop ();
}
static void
egg_tray_icon_send_dock_request (EggTrayIcon *icon)
{
egg_tray_icon_send_manager_message (icon,
SYSTEM_TRAY_REQUEST_DOCK,
icon->manager_window,
gtk_plug_get_id (GTK_PLUG (icon)),
0, 0);
}
static void
egg_tray_icon_update_manager_window (EggTrayIcon *icon,
gboolean dock_if_realized)
{
Display *xdisplay;
if (icon->manager_window != None)
return;
xdisplay = GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (GTK_WIDGET (icon)));
XGrabServer (xdisplay);
icon->manager_window = XGetSelectionOwner (xdisplay,
icon->selection_atom);
if (icon->manager_window != None)
XSelectInput (xdisplay,
icon->manager_window, StructureNotifyMask|PropertyChangeMask);
XUngrabServer (xdisplay);
XFlush (xdisplay);
if (icon->manager_window != None)
{
GdkWindow *gdkwin;
gdkwin = gdk_window_lookup_for_display (gtk_widget_get_display (GTK_WIDGET (icon)),
icon->manager_window);
gdk_window_add_filter (gdkwin, egg_tray_icon_manager_filter, icon);
if (dock_if_realized && GTK_WIDGET_REALIZED (icon))
egg_tray_icon_send_dock_request (icon);
egg_tray_icon_get_orientation_property (icon);
}
}
static void
egg_tray_icon_manager_window_destroyed (EggTrayIcon *icon)
{
GdkWindow *gdkwin;
g_return_if_fail (icon->manager_window != None);
gdkwin = gdk_window_lookup_for_display (gtk_widget_get_display (GTK_WIDGET (icon)),
icon->manager_window);
gdk_window_remove_filter (gdkwin, egg_tray_icon_manager_filter, icon);
icon->manager_window = None;
egg_tray_icon_update_manager_window (icon, TRUE);
}
#endif
static gboolean
transparent_expose_event (GtkWidget *widget, GdkEventExpose *event, gpointer user_data)
{
gdk_window_clear_area (widget->window, event->area.x, event->area.y,
event->area.width, event->area.height);
return FALSE;
}
static void
make_transparent_again (GtkWidget *widget, GtkStyle *previous_style,
gpointer user_data)
{
gdk_window_set_back_pixmap (widget->window, NULL, TRUE);
}
static void
make_transparent (GtkWidget *widget, gpointer user_data)
{
if (GTK_WIDGET_NO_WINDOW (widget) || GTK_WIDGET_APP_PAINTABLE (widget))
return;
gtk_widget_set_app_paintable (widget, TRUE);
gtk_widget_set_double_buffered (widget, FALSE);
gdk_window_set_back_pixmap (widget->window, NULL, TRUE);
g_signal_connect (widget, "expose_event",
G_CALLBACK (transparent_expose_event), NULL);
g_signal_connect_after (widget, "style_set",
G_CALLBACK (make_transparent_again), NULL);
}
static void
egg_tray_icon_realize (GtkWidget *widget)
{
#ifdef GDK_WINDOWING_X11
EggTrayIcon *icon = EGG_TRAY_ICON (widget);
GdkScreen *screen;
GdkDisplay *display;
Display *xdisplay;
char buffer[256];
GdkWindow *root_window;
if (GTK_WIDGET_CLASS (parent_class)->realize)
GTK_WIDGET_CLASS (parent_class)->realize (widget);
make_transparent (widget, NULL);
screen = gtk_widget_get_screen (widget);
display = gdk_screen_get_display (screen);
xdisplay = gdk_x11_display_get_xdisplay (display);
/* Now see if there's a manager window around */
g_snprintf (buffer, sizeof (buffer),
"_NET_SYSTEM_TRAY_S%d",
gdk_screen_get_number (screen));
icon->selection_atom = XInternAtom (xdisplay, buffer, False);
icon->manager_atom = XInternAtom (xdisplay, "MANAGER", False);
icon->system_tray_opcode_atom = XInternAtom (xdisplay,
"_NET_SYSTEM_TRAY_OPCODE",
False);
icon->orientation_atom = XInternAtom (xdisplay,
"_NET_SYSTEM_TRAY_ORIENTATION",
False);
egg_tray_icon_update_manager_window (icon, FALSE);
egg_tray_icon_send_dock_request (icon);
root_window = gdk_screen_get_root_window (screen);
/* Add a root window filter so that we get changes on MANAGER */
gdk_window_add_filter (root_window,
egg_tray_icon_manager_filter, icon);
#endif
}
static void
egg_tray_icon_add (GtkContainer *container, GtkWidget *widget)
{
g_signal_connect (widget, "realize",
G_CALLBACK (make_transparent), NULL);
GTK_CONTAINER_CLASS (parent_class)->add (container, widget);
}
EggTrayIcon *
egg_tray_icon_new_for_screen (GdkScreen *screen, const char *name)
{
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
return g_object_new (EGG_TYPE_TRAY_ICON, "screen", screen, "title", name, NULL);
}
EggTrayIcon*
egg_tray_icon_new (const gchar *name)
{
return g_object_new (EGG_TYPE_TRAY_ICON, "title", name, NULL);
}
guint
egg_tray_icon_send_message (EggTrayIcon *icon,
gint timeout,
const gchar *message,
gint len)
{
guint stamp;
g_return_val_if_fail (EGG_IS_TRAY_ICON (icon), 0);
g_return_val_if_fail (timeout >= 0, 0);
g_return_val_if_fail (message != NULL, 0);
#ifdef GDK_WINDOWING_X11
if (icon->manager_window == None)
return 0;
#endif
if (len < 0)
len = strlen (message);
stamp = icon->stamp++;
#ifdef GDK_WINDOWING_X11
/* Get ready to send the message */
egg_tray_icon_send_manager_message (icon, SYSTEM_TRAY_BEGIN_MESSAGE,
(Window)gtk_plug_get_id (GTK_PLUG (icon)),
timeout, len, stamp);
/* Now to send the actual message */
gdk_error_trap_push ();
while (len > 0)
{
XClientMessageEvent ev;
Display *xdisplay;
xdisplay = GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (GTK_WIDGET (icon)));
ev.type = ClientMessage;
ev.window = (Window)gtk_plug_get_id (GTK_PLUG (icon));
ev.format = 8;
ev.message_type = XInternAtom (xdisplay,
"_NET_SYSTEM_TRAY_MESSAGE_DATA", False);
if (len > 20)
{
memcpy (&ev.data, message, 20);
len -= 20;
message += 20;
}
else
{
memcpy (&ev.data, message, len);
len = 0;
}
XSendEvent (xdisplay,
icon->manager_window, False, StructureNotifyMask, (XEvent *)&ev);
XSync (xdisplay, False);
}
gdk_error_trap_pop ();
#endif
return stamp;
}
void
egg_tray_icon_cancel_message (EggTrayIcon *icon,
guint id)
{
g_return_if_fail (EGG_IS_TRAY_ICON (icon));
g_return_if_fail (id > 0);
#ifdef GDK_WINDOWING_X11
egg_tray_icon_send_manager_message (icon, SYSTEM_TRAY_CANCEL_MESSAGE,
(Window)gtk_plug_get_id (GTK_PLUG (icon)),
id, 0, 0);
#endif
}
GtkOrientation
egg_tray_icon_get_orientation (EggTrayIcon *icon)
{
g_return_val_if_fail (EGG_IS_TRAY_ICON (icon), GTK_ORIENTATION_HORIZONTAL);
return icon->orientation;
}

View file

@ -1,80 +0,0 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/* eggtrayicon.h
* Copyright (C) 2002 Anders Carlsson <andersca@gnu.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __EGG_TRAY_ICON_H__
#define __EGG_TRAY_ICON_H__
#include <gtk/gtkplug.h>
#ifdef GDK_WINDOWING_X11
#include <gdk/gdkx.h>
#endif
G_BEGIN_DECLS
#define EGG_TYPE_TRAY_ICON (egg_tray_icon_get_type ())
#define EGG_TRAY_ICON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EGG_TYPE_TRAY_ICON, EggTrayIcon))
#define EGG_TRAY_ICON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EGG_TYPE_TRAY_ICON, EggTrayIconClass))
#define EGG_IS_TRAY_ICON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EGG_TYPE_TRAY_ICON))
#define EGG_IS_TRAY_ICON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EGG_TYPE_TRAY_ICON))
#define EGG_TRAY_ICON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EGG_TYPE_TRAY_ICON, EggTrayIconClass))
typedef struct _EggTrayIcon EggTrayIcon;
typedef struct _EggTrayIconClass EggTrayIconClass;
struct _EggTrayIcon
{
GtkPlug parent_instance;
guint stamp;
#ifdef GDK_WINDOWING_X11
Atom selection_atom;
Atom manager_atom;
Atom system_tray_opcode_atom;
Atom orientation_atom;
Window manager_window;
#endif
GtkOrientation orientation;
};
struct _EggTrayIconClass
{
GtkPlugClass parent_class;
};
GType egg_tray_icon_get_type (void);
EggTrayIcon *egg_tray_icon_new_for_screen (GdkScreen *screen,
const gchar *name);
EggTrayIcon *egg_tray_icon_new (const gchar *name);
guint egg_tray_icon_send_message (EggTrayIcon *icon,
gint timeout,
const char *message,
gint len);
void egg_tray_icon_cancel_message (EggTrayIcon *icon,
guint id);
GtkOrientation egg_tray_icon_get_orientation (EggTrayIcon *icon);
G_END_DECLS
#endif /* __EGG_TRAY_ICON_H__ */

View file

@ -1,120 +0,0 @@
/* NetworkManager -- Network link manager
*
* Dan Williams <dcbw@redhat.com>
*
* 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 <gconf/gconf.h>
#include <gconf/gconf-client.h>
#include <glib.h>
#include "gconf-helpers.h"
gboolean
nm_gconf_get_int_helper (GConfClient *client,
const char *path,
const char *key,
const char *network,
int *value)
{
char * gc_key;
GConfValue * gc_value;
gboolean success = FALSE;
g_return_val_if_fail (key != NULL, FALSE);
g_return_val_if_fail (network != NULL, FALSE);
g_return_val_if_fail (value != NULL, FALSE);
gc_key = g_strdup_printf ("%s/%s/%s", path, network, key);
if ((gc_value = gconf_client_get (client, gc_key, NULL)))
{
if (gc_value->type == GCONF_VALUE_INT)
{
*value = gconf_value_get_int (gc_value);
success = TRUE;
}
gconf_value_free (gc_value);
}
g_free (gc_key);
return success;
}
gboolean
nm_gconf_get_string_helper (GConfClient *client,
const char *path,
const char *key,
const char *network,
char **value)
{
char * gc_key;
GConfValue * gc_value;
gboolean success = FALSE;
g_return_val_if_fail (key != NULL, FALSE);
g_return_val_if_fail (network != NULL, FALSE);
g_return_val_if_fail (value != NULL, FALSE);
g_return_val_if_fail (*value == NULL, FALSE);
gc_key = g_strdup_printf ("%s/%s/%s", path, network, key);
if ((gc_value = gconf_client_get (client, gc_key, NULL)))
{
if (gc_value->type == GCONF_VALUE_STRING)
{
*value = g_strdup (gconf_value_get_string (gc_value));
success = TRUE;
}
gconf_value_free (gc_value);
}
g_free (gc_key);
return success;
}
gboolean
nm_gconf_get_bool_helper (GConfClient *client,
const char *path,
const char *key,
const char *network,
gboolean *value)
{
char * gc_key;
GConfValue * gc_value;
gboolean success = FALSE;
g_return_val_if_fail (key != NULL, FALSE);
g_return_val_if_fail (network != NULL, FALSE);
g_return_val_if_fail (value != NULL, FALSE);
gc_key = g_strdup_printf ("%s/%s/%s", path, network, key);
if ((gc_value = gconf_client_get (client, gc_key, NULL)))
{
if (gc_value->type == GCONF_VALUE_BOOL)
{
*value = gconf_value_get_bool (gc_value);
success = TRUE;
}
gconf_value_free (gc_value);
}
g_free (gc_key);
return success;
}

View file

@ -1,51 +0,0 @@
/* NetworkManager -- Network link manager
*
* Dan Williams <dcbw@redhat.com>
*
* 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 GCONF_HELPERS_H
#define GCONF_HELPERS_H
#include <gconf/gconf-client.h>
#include <glib.h>
gboolean
nm_gconf_get_int_helper (GConfClient *client,
const char *path,
const char *key,
const char *network,
int *value);
gboolean
nm_gconf_get_string_helper (GConfClient *client,
const char *path,
const char *key,
const char *network,
char **value);
gboolean
nm_gconf_get_bool_helper (GConfClient *client,
const char *path,
const char *key,
const char *network,
gboolean *value);
#endif /* GCONF_HELPERS_H */

View file

@ -1,2 +0,0 @@
Makefile
Makefile.in

View file

@ -1,70 +0,0 @@
NULL =
largeicondir=${datadir}/icons/hicolor/48x48/apps
largeicon_DATA=\
nm-device-wireless.png
smallicondir=${datadir}/icons/hicolor/22x22/apps
smallicon_DATA= \
nm-no-connection.png\
nm-device-wired.png \
nm-adhoc.png \
nm-stage01-connecting01.png \
nm-stage01-connecting02.png \
nm-stage01-connecting03.png \
nm-stage01-connecting04.png \
nm-stage01-connecting05.png \
nm-stage01-connecting06.png \
nm-stage01-connecting07.png \
nm-stage01-connecting08.png \
nm-stage01-connecting09.png \
nm-stage01-connecting10.png \
nm-stage01-connecting11.png \
nm-stage02-connecting01.png \
nm-stage02-connecting02.png \
nm-stage02-connecting03.png \
nm-stage02-connecting04.png \
nm-stage02-connecting05.png \
nm-stage02-connecting06.png \
nm-stage02-connecting07.png \
nm-stage02-connecting08.png \
nm-stage02-connecting09.png \
nm-stage02-connecting10.png \
nm-stage02-connecting11.png \
nm-stage03-connecting01.png \
nm-stage03-connecting02.png \
nm-stage03-connecting03.png \
nm-stage03-connecting04.png \
nm-stage03-connecting05.png \
nm-stage03-connecting06.png \
nm-stage03-connecting07.png \
nm-stage03-connecting08.png \
nm-stage03-connecting09.png \
nm-stage03-connecting10.png \
nm-stage03-connecting11.png \
nm-signal-00.png \
nm-signal-25.png \
nm-signal-50.png \
nm-signal-75.png \
nm-signal-100.png \
nm-vpn-connecting01.png \
nm-vpn-connecting02.png \
nm-vpn-connecting03.png \
nm-vpn-connecting04.png \
nm-vpn-connecting05.png \
nm-vpn-connecting06.png \
nm-vpn-connecting07.png \
nm-vpn-connecting08.png \
nm-vpn-connecting09.png \
nm-vpn-connecting10.png \
nm-vpn-connecting11.png \
nm-vpn-connecting12.png \
nm-vpn-connecting13.png \
nm-vpn-connecting14.png \
nm-vpn-lock.png \
$(NULL)
EXTRA_DIST=\
$(largeicon_DATA) \
$(smallicon_DATA)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 748 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 658 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 743 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 760 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 746 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 627 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 800 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 751 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 802 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 780 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 827 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 774 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 812 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 806 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 794 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 923 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 787 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 878 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 174 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 183 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 191 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 213 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 235 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 245 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 247 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 253 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 259 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 256 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 252 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 244 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 490 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 409 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 496 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 492 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 470 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 890 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 981 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Some files were not shown because too many files have changed in this diff Show more