From b4b4d1a41a8ccb6cf3b084cc02ca83b6a83e59a7 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Sat, 16 Oct 2004 02:25:02 +0000 Subject: [PATCH] 2004-10-15 Dan Williams * src/NetworkManagerDbus.c info-daemon/NetworkManagerInfoDbus.c - Display an error dialog when the user tries to use an "Other wireless network" that's not found. git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@250 4912f4e0-d625-0410-9fb7-b9a5a253dbdc --- ChangeLog | 7 ++++++ info-daemon/NetworkManagerInfo.c | 3 --- info-daemon/NetworkManagerInfo.h | 2 +- info-daemon/NetworkManagerInfoDbus.c | 10 ++++++++ src/NetworkManagerDbus.c | 37 +++++++++++++++++++++++++--- 5 files changed, 51 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 09e33e2115..4ea9df5cb4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2004-10-15 Dan Williams + + * src/NetworkManagerDbus.c + info-daemon/NetworkManagerInfoDbus.c + - Display an error dialog when the user tries to use an + "Other wireless network" that's not found. + 2004-10-15 Dan Williams * panel-applet/NMWirelessApplet.[ch] diff --git a/info-daemon/NetworkManagerInfo.c b/info-daemon/NetworkManagerInfo.c index 6a45dc507c..b1ca2ac908 100644 --- a/info-daemon/NetworkManagerInfo.c +++ b/info-daemon/NetworkManagerInfo.c @@ -180,7 +180,6 @@ int main( int argc, char *argv[] ) NMIAppInfo *app_info = NULL; GMainLoop *loop; guint notify_id; - GError *error = NULL; struct poptOption options[] = { @@ -302,11 +301,9 @@ int main( int argc, char *argv[] ) gtk_main (); - if (app_info->notification_icon_pid > 0) kill (app_info->notification_icon_pid, SIGTERM); - gnome_client_set_restart_style (client, GNOME_RESTART_ANYWAY); gconf_client_notify_remove (app_info->gconf_client, notify_id); diff --git a/info-daemon/NetworkManagerInfo.h b/info-daemon/NetworkManagerInfo.h index be44bf5c84..d5efa4f27a 100644 --- a/info-daemon/NetworkManagerInfo.h +++ b/info-daemon/NetworkManagerInfo.h @@ -47,7 +47,7 @@ struct NMIAppInfo /* GtkWidget *notification_icon; */ - GPid notification_icon_pid; + GPid notification_icon_pid; guint notification_icon_watch; guint notification_icon_respawn_counter; GTimer *notification_icon_respawn_timer; diff --git a/info-daemon/NetworkManagerInfoDbus.c b/info-daemon/NetworkManagerInfoDbus.c index 5c235bacf4..675228b390 100644 --- a/info-daemon/NetworkManagerInfoDbus.c +++ b/info-daemon/NetworkManagerInfoDbus.c @@ -513,6 +513,16 @@ static DBusHandlerResult nmi_dbus_nmi_message_handler (DBusConnection *connectio if (GTK_WIDGET_VISIBLE (dialog)) nmi_passphrase_dialog_cancel (info); } + else if (strcmp ("networkNotFound", method) == 0) + { + GtkWidget *dialog; + + dialog = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, + "The requested wireless network does not appear to be in range." + " Another wireless network will be used if one is available.", NULL); + gtk_dialog_run (GTK_DIALOG (dialog)); + gtk_widget_destroy (dialog); + } else if (strcmp ("getNetworks", method) == 0) reply_message = nmi_dbus_get_networks (info, message); else if (strcmp ("getNetworkTimestamp", method) == 0) diff --git a/src/NetworkManagerDbus.c b/src/NetworkManagerDbus.c index bc17137f65..31e7fb6802 100644 --- a/src/NetworkManagerDbus.c +++ b/src/NetworkManagerDbus.c @@ -214,6 +214,36 @@ static DBusMessage *nm_dbus_nm_get_active_device (DBusConnection *connection, DB } +/* + * nm_dbus_send_network_not_found + * + * Tell the info-daemon to alert the user that a requested network was + * not found. + * + */ +void nm_dbus_send_network_not_found (DBusConnection *connection, const char *network) +{ + DBusMessage *message; + + g_return_if_fail (connection != NULL); + g_return_if_fail (network != NULL); + + message = dbus_message_new_method_call (NMI_DBUS_SERVICE, NMI_DBUS_PATH, + NMI_DBUS_INTERFACE, "networkNotFound"); + if (message == NULL) + { + syslog (LOG_ERR, "nm_dbus_send_network_not_found(): Couldn't allocate the dbus message"); + return; + } + + dbus_message_append_args (message, DBUS_TYPE_STRING, network, DBUS_TYPE_INVALID); + if (!dbus_connection_send (connection, message, NULL)) + syslog (LOG_WARNING, "nm_dbus_send_network_not_found(): could not send dbus message"); + + dbus_message_unref (message); +} + + /* * nm_dbus_nm_set_active_device * @@ -281,10 +311,7 @@ static DBusMessage *nm_dbus_nm_set_active_device (DBusConnection *connection, DB /* If the user specificed a wireless network too, force that as well */ if (nm_device_is_wireless (dev) && !nm_device_find_and_use_essid (dev, network)) - { - reply_message = nm_dbus_create_error_message (message, NM_DBUS_INTERFACE, "NetworkNotFound", - "The requested wireless network is not in range."); - } + nm_dbus_send_network_not_found (data->dbus_connection, network); else { if (nm_try_acquire_mutex (data->user_device_mutex, __FUNCTION__)) @@ -295,6 +322,8 @@ static DBusMessage *nm_dbus_nm_set_active_device (DBusConnection *connection, DB nm_device_ref (data->user_device); nm_unlock_mutex (data->user_device_mutex, __FUNCTION__); } + else + nm_dbus_send_network_not_found (data->dbus_connection, network); } /* Have to mark our state changed since we blew away our connection trying out