Commit 1a50bb4b authored by Chris Aillon's avatar Chris Aillon Committed by Chris Aillon
Browse files

2005-09-01 Christopher Aillon <caillon@redhat.com>

	* gnome/applet/applet-dbus-info.c:
	* gnome/applet/applet.c:
	* gnome/applet/other-network-dialog.c:
	* gnome/applet/vpn-password-dialog.c:
	Drop the gtk_dialog_run () calls in favor of connecting to
	"response" signals, needed now that the applet is not threaded.


git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@919 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
parent 13541d56
2005-09-01 Christopher Aillon <caillon@redhat.com>
* gnome/applet/applet-dbus-info.c:
* gnome/applet/applet.c:
* gnome/applet/other-network-dialog.c:
* gnome/applet/vpn-password-dialog.c:
Drop the gtk_dialog_run () calls in favor of connecting to
"response" signals, needed now that the applet is not threaded.
2005-08-31 Dan Williams <dcbw@redhat.com>
Patch from Bill Moss <bmoss@clemson.edu>
......
......@@ -1130,16 +1130,16 @@ DBusHandlerResult nmi_dbus_info_message_handler (DBusConnection *connection, DBu
dbus_error_init (&error);
if (dbus_message_get_args (message, &error, DBUS_TYPE_STRING, &network, DBUS_TYPE_INVALID))
{
GtkDialog *dialog;
GtkWidget *dialog;
char *text;
dbus_error_free (&error);
text = g_strdup_printf (_("The requested wireless network '%s' does not appear to be in range. "
"A different wireless network will be used if any are available."), network);
dialog = GTK_DIALOG (gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, text, NULL));
gtk_dialog_run (dialog);
gtk_widget_destroy (GTK_WIDGET (dialog));
dialog = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, text, NULL);
gtk_window_present (GTK_WINDOW (dialog));
g_signal_connect_swapped (dialog, "response", G_CALLBACK (gtk_widget_destroy), dialog);
}
}
#endif
......
......@@ -196,12 +196,10 @@ static void nmwa_show_socket_err (GtkWidget *info_dialog, const char *err)
msg = g_strdup_printf ("<span weight=\"bold\" size=\"larger\">%s</span>\n\n%s",
_("Error displaying connection information: "), err);
error_dialog = gtk_message_dialog_new_with_markup (GTK_WINDOW (info_dialog),
0, GTK_MESSAGE_ERROR,
GTK_BUTTONS_OK, msg);
gtk_dialog_run (GTK_DIALOG (error_dialog));
gtk_widget_destroy (error_dialog);
error_dialog = gtk_message_dialog_new_with_markup (GTK_WINDOW (info_dialog), 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, msg);
g_free (msg);
gtk_window_present (GTK_WINDOW (error_dialog));
g_signal_connect_swapped (error_dialog, "response", G_CALLBACK (gtk_widget_destroy), error_dialog);
}
static gboolean nmwa_update_info (NMWirelessApplet *applet)
......@@ -344,8 +342,7 @@ static void nmwa_show_info_cb (GtkMenuItem *mi, NMWirelessApplet *applet)
if (nmwa_update_info (applet))
{
gtk_window_present (GTK_WINDOW (info_dialog));
gtk_dialog_run (GTK_DIALOG (info_dialog));
gtk_widget_hide (GTK_WIDGET (info_dialog));
g_signal_connect_swapped (info_dialog, "response", G_CALLBACK (gtk_widget_hide), info_dialog);
}
}
......@@ -1209,8 +1206,8 @@ static gboolean show_warning_dialog (char *mesg)
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);
gtk_window_present (GTK_WINDOW (dialog));
g_signal_connect_swapped (dialog, "response", G_CALLBACK (gtk_widget_destroy), dialog);
g_free (mesg);
return FALSE;
......
......@@ -312,29 +312,22 @@ static GtkDialog *nmwa_other_network_dialog_init (GladeXML *xml, NMWirelessApple
return (dialog);
}
void nmwa_other_network_dialog_run (NMWirelessApplet *applet, gboolean create_network)
typedef struct OtherNetworkDialogCBData
{
gchar *glade_file;
GtkDialog *dialog;
gint response;
NetworkDevice *def_dev = NULL;
GladeXML *xml;
g_return_if_fail (applet != NULL);
g_return_if_fail (applet->glade_file != NULL);
if (!(xml = glade_xml_new (applet->glade_file, "custom_essid_dialog", NULL)))
{
nmwa_schedule_warning_dialog (applet, _("The NetworkManager Applet could not find some required resources (the glade file was not found)."));
return;
}
NMWirelessApplet *applet;
NetworkDevice *dev;
GladeXML *xml;
gboolean create;
} OtherNetworkDialogCBData;
if (!(dialog = nmwa_other_network_dialog_init (xml, applet, &def_dev, create_network)))
return;
/* Run the dialog */
response = gtk_dialog_run (dialog);
static void nmwa_other_network_dialog_response_cb (GtkDialog *dialog, gint response, gpointer data)
{
OtherNetworkDialogCBData *cb_data = (OtherNetworkDialogCBData*) data;
GladeXML *xml = cb_data->xml;
NetworkDevice *def_dev = cb_data->dev;
NMWirelessApplet *applet = cb_data->applet;
gboolean create_network = cb_data->create;
if (response == GTK_RESPONSE_OK)
{
......@@ -396,4 +389,35 @@ void nmwa_other_network_dialog_run (NMWirelessApplet *applet, gboolean create_ne
gtk_widget_destroy (GTK_WIDGET (dialog));
g_object_unref (xml);
g_free (data);
}
void nmwa_other_network_dialog_run (NMWirelessApplet *applet, gboolean create_network)
{
GtkDialog *dialog;
NetworkDevice *def_dev = NULL;
GladeXML *xml;
OtherNetworkDialogCBData *cb_data;
g_return_if_fail (applet != NULL);
g_return_if_fail (applet->glade_file != NULL);
if (!(xml = glade_xml_new (applet->glade_file, "custom_essid_dialog", NULL)))
{
nmwa_schedule_warning_dialog (applet, _("The NetworkManager Applet could not find some required resources (the glade file was not found)."));
return;
}
if (!(dialog = nmwa_other_network_dialog_init (xml, applet, &def_dev, create_network)))
return;
cb_data = g_malloc0 (sizeof (OtherNetworkDialogCBData));
network_device_ref (def_dev);
cb_data->dev = def_dev;
cb_data->applet = applet;
cb_data->xml = xml;
cb_data->create = create_network;
gtk_window_present (GTK_WINDOW (dialog));
g_signal_connect (dialog, "response", G_CALLBACK (nmwa_other_network_dialog_response_cb), (gpointer) cb_data);
}
......@@ -154,8 +154,8 @@ nmwa_vpn_request_password (NMWirelessApplet *applet, const char *name, const cha
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
_("Could not find the authentication dialog for VPN connection type '%s'. Contact your system administrator."),
service);
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
gtk_window_present (GTK_WINDOW (dialog));
g_signal_connect_swapped (dialog, "response", G_CALLBACK (gtk_widget_destroy), dialog);
goto out;
}
......@@ -193,8 +193,8 @@ nmwa_vpn_request_password (NMWirelessApplet *applet, const char *name, const cha
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
_("There was a problem launching the authentication dialog for VPN connection type '%s'. Contact your system administrator."),
service);
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
gtk_window_present (GTK_WINDOW (dialog));
g_signal_connect_swapped (dialog, "response", G_CALLBACK (gtk_widget_destroy), dialog);
goto out;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment