mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-04 05:10:17 +01:00
2005-05-14 Dan Williams <dcbw@redhat.com>
* NetworkManager.h - Add signals for VPN Launch and Connect failures * gnome/applet/applet-dbus.c - (nmwa_dbus_filter): Trap new VPN launch & connect failure signals * gnome/applet/applet.c - (nmwa_show_vpn_failure_dialog): generalize old nmwa_show_vpn_login_failure_dialog() function to handle all VPN failure messages - (nmwa_schedule_vpn_failure_dialog): generalize old nmwa_schedule_vpn_login_failure_dialog() function to hanlde all VPN failure messages - (show_warning_dialog): work around focus-stealing prevention * gnome/applet/other-network-dialog.c gnome/applet/passphrase-dialog.c - (update_button_cb): Make sure the OK button is enabled when it should be, fixes problem where it never enabled for ASCII Key and Hex Key types * gnome/applet/wireless-applet.glade - Add window title to Other Wireless Network Dialog * src/vpn-manager/nm-dbus-vpn.c - (nm_dbus_vpn_signal_vpn_failed): generalize old nm_dbus_vpn_signal_vpn_login_failed() function to handle all VPN failure messages * src/vpn-manager/nm-vpn-manager.c - (nm_vpn_manager_process_signal): trap and proxy VPN launch & connect failure signals too * vpn-daemons/vpnc/nm-vpnc-service.c - (nm_vpnc_dbus_signal_launch_failed): new function - (nm_vpnc_dbus_signal_connect_failed): new function - (nm_vpnc_helper_timer_cb): signal connect failure on timeout - (vpnc_watch_cb): signal connection failure when vpnc exits with connection failure - (nm_vpnc_start_vpnc_binary): search a number of locations for vpnc - (nm_vpnc_dbus_handle_start): send launch failure signal when we fail to launch vpnc git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@627 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
parent
8ae89f4f18
commit
21bdc07fa8
12 changed files with 327 additions and 102 deletions
38
ChangeLog
38
ChangeLog
|
|
@ -1,3 +1,41 @@
|
|||
2005-05-14 Dan Williams <dcbw@redhat.com>
|
||||
|
||||
* NetworkManager.h
|
||||
- Add signals for VPN Launch and Connect failures
|
||||
|
||||
* gnome/applet/applet-dbus.c
|
||||
- (nmwa_dbus_filter): Trap new VPN launch & connect failure signals
|
||||
|
||||
* gnome/applet/applet.c
|
||||
- (nmwa_show_vpn_failure_dialog): generalize old nmwa_show_vpn_login_failure_dialog()
|
||||
function to handle all VPN failure messages
|
||||
- (nmwa_schedule_vpn_failure_dialog): generalize old nmwa_schedule_vpn_login_failure_dialog()
|
||||
function to hanlde all VPN failure messages
|
||||
- (show_warning_dialog): work around focus-stealing prevention
|
||||
|
||||
* gnome/applet/other-network-dialog.c
|
||||
gnome/applet/passphrase-dialog.c
|
||||
- (update_button_cb): Make sure the OK button is enabled when it should be, fixes
|
||||
problem where it never enabled for ASCII Key and Hex Key types
|
||||
|
||||
* gnome/applet/wireless-applet.glade
|
||||
- Add window title to Other Wireless Network Dialog
|
||||
|
||||
* src/vpn-manager/nm-dbus-vpn.c
|
||||
- (nm_dbus_vpn_signal_vpn_failed): generalize old nm_dbus_vpn_signal_vpn_login_failed()
|
||||
function to handle all VPN failure messages
|
||||
|
||||
* src/vpn-manager/nm-vpn-manager.c
|
||||
- (nm_vpn_manager_process_signal): trap and proxy VPN launch & connect failure signals too
|
||||
|
||||
* vpn-daemons/vpnc/nm-vpnc-service.c
|
||||
- (nm_vpnc_dbus_signal_launch_failed): new function
|
||||
- (nm_vpnc_dbus_signal_connect_failed): new function
|
||||
- (nm_vpnc_helper_timer_cb): signal connect failure on timeout
|
||||
- (vpnc_watch_cb): signal connection failure when vpnc exits with connection failure
|
||||
- (nm_vpnc_start_vpnc_binary): search a number of locations for vpnc
|
||||
- (nm_vpnc_dbus_handle_start): send launch failure signal when we fail to launch vpnc
|
||||
|
||||
2005-05-11 Dan Williams <dcbw@redhat.com>
|
||||
|
||||
* vpn-daemons/vpnc/nm-vpnc-service.c
|
||||
|
|
|
|||
|
|
@ -64,7 +64,10 @@
|
|||
/*
|
||||
* VPN daemon signals
|
||||
*/
|
||||
#define NM_DBUS_VPN_SIGNAL_LOGIN_BANNER "LoginBanner"
|
||||
#define NM_DBUS_VPN_SIGNAL_LOGIN_FAILED "LoginFailed"
|
||||
#define NM_DBUS_VPN_SIGNAL_LAUNCH_FAILED "LaunchFailed"
|
||||
#define NM_DBUS_VPN_SIGNAL_CONNECT_FAILED "ConnectFailed"
|
||||
#define NM_DBUS_VPN_SIGNAL_CONFIG_BAD "ConfigurationBad"
|
||||
#define NM_DBUS_VPN_SIGNAL_STATE_CHANGE "StateChange"
|
||||
#define NM_DBUS_VPN_SIGNAL_IP4_CONFIG "IP4Config"
|
||||
|
|
|
|||
|
|
@ -544,15 +544,17 @@ static DBusHandlerResult nmwa_dbus_filter (DBusConnection *connection, DBusMessa
|
|||
nmwa_dbus_device_update_one_network (applet, dev_path, net_path, NULL);
|
||||
}
|
||||
}
|
||||
else if (dbus_message_is_signal (message, NM_DBUS_INTERFACE_VPN, "VPNLoginFailed"))
|
||||
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))
|
||||
{
|
||||
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))
|
||||
nmwa_schedule_vpn_login_failure_dialog (applet, vpn_name, error_msg);
|
||||
nmwa_schedule_vpn_failure_dialog (applet, member, vpn_name, error_msg);
|
||||
}
|
||||
else if (dbus_message_is_signal (message, NM_DBUS_INTERFACE_VPN, "VPNLoginBanner"))
|
||||
else if (dbus_message_is_signal (message, NM_DBUS_INTERFACE_VPN, NM_DBUS_VPN_SIGNAL_LOGIN_BANNER))
|
||||
{
|
||||
char *vpn_name;
|
||||
char *banner;
|
||||
|
|
|
|||
|
|
@ -222,14 +222,30 @@ void nmwa_about_cb (NMWirelessApplet *applet)
|
|||
}
|
||||
|
||||
|
||||
static void vpn_login_failure_dialog_close_cb (GtkWidget *dialog, gpointer user_data)
|
||||
typedef struct DialogCBData
|
||||
{
|
||||
char *message;
|
||||
char *msg;
|
||||
char *title;
|
||||
} DialogCBData;
|
||||
|
||||
if ((message = g_object_get_data (G_OBJECT (dialog), "message")))
|
||||
static void free_dialog_cb_data (DialogCBData *data)
|
||||
{
|
||||
g_return_if_fail (data != NULL);
|
||||
|
||||
g_free (data->msg);
|
||||
g_free (data->title);
|
||||
memset (data, 0, sizeof (DialogCBData));
|
||||
g_free (data);
|
||||
}
|
||||
|
||||
static void vpn_failure_dialog_close_cb (GtkWidget *dialog, gpointer user_data)
|
||||
{
|
||||
DialogCBData *data;
|
||||
|
||||
if ((data = g_object_get_data (G_OBJECT (dialog), "data")))
|
||||
{
|
||||
g_object_set_data (G_OBJECT (dialog), "message", NULL);
|
||||
g_free (message);
|
||||
g_object_set_data (G_OBJECT (dialog), "data", NULL);
|
||||
free_dialog_cb_data (data);
|
||||
}
|
||||
|
||||
gtk_widget_destroy (dialog);
|
||||
|
|
@ -237,22 +253,25 @@ static void vpn_login_failure_dialog_close_cb (GtkWidget *dialog, gpointer user_
|
|||
|
||||
|
||||
/*
|
||||
* nmwa_show_vpn_login_failure_dialog
|
||||
* nmwa_show_vpn_failure_dialog
|
||||
*
|
||||
* Present the VPN login failure dialog.
|
||||
* Present the VPN failure dialog.
|
||||
*
|
||||
*/
|
||||
static gboolean nmwa_show_vpn_login_failure_dialog (char *message)
|
||||
static gboolean nmwa_show_vpn_failure_dialog (DialogCBData *cb_data)
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
guint32 timestamp;
|
||||
|
||||
g_return_val_if_fail (message != NULL, FALSE);
|
||||
g_return_val_if_fail (cb_data != NULL, FALSE);
|
||||
g_return_val_if_fail (cb_data->msg != NULL, FALSE);
|
||||
g_return_val_if_fail (cb_data->title != NULL, FALSE);
|
||||
|
||||
dialog = gtk_message_dialog_new_with_markup (NULL, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, message, NULL);
|
||||
g_signal_connect (dialog, "response", G_CALLBACK (vpn_login_failure_dialog_close_cb), NULL);
|
||||
g_signal_connect (dialog, "close", G_CALLBACK (vpn_login_failure_dialog_close_cb), NULL);
|
||||
g_object_set_data (G_OBJECT (dialog), "message", message);
|
||||
dialog = gtk_message_dialog_new_with_markup (NULL, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, cb_data->msg, NULL);
|
||||
gtk_window_set_title (GTK_WINDOW (dialog), cb_data->title);
|
||||
g_signal_connect (dialog, "response", G_CALLBACK (vpn_failure_dialog_close_cb), NULL);
|
||||
g_signal_connect (dialog, "close", G_CALLBACK (vpn_failure_dialog_close_cb), NULL);
|
||||
g_object_set_data (G_OBJECT (dialog), "data", cb_data);
|
||||
gtk_widget_show_all (dialog);
|
||||
|
||||
/* Bash focus-stealing prevention in the face */
|
||||
|
|
@ -264,22 +283,43 @@ static gboolean nmwa_show_vpn_login_failure_dialog (char *message)
|
|||
|
||||
|
||||
/*
|
||||
* nmwa_schedule_vpn_login_failure_dialog
|
||||
* nmwa_schedule_vpn_failure_dialog
|
||||
*
|
||||
* Schedule display of the VPN Login Failure dialog.
|
||||
* Schedule display of the VPN Failure dialog.
|
||||
*
|
||||
*/
|
||||
void nmwa_schedule_vpn_login_failure_dialog (NMWirelessApplet *applet, const char *vpn_name, const char *error_msg)
|
||||
void nmwa_schedule_vpn_failure_dialog (NMWirelessApplet *applet, const char *member, const char *vpn_name, const char *error_msg)
|
||||
{
|
||||
char *msg;
|
||||
DialogCBData *cb_data = NULL;
|
||||
|
||||
g_return_if_fail (applet != NULL);
|
||||
g_return_if_fail (member != NULL);
|
||||
g_return_if_fail (vpn_name != NULL);
|
||||
g_return_if_fail (error_msg != NULL);
|
||||
|
||||
msg = g_strdup_printf (_("<span weight=\"bold\" size=\"larger\">VPN Login Failure</span>\n\nCould not start the "
|
||||
cb_data = g_malloc0 (sizeof (DialogCBData));
|
||||
cb_data->title = g_strdup (_("VPN Error"));
|
||||
|
||||
if (!strcmp (member, NM_DBUS_VPN_SIGNAL_LOGIN_FAILED))
|
||||
{
|
||||
cb_data->msg = g_strdup_printf (_("<span weight=\"bold\" size=\"larger\">VPN Login Failure</span>\n\nCould not start the "
|
||||
"VPN connection '%s' due to a login failure.\n\nThe VPN service said: \"%s\""), vpn_name, error_msg);
|
||||
g_idle_add ((GSourceFunc) nmwa_show_vpn_login_failure_dialog, msg);
|
||||
}
|
||||
else if (!strcmp (member, NM_DBUS_VPN_SIGNAL_LAUNCH_FAILED))
|
||||
{
|
||||
cb_data->msg = g_strdup_printf (_("<span weight=\"bold\" size=\"larger\">VPN Start Failure</span>\n\nCould not start the "
|
||||
"VPN connection '%s' due to a failure launching the VPN program.\n\nThe VPN service said: \"%s\""), vpn_name, error_msg);
|
||||
}
|
||||
else if (!strcmp (member, NM_DBUS_VPN_SIGNAL_CONNECT_FAILED))
|
||||
{
|
||||
cb_data->msg = g_strdup_printf (_("<span weight=\"bold\" size=\"larger\">VPN Connect Failure</span>\n\nCould not start the "
|
||||
"VPN connection '%s' due to a connection error.\n\nThe VPN service said: \"%s\""), vpn_name, error_msg);
|
||||
}
|
||||
|
||||
if (cb_data->msg)
|
||||
g_idle_add ((GSourceFunc) nmwa_show_vpn_failure_dialog, cb_data);
|
||||
else
|
||||
free_dialog_cb_data (cb_data);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -897,13 +937,20 @@ static void nmwa_start_redraw_timeout (NMWirelessApplet *applet)
|
|||
* pop up a warning or error dialog with certain text
|
||||
*
|
||||
*/
|
||||
gboolean show_warning_dialog (gchar *mesg)
|
||||
gboolean show_warning_dialog (char *mesg)
|
||||
{
|
||||
GtkWidget * dialog;
|
||||
guint32 timestamp;
|
||||
|
||||
dialog = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, mesg, NULL);
|
||||
|
||||
/* Bash focus-stealing prevention in the face */
|
||||
timestamp = gdk_x11_get_server_time (dialog->window);
|
||||
gdk_x11_window_set_user_time (dialog->window, timestamp);
|
||||
|
||||
gtk_dialog_run (GTK_DIALOG (dialog));
|
||||
gtk_widget_destroy (dialog);
|
||||
g_free (mesg);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
|
@ -923,7 +970,7 @@ void nmwa_schedule_warning_dialog (NMWirelessApplet *applet, const char *msg)
|
|||
g_return_if_fail (msg != NULL);
|
||||
|
||||
lcl_msg = g_strdup (msg);
|
||||
g_idle_add ((GSourceFunc) nmwa_show_vpn_login_failure_dialog, lcl_msg);
|
||||
g_idle_add ((GSourceFunc) show_warning_dialog, lcl_msg);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ NetworkDevice * nmwa_get_device_for_nm_path (GSList *dev_list, const char *nm_
|
|||
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_login_failure_dialog (NMWirelessApplet *applet, const char *vpn_name, const char *error_msg);
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -52,11 +52,11 @@ enum NMWAEncryptionKeyTypes
|
|||
|
||||
static void update_button_cb (GtkWidget *widget, GladeXML *xml)
|
||||
{
|
||||
gboolean enable = TRUE;
|
||||
const char *text;
|
||||
GtkButton *button;
|
||||
GtkEntry *essid_entry;
|
||||
GtkCheckButton *enc_check_button;
|
||||
gboolean enable = FALSE;
|
||||
const char * text;
|
||||
GtkButton * button;
|
||||
GtkEntry * essid_entry;
|
||||
GtkCheckButton * enc_check_button;
|
||||
|
||||
g_return_if_fail (xml != NULL);
|
||||
|
||||
|
|
@ -64,36 +64,36 @@ static void update_button_cb (GtkWidget *widget, GladeXML *xml)
|
|||
button = GTK_BUTTON (glade_xml_get_widget (xml, "ok_button"));
|
||||
enc_check_button = GTK_CHECK_BUTTON (glade_xml_get_widget (xml, "use_encryption_checkbox"));
|
||||
|
||||
/* An ESSID is required */
|
||||
text = gtk_entry_get_text (essid_entry);
|
||||
if (text[0] == '\000')
|
||||
enable = FALSE;
|
||||
if (text && strlen (text) > 0)
|
||||
enable = TRUE;
|
||||
|
||||
/* If we're using encryptin, validate the settings */
|
||||
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (enc_check_button)))
|
||||
/* If we're using encryption, validate the settings */
|
||||
if (enable && gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (enc_check_button)))
|
||||
{
|
||||
GtkComboBox *combo = GTK_COMBO_BOX (glade_xml_get_widget (xml, "key_type_combo"));
|
||||
GtkEntry *passphrase_entry = GTK_ENTRY (glade_xml_get_widget (xml, "passphrase_entry"));
|
||||
const char *passphrase_text = gtk_entry_get_text (passphrase_entry);
|
||||
GtkComboBox * combo = GTK_COMBO_BOX (glade_xml_get_widget (xml, "key_type_combo"));
|
||||
GtkEntry * passphrase_entry = GTK_ENTRY (glade_xml_get_widget (xml, "passphrase_entry"));
|
||||
const char * passphrase_text = gtk_entry_get_text (passphrase_entry);
|
||||
|
||||
if (passphrase_text[0] == '\000')
|
||||
enable = FALSE;
|
||||
else
|
||||
enable = FALSE;
|
||||
switch (gtk_combo_box_get_active (combo))
|
||||
{
|
||||
int combo_choice = gtk_combo_box_get_active (combo);
|
||||
switch (combo_choice)
|
||||
{
|
||||
case KEY_TYPE_ASCII_KEY:
|
||||
if ((strlen (passphrase_text) != 5) && (strlen (passphrase_text) != 13))
|
||||
enable = FALSE;
|
||||
break;
|
||||
case KEY_TYPE_HEX_KEY:
|
||||
if ((strlen (passphrase_text) != 10) && (strlen (passphrase_text) != 26))
|
||||
enable = FALSE;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
case KEY_TYPE_128_BIT_PASSPHRASE:
|
||||
if (strlen (passphrase_text) > 0)
|
||||
enable = TRUE;
|
||||
break;
|
||||
case KEY_TYPE_ASCII_KEY:
|
||||
if ((strlen (passphrase_text) == 5) || (strlen (passphrase_text) == 13))
|
||||
enable = TRUE;
|
||||
break;
|
||||
case KEY_TYPE_HEX_KEY:
|
||||
if ((strlen (passphrase_text) == 10) || (strlen (passphrase_text) == 26))
|
||||
enable = TRUE;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (button), enable);
|
||||
|
|
|
|||
|
|
@ -59,11 +59,11 @@ static GladeXML *get_dialog_xml (GtkWidget *dialog)
|
|||
|
||||
static void update_button_cb (GtkWidget *widget, GladeXML *xml)
|
||||
{
|
||||
GtkButton *button;
|
||||
GtkComboBox *combo;
|
||||
GtkEntry *passphrase_entry;
|
||||
const char *passphrase_text;
|
||||
gboolean enable = TRUE;
|
||||
GtkButton * button;
|
||||
GtkComboBox * combo;
|
||||
GtkEntry * passphrase_entry;
|
||||
const char * passphrase_text;
|
||||
gboolean enable = FALSE;
|
||||
|
||||
g_return_if_fail (xml != NULL);
|
||||
|
||||
|
|
@ -72,25 +72,23 @@ static void update_button_cb (GtkWidget *widget, GladeXML *xml)
|
|||
passphrase_entry = GTK_ENTRY (glade_xml_get_widget (xml, "passphrase_entry"));
|
||||
passphrase_text = gtk_entry_get_text (passphrase_entry);
|
||||
|
||||
if (passphrase_text[0] == '\000')
|
||||
enable = FALSE;
|
||||
else
|
||||
switch (gtk_combo_box_get_active (combo))
|
||||
{
|
||||
int combo_choice = gtk_combo_box_get_active (combo);
|
||||
switch (combo_choice)
|
||||
{
|
||||
case KEY_TYPE_ASCII_KEY:
|
||||
if ((strlen (passphrase_text) != 5) && (strlen (passphrase_text) != 13))
|
||||
enable = FALSE;
|
||||
break;
|
||||
case KEY_TYPE_HEX_KEY:
|
||||
if ((strlen (passphrase_text) != 10) && (strlen (passphrase_text) != 26))
|
||||
enable = FALSE;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
case KEY_TYPE_128_BIT_PASSPHRASE:
|
||||
if (strlen (passphrase_text) > 0)
|
||||
enable = TRUE;
|
||||
break;
|
||||
case KEY_TYPE_ASCII_KEY:
|
||||
if ((strlen (passphrase_text) == 5) || (strlen (passphrase_text) == 13))
|
||||
enable = TRUE;
|
||||
break;
|
||||
case KEY_TYPE_HEX_KEY:
|
||||
if ((strlen (passphrase_text) == 10) || (strlen (passphrase_text) == 26))
|
||||
enable = TRUE;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (button), enable);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
<property name="skip_pager_hint">False</property>
|
||||
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
|
||||
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
|
||||
<property name="focus_on_map">True</property>
|
||||
<property name="has_separator">False</property>
|
||||
|
||||
<child internal-child="vbox">
|
||||
|
|
@ -109,6 +110,10 @@ You have chosen log in to the wireless network '%s'. If you are sure this wirel
|
|||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
|
|
@ -166,6 +171,7 @@ You have chosen log in to the wireless network '%s'. If you are sure this wirel
|
|||
<property name="skip_pager_hint">False</property>
|
||||
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
|
||||
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
|
||||
<property name="focus_on_map">True</property>
|
||||
<property name="has_separator">False</property>
|
||||
|
||||
<child internal-child="vbox">
|
||||
|
|
@ -246,6 +252,10 @@ You have chosen log in to the wireless network '%s'. If you are sure this wirel
|
|||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
|
|
@ -293,7 +303,7 @@ You have chosen log in to the wireless network '%s'. If you are sure this wirel
|
|||
<widget class="GtkDialog" id="custom_essid_dialog">
|
||||
<property name="border_width">6</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="yes"></property>
|
||||
<property name="title" translatable="yes">Other Wireless Network...</property>
|
||||
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
||||
<property name="window_position">GTK_WIN_POS_NONE</property>
|
||||
<property name="modal">False</property>
|
||||
|
|
@ -305,6 +315,7 @@ You have chosen log in to the wireless network '%s'. If you are sure this wirel
|
|||
<property name="skip_pager_hint">False</property>
|
||||
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
|
||||
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
|
||||
<property name="focus_on_map">True</property>
|
||||
<property name="has_separator">False</property>
|
||||
|
||||
<child internal-child="vbox">
|
||||
|
|
@ -396,6 +407,10 @@ You have chosen log in to the wireless network '%s'. If you are sure this wirel
|
|||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
|
|
@ -427,6 +442,10 @@ You have chosen log in to the wireless network '%s'. If you are sure this wirel
|
|||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="mnemonic_widget">wireless_adapter_combo</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
|
|
@ -442,6 +461,8 @@ You have chosen log in to the wireless network '%s'. If you are sure this wirel
|
|||
<widget class="GtkComboBox" id="wireless_adapter_combo">
|
||||
<property name="visible">True</property>
|
||||
<property name="items" translatable="yes"></property>
|
||||
<property name="add_tearoffs">False</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
|
|
@ -467,6 +488,10 @@ You have chosen log in to the wireless network '%s'. If you are sure this wirel
|
|||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="mnemonic_widget">essid_entry</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
|
|
@ -487,7 +512,7 @@ You have chosen log in to the wireless network '%s'. If you are sure this wirel
|
|||
<property name="max_length">0</property>
|
||||
<property name="text" translatable="yes"></property>
|
||||
<property name="has_frame">True</property>
|
||||
<property name="invisible_char" translatable="yes">*</property>
|
||||
<property name="invisible_char">*</property>
|
||||
<property name="activates_default">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
|
|
@ -540,6 +565,10 @@ You have chosen log in to the wireless network '%s'. If you are sure this wirel
|
|||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
|
|
@ -564,6 +593,10 @@ You have chosen log in to the wireless network '%s'. If you are sure this wirel
|
|||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
|
|
@ -584,7 +617,7 @@ You have chosen log in to the wireless network '%s'. If you are sure this wirel
|
|||
<property name="max_length">0</property>
|
||||
<property name="text" translatable="yes"></property>
|
||||
<property name="has_frame">True</property>
|
||||
<property name="invisible_char" translatable="yes">*</property>
|
||||
<property name="invisible_char">*</property>
|
||||
<property name="activates_default">False</property>
|
||||
</widget>
|
||||
<packing>
|
||||
|
|
@ -602,6 +635,8 @@ You have chosen log in to the wireless network '%s'. If you are sure this wirel
|
|||
<property name="items" translatable="yes">128-bit passphrase (WEP)
|
||||
Ascii key (WEP)
|
||||
Hex key (WEP)</property>
|
||||
<property name="add_tearoffs">False</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
|
|
@ -681,6 +716,7 @@ Hex key (WEP)</property>
|
|||
<property name="skip_pager_hint">False</property>
|
||||
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
|
||||
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
|
||||
<property name="focus_on_map">True</property>
|
||||
<property name="has_separator">False</property>
|
||||
|
||||
<child internal-child="vbox">
|
||||
|
|
@ -773,6 +809,10 @@ A passphrase or encryption key is required to access the wireless network '%s'.<
|
|||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
|
|
@ -800,6 +840,10 @@ A passphrase or encryption key is required to access the wireless network '%s'.<
|
|||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
|
|
@ -814,6 +858,8 @@ A passphrase or encryption key is required to access the wireless network '%s'.<
|
|||
<property name="items" translatable="yes">128-bit Passphrase (WEP)
|
||||
Ascii Key (WEP)
|
||||
Hex Key (WEP)</property>
|
||||
<property name="add_tearoffs">False</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
|
|
@ -852,6 +898,10 @@ Hex Key (WEP)</property>
|
|||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
|
|
@ -870,7 +920,7 @@ Hex Key (WEP)</property>
|
|||
<property name="max_length">0</property>
|
||||
<property name="text" translatable="yes"></property>
|
||||
<property name="has_frame">True</property>
|
||||
<property name="invisible_char" translatable="yes">*</property>
|
||||
<property name="invisible_char">*</property>
|
||||
<property name="activates_default">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
|
|
|
|||
|
|
@ -92,21 +92,22 @@ void nm_dbus_vpn_signal_vpn_connection_change (DBusConnection *con, NMVPNConnect
|
|||
|
||||
|
||||
/*
|
||||
* nnm_dbus_vpn_signal_vpn_login_failed
|
||||
* nnm_dbus_vpn_signal_vpn_failure
|
||||
*
|
||||
* Pass the VPN Login Failure message from the daemon to the bus.
|
||||
* Proxy a VPN Failure message from the vpn daemon to the bus.
|
||||
*
|
||||
*/
|
||||
void nm_dbus_vpn_signal_vpn_login_failed (DBusConnection *con, NMVPNConnection *vpn, const char *error_msg)
|
||||
void nm_dbus_vpn_signal_vpn_failed (DBusConnection *con, const char *signal, NMVPNConnection *vpn, const char *error_msg)
|
||||
{
|
||||
DBusMessage *message;
|
||||
const char *vpn_name;
|
||||
|
||||
g_return_if_fail (con != NULL);
|
||||
g_return_if_fail (signal != NULL);
|
||||
g_return_if_fail (vpn != NULL);
|
||||
g_return_if_fail (error_msg != NULL);
|
||||
|
||||
if (!(message = dbus_message_new_signal (NM_DBUS_PATH_VPN, NM_DBUS_INTERFACE_VPN, "VPNLoginFailed")))
|
||||
if (!(message = dbus_message_new_signal (NM_DBUS_PATH_VPN, NM_DBUS_INTERFACE_VPN, signal)))
|
||||
{
|
||||
nm_warning ("Not enough memory for new dbus message!");
|
||||
return;
|
||||
|
|
@ -115,7 +116,7 @@ void nm_dbus_vpn_signal_vpn_login_failed (DBusConnection *con, NMVPNConnection *
|
|||
vpn_name = nm_vpn_connection_get_name (vpn);
|
||||
dbus_message_append_args (message, DBUS_TYPE_STRING, &vpn_name, DBUS_TYPE_STRING, &error_msg, DBUS_TYPE_INVALID);
|
||||
if (!dbus_connection_send (con, message, NULL))
|
||||
nm_warning ("Could not raise the VPNLoginFailed signal!");
|
||||
nm_warning ("Could not raise the %s signal!", signal);
|
||||
|
||||
dbus_message_unref (message);
|
||||
}
|
||||
|
|
@ -136,7 +137,7 @@ void nm_dbus_vpn_signal_vpn_login_banner (DBusConnection *con, NMVPNConnection *
|
|||
g_return_if_fail (vpn != NULL);
|
||||
g_return_if_fail (banner != NULL);
|
||||
|
||||
if (!(message = dbus_message_new_signal (NM_DBUS_PATH_VPN, NM_DBUS_INTERFACE_VPN, "VPNLoginBanner")))
|
||||
if (!(message = dbus_message_new_signal (NM_DBUS_PATH_VPN, NM_DBUS_INTERFACE_VPN, NM_DBUS_VPN_SIGNAL_LOGIN_BANNER)))
|
||||
{
|
||||
nm_warning ("Not enough memory for new dbus message!");
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ void nm_dbus_vpn_update_one_vpn_connection (DBusConnection *connection, cons
|
|||
|
||||
void nm_dbus_vpn_signal_vpn_connection_update (DBusConnection *con, NMVPNConnection *vpn, const char *signal);
|
||||
void nm_dbus_vpn_signal_vpn_connection_change (DBusConnection *con, NMVPNConnection *vpn);
|
||||
void nm_dbus_vpn_signal_vpn_login_failed (DBusConnection *con, NMVPNConnection *vpn, const char *error_msg);
|
||||
void nm_dbus_vpn_signal_vpn_failed (DBusConnection *con, const char *signal, NMVPNConnection *vpn, const char *error_msg);
|
||||
void nm_dbus_vpn_signal_vpn_login_banner (DBusConnection *con, NMVPNConnection *vpn, const char *banner);
|
||||
|
||||
NMDbusMethodList * nm_dbus_vpn_methods_setup (void);
|
||||
|
|
|
|||
|
|
@ -527,11 +527,12 @@ static char *construct_op_from_service_name (const char *service_name)
|
|||
*/
|
||||
gboolean nm_vpn_manager_process_signal (NMVPNManager *manager, DBusMessage *message)
|
||||
{
|
||||
const char *object_path;
|
||||
const char *temp_op;
|
||||
NMVPNConnection *active;
|
||||
NMVPNService *service;
|
||||
const char *service_name;
|
||||
const char * object_path;
|
||||
const char * member;
|
||||
const char * temp_op;
|
||||
NMVPNConnection * active;
|
||||
NMVPNService * service;
|
||||
const char * service_name;
|
||||
|
||||
g_return_val_if_fail (manager != NULL, FALSE);
|
||||
g_return_val_if_fail (message != NULL, FALSE);
|
||||
|
|
@ -539,6 +540,9 @@ gboolean nm_vpn_manager_process_signal (NMVPNManager *manager, DBusMessage *mess
|
|||
if (!(object_path = dbus_message_get_path (message)))
|
||||
return FALSE;
|
||||
|
||||
if (!(member = dbus_message_get_member (message)))
|
||||
return FALSE;
|
||||
|
||||
if (!(active = nm_vpn_manager_get_active_vpn_connection (manager)))
|
||||
return FALSE;
|
||||
|
||||
|
|
@ -550,15 +554,17 @@ gboolean nm_vpn_manager_process_signal (NMVPNManager *manager, DBusMessage *mess
|
|||
if (!temp_op || (strcmp (object_path, temp_op) != 0))
|
||||
return FALSE;
|
||||
|
||||
if (dbus_message_is_signal (message, service_name, NM_DBUS_VPN_SIGNAL_LOGIN_FAILED))
|
||||
if ( dbus_message_is_signal (message, service_name, NM_DBUS_VPN_SIGNAL_LOGIN_FAILED)
|
||||
|| dbus_message_is_signal (message, service_name, NM_DBUS_VPN_SIGNAL_LAUNCH_FAILED)
|
||||
|| dbus_message_is_signal (message, service_name, NM_DBUS_VPN_SIGNAL_CONNECT_FAILED))
|
||||
{
|
||||
char *error_msg;
|
||||
char *blank_msg = "";
|
||||
|
||||
if (!dbus_message_get_args (message, NULL, DBUS_TYPE_STRING, &error_msg, DBUS_TYPE_INVALID))
|
||||
error_msg = blank_msg;
|
||||
nm_warning ("VPN Login failed for service '%s' with message '%s'.", service_name, error_msg);
|
||||
nm_dbus_vpn_signal_vpn_login_failed (manager->app_data->dbus_connection, active, error_msg);
|
||||
nm_warning ("VPN failed for service '%s', signal '%s', with message '%s'.", service_name, member, error_msg);
|
||||
nm_dbus_vpn_signal_vpn_failed (manager->app_data->dbus_connection, member, active, error_msg);
|
||||
}
|
||||
else if (dbus_message_is_signal (message, service_name, NM_DBUS_VPN_SIGNAL_STATE_CHANGE))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -39,7 +39,14 @@
|
|||
#include "nm-vpnc-service.h"
|
||||
#include "nm-utils.h"
|
||||
|
||||
#define VPNC_BINARY_PATH_DEFAULT "/usr/sbin/vpnc"
|
||||
|
||||
static char *vpnc_binary_paths[] =
|
||||
{
|
||||
"/usr/sbin/vpnc",
|
||||
"/sbin/vpnc",
|
||||
NULL
|
||||
};
|
||||
|
||||
#define NM_VPNC_HELPER_PATH BINDIR"/nm-vpnc-service-vpnc-helper"
|
||||
#define NM_VPNC_PID_FILE_PATH LOCALSTATEDIR"/run/vpnc/pid"
|
||||
#define NM_VPNC_CONFIG_FILE_PATH LOCALSTATEDIR"/run/vpnc/nm-vpnc-service-vpnc.conf"
|
||||
|
|
@ -111,6 +118,60 @@ static void nm_vpnc_dbus_signal_login_failed (NmVpncData *data)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* nm_vpnc_dbus_signal_launch_failed
|
||||
*
|
||||
* Signal the bus that we couldn't launch the VPN daemon.
|
||||
*
|
||||
*/
|
||||
static void nm_vpnc_dbus_signal_launch_failed (NmVpncData *data)
|
||||
{
|
||||
DBusMessage *message;
|
||||
const char *error_msg = "The VPN login failed because the VPN program could not be started.";
|
||||
|
||||
g_return_if_fail (data != NULL);
|
||||
|
||||
if (!(message = dbus_message_new_signal (NM_DBUS_PATH_VPNC, NM_DBUS_INTERFACE_VPNC, NM_DBUS_VPN_SIGNAL_LAUNCH_FAILED)))
|
||||
{
|
||||
nm_warning ("Not enough memory for new dbus message!");
|
||||
return;
|
||||
}
|
||||
|
||||
dbus_message_append_args (message, DBUS_TYPE_STRING, &error_msg, DBUS_TYPE_INVALID);
|
||||
if (!dbus_connection_send (data->con, message, NULL))
|
||||
nm_warning ("Could not raise the signal!");
|
||||
|
||||
dbus_message_unref (message);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* nm_vpnc_dbus_signal_connect_failed
|
||||
*
|
||||
* Signal the bus that VPN daemon failed to connect to the VPN concentrator.
|
||||
*
|
||||
*/
|
||||
static void nm_vpnc_dbus_signal_connect_failed (NmVpncData *data)
|
||||
{
|
||||
DBusMessage *message;
|
||||
const char *error_msg = "The VPN login failed because the VPN program could not connect to the VPN server.";
|
||||
|
||||
g_return_if_fail (data != NULL);
|
||||
|
||||
if (!(message = dbus_message_new_signal (NM_DBUS_PATH_VPNC, NM_DBUS_INTERFACE_VPNC, NM_DBUS_VPN_SIGNAL_CONNECT_FAILED)))
|
||||
{
|
||||
nm_warning ("Not enough memory for new dbus message!");
|
||||
return;
|
||||
}
|
||||
|
||||
dbus_message_append_args (message, DBUS_TYPE_STRING, &error_msg, DBUS_TYPE_INVALID);
|
||||
if (!dbus_connection_send (data->con, message, NULL))
|
||||
nm_warning ("Could not raise the signal!");
|
||||
|
||||
dbus_message_unref (message);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* nm_vpnc_dbus_signal_state_change
|
||||
*
|
||||
|
|
@ -218,6 +279,7 @@ static gboolean nm_vpnc_helper_timer_cb (NmVpncData *data)
|
|||
|
||||
g_return_val_if_fail (data != NULL, FALSE);
|
||||
|
||||
nm_vpnc_dbus_signal_connect_failed (data);
|
||||
nm_vpnc_dbus_handle_stop_vpn (data);
|
||||
|
||||
return FALSE;
|
||||
|
|
@ -287,11 +349,12 @@ static void vpnc_watch_cb (GPid pid, gint status, gpointer user_data)
|
|||
/* Must be after data->state is set since signals use data->state */
|
||||
switch (error)
|
||||
{
|
||||
case 2: /* Couldn't log in */
|
||||
case 2: /* Couldn't log in due to bad user/pass */
|
||||
nm_vpnc_dbus_signal_login_failed (data);
|
||||
break;
|
||||
|
||||
case 1: /* Other error (couldn't bind to address, etc) */
|
||||
nm_vpnc_dbus_signal_connect_failed (data);
|
||||
break;
|
||||
|
||||
case 0: /* Success, vpnc has daemonized */
|
||||
|
|
@ -339,7 +402,7 @@ static void vpnc_watch_cb (GPid pid, gint status, gpointer user_data)
|
|||
static gboolean nm_vpnc_start_vpnc_binary (NmVpncData *data)
|
||||
{
|
||||
GPid pid;
|
||||
const char * vpnc_binary;
|
||||
char ** vpnc_binary = NULL;
|
||||
GPtrArray * vpnc_argv;
|
||||
GError * error = NULL;
|
||||
gboolean success = FALSE;
|
||||
|
|
@ -351,9 +414,23 @@ static gboolean nm_vpnc_start_vpnc_binary (NmVpncData *data)
|
|||
|
||||
unlink (NM_VPNC_PID_FILE_PATH);
|
||||
|
||||
/* Find vpnc */
|
||||
vpnc_binary = vpnc_binary_paths;
|
||||
while (*vpnc_binary != NULL)
|
||||
{
|
||||
if (g_file_test (*vpnc_binary, G_FILE_TEST_EXISTS))
|
||||
break;
|
||||
vpnc_binary++;
|
||||
}
|
||||
|
||||
if (!*vpnc_binary)
|
||||
{
|
||||
nm_info ("Could not find vpnc binary.");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
vpnc_argv = g_ptr_array_new ();
|
||||
vpnc_binary = g_getenv ("VPNC_BINARY_PATH") ? g_getenv ("VPNC_BINARY_PATH") : VPNC_BINARY_PATH_DEFAULT;
|
||||
g_ptr_array_add (vpnc_argv, (char *) vpnc_binary);
|
||||
g_ptr_array_add (vpnc_argv, (char *) (*vpnc_binary));
|
||||
g_ptr_array_add (vpnc_argv, "--script");
|
||||
g_ptr_array_add (vpnc_argv, NM_VPNC_HELPER_PATH);
|
||||
g_ptr_array_add (vpnc_argv, "--pid-file");
|
||||
|
|
@ -493,7 +570,10 @@ static gboolean nm_vpnc_dbus_handle_start_vpn (DBusMessage *message, DBusMessage
|
|||
if (nm_vpnc_config_file_generate (user_name, password, data_items, num_items))
|
||||
success = nm_vpnc_start_vpnc_binary (data);
|
||||
if (!success)
|
||||
{
|
||||
nm_vpnc_dbus_signal_launch_failed (data);
|
||||
nm_vpnc_set_state (data, NM_VPN_STATE_STOPPED);
|
||||
}
|
||||
|
||||
out:
|
||||
return success;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue