NetworkManager/gnome/applet/applet.h
Dan Williams bb36e068ba 2005-06-09 Dan Williams <dcbw@redhat.com>
* NetworkManager.h
		- Add NMWirelessScanMethod enum for scan methods

	* gnome/applet/applet-dbus-devices.c
		- (nmwa_dbus_update_scanning_enabled_cb): remove
		- (nmwa_dbus_update_scanning_enabled): remove
		- (nmwa_dbus_update_devices): don't call nmwa_dbus_update_scanning_enabled() anymore
			since it got removed
		- (nmwa_dbus_enable_scanning): remove

	* gnome/applet/applet-dbus-info.c
		- (nmi_dbus_signal_update_scan_method): new function, signal NetworkManager to
			update the wireless scanning method from NMI
		- (nmi_dbus_get_wireless_scan_method): new function, return wireless scanning
			method value to NetworkManager
		- (nmi_dbus_info_message_handler): respond to the "getWirelessScanMethod" method call

	* gnome/applet/applet-dbus-info.h
		- Add prototype for nmi_dbus_signal_update_scan_method

	* gnome/applet/applet.c
		- (scanning_menu_update): new function, update one GtkCheckMenuItem from the
			Wireless Scanning menu based on current wireless scan method
		- (nmwa_menu_scanning_item_activate): new function, callback for GTK "activate"
			signal for Wireless Scanning menu items, tell NetworkManager the new method
			and update our menu items to make sure the right one is checked
		- (nmwa_set_scanning_enabled_cb): remove
		- (nmwa_context_menu_update): remove references to pause_scanning_item
		- (nmwa_context_menu_create): remove pause_scanning_item, and add new Wireless
			Scanning menu item
		- (nmwa_gconf_get_wireless_scan_method): new method, pull wireless scanning method
			from GConf
		- nmwa_gconf_networks_notify_callback -> nmwa_gconf_info_notify_callback: generalize
			so we get notified of preference values too
		- (nmwa_get_instance): monitor GCONF_PATH_WIRELESS rather than GCONF_PATH_WIRELESS_NETWORKS

	* gnome/applet/applet.h
		- GCONF_PATH_WIRELESS added, one level below GCONF_PATH_WIRELESS_NETWORKS
		- Add wireless scan method member to applet data
		- Remove pause_scanning_item, add Wireless Scanning submenu

	* src/NetworkManager.c
		- (nm_data_new): default to NM_SCAN_METHOD_ON
		- (main): grab scanning method from NMI if we can

	* src/NetworkManagerDbus.c
		- (nm_dbus_update_wireless_scan_method_cb): new function, callback from
			nm_dbus_update_wireless_scan_method()
		- (nm_dbus_update_wireless_scan_method): new function to grab scanning method
			from NMI
		- (nm_dbus_nmi_is_running): redundant function, removed
		- (nm_dbus_signal_filter): trap "WirelessScanMethodUpdate" signal, grab scanning method
			when NMI comes back

	* src/NetworkManagerDevice.c
		- (nm_device_is_activated): return TRUE if the device is activated
		- (nm_device_wireless_scan): don't scan if the scan method is OFF, or if its AUTO
			and we are activated

	* src/nm-dbus-nm.c
		- (nm_dbus_nm_set_scanning_enabled): removed
		- nm_dbus_nm_get_scanning_enabled -> nm_dbus_nm_get_wireless_scan_method
		- (nm_dbus_nm_methods_setup): remove [get | set] ScanningEnabled and add "getWirelessScanMethod"


git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@658 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2005-06-10 03:13:27 +00:00

161 lines
4.9 KiB
C

/* 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
#include <gtk/gtk.h>
#include <gconf/gconf-client.h>
#include <glade/glade.h>
#include <dbus/dbus.h>
#include <dbus/dbus-glib.h>
#include "eggtrayicon.h"
#include <net/ethernet.h>
#include "nm-device.h"
#include "wireless-network.h"
/*
* 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_WIRELESS_APPLET (nmwa_get_type())
#define NM_WIRELESS_APPLET(object) (G_TYPE_CHECK_INSTANCE_CAST((object), NM_TYPE_WIRELESS_APPLET, NMWirelessApplet))
#define NM_WIRELESS_APPLET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), NM_TYPE_WIRELESS_APPLET, NMWirelessAppletClass))
#define NM_IS_WIRELESS_APPLET(object) (G_TYPE_CHECK_INSTANCE_TYPE((object), NM_TYPE_WIRELESS_APPLET))
#define NM_IS_WIRELESS_APPLET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), NM_TYPE_WIRELESS_APPLET))
#define NM_WIRELESS_APPLET_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS((object), NM_TYPE_WIRELESS_APPLET, NMWirelessAppletClass))
typedef struct
{
EggTrayIconClass parent_class;
} NMWirelessAppletClass;
/*
* Applet instance data
*
*/
typedef struct
{
EggTrayIcon parent;
DBusConnection * connection;
GConfClient * gconf_client;
guint gconf_prefs_notify_id;
guint gconf_vpn_notify_id;
char * glade_file;
guint redraw_timeout_id;
/* dbus thread stuff */
GThread * dbus_thread;
GMainContext * thread_context;
GMainLoop * thread_loop;
gboolean thread_done;
/* Data model elements */
GMutex * data_mutex;
gboolean is_adhoc;
NMWirelessScanMethod scan_method;
gboolean wireless_enabled;
gboolean nm_running;
GSList * gui_device_list;
NMState gui_nm_state;
GSList * dev_pending_call_list;
GSList * dbus_device_list;
NMState dbus_nm_state;
GSList * gui_vpn_connections;
VPNConnection * gui_active_vpn;
GSList * vpn_pending_call_list;
char * dbus_active_vpn_name;
GSList * dbus_vpn_connections;
GdkPixbuf * no_connection_icon;
GdkPixbuf * wired_icon;
GdkPixbuf * adhoc_icon;
#define NUM_PROGRESS_FRAMES 11
GdkPixbuf * progress_icons[NUM_PROGRESS_FRAMES];
#define NUM_WIRED_CONNECTING_FRAMES 11
GdkPixbuf * wired_connecting_icons[NUM_WIRED_CONNECTING_FRAMES];
GdkPixbuf * wireless_00_icon;
GdkPixbuf * wireless_25_icon;
GdkPixbuf * wireless_50_icon;
GdkPixbuf * wireless_75_icon;
GdkPixbuf * wireless_100_icon;
#define NUM_WIRELESS_CONNECTING_FRAMES 11
GdkPixbuf * wireless_connecting_icons[NUM_WIRELESS_CONNECTING_FRAMES];
GdkPixbuf * vpn_lock_icon;
/* Animation stuff */
int animation_step;
guint animation_id;
/* Direct UI elements */
GtkWidget * icon_box;
GtkWidget * pixmap;
GtkWidget * progress_bar;
GtkWidget * top_menu_item;
GtkWidget * dropdown_menu;
GtkWidget * vpn_menu;
GtkWidget * event_box;
GtkSizeGroup * encryption_size_group;
GtkTooltips * tooltips;
GtkWidget * context_menu;
GtkWidget * scanning_item;
GtkWidget * scanning_menu;
GtkWidget * stop_wireless_item;
GtkWidget * passphrase_dialog;
} NMWirelessApplet;
typedef struct
{
NMWirelessApplet * applet;
NetworkDevice * dev;
GladeXML * xml;
} DriverNotifyCBData;
NetworkDevice * nmwa_get_device_for_nm_path (GSList *dev_list, const char *nm_dev);
NMWirelessApplet * nmwa_new (void);
void nmwa_schedule_warning_dialog (NMWirelessApplet *applet, const char *msg);
gboolean nmwa_driver_notify (gpointer user_data);
void nmwa_schedule_vpn_failure_dialog (NMWirelessApplet *applet, const char *member, const char *vpn_name, const char *error_msg);
void nmwa_schedule_vpn_login_banner_dialog (NMWirelessApplet *applet, const char *vpn_name, const char *banner);
NetworkDevice * nmwa_get_first_active_device (GSList *dev_list);
NMWirelessScanMethod nmwa_gconf_get_wireless_scan_method (NMWirelessApplet *applet);
int nm_null_safe_strcmp (const char *s1, const char *s2);
#endif