network-manager-applet r720 - in trunk: . src/connection-editor



Author: tambeti
Date: Fri May  9 09:32:02 2008
New Revision: 720
URL: http://svn.gnome.org/viewvc/network-manager-applet?rev=720&view=rev

Log:
2008-05-09  Tambet Ingo  <tambet gmail com>

	* src/connection-editor/nm-connection-editor.c: Show error dialog
	if updating connection fails.

	* src/connection-editor/nm-connection-list.c: Show error dialog
	if adding or removing connection fails.


Modified:
   trunk/ChangeLog
   trunk/src/connection-editor/nm-connection-editor.c
   trunk/src/connection-editor/nm-connection-list.c

Modified: trunk/src/connection-editor/nm-connection-editor.c
==============================================================================
--- trunk/src/connection-editor/nm-connection-editor.c	(original)
+++ trunk/src/connection-editor/nm-connection-editor.c	Fri May  9 09:32:02 2008
@@ -78,6 +78,28 @@
 static void update_connection (NMExportedConnection *exported);
 
 static void
+show_error_dialog (const gchar *format, ...)
+{
+	GtkWidget *dialog;
+	va_list args;
+	char *msg;
+
+	va_start (args, format);
+	msg = g_strdup_vprintf (format, args);
+	va_end (args);
+
+	dialog = gtk_message_dialog_new (NULL,
+							   GTK_DIALOG_DESTROY_WITH_PARENT,
+							   GTK_MESSAGE_ERROR,
+							   GTK_BUTTONS_CLOSE,
+							   msg);
+	g_free (msg);
+
+	gtk_dialog_run (GTK_DIALOG (dialog));
+	gtk_widget_destroy (dialog);
+}
+
+static void
 dialog_response_cb (GtkDialog *dialog, guint response, gpointer user_data)
 {
 	gtk_widget_hide (GTK_WIDGET (dialog));
@@ -428,10 +450,10 @@
 	if (gained_privilege)
 		update_connection (exported);
 	else if (error) {
-		g_warning ("Could not obtain required privileges: %s", error->message);
+		show_error_dialog (_("Could not obtain required privileges: %s."), error->message);
 		g_error_free (error);
 	} else
-		g_warning ("Could not update system connection, permission denied");
+		show_error_dialog (_("Could not update system connection: permission denied."));
 
 	g_object_unref (exported);
 }
@@ -479,7 +501,7 @@
 
  out:
 	if (err) {
-		g_warning ("Updating the connection failed: %s", err->message);
+		show_error_dialog (("Updating the connection failed: %s."), err->message);
 		g_error_free (err);
 	}
 }

Modified: trunk/src/connection-editor/nm-connection-list.c
==============================================================================
--- trunk/src/connection-editor/nm-connection-list.c	(original)
+++ trunk/src/connection-editor/nm-connection-list.c	Fri May  9 09:32:02 2008
@@ -75,6 +75,28 @@
 static void add_system_connection (NMConnectionList *self, NMConnection *connection);
 static void delete_connection (NMExportedConnection *exported);
 
+static void
+show_error_dialog (const gchar *format, ...)
+{
+	GtkWidget *dialog;
+	va_list args;
+	char *msg;
+
+	va_start (args, format);
+	msg = g_strdup_vprintf (format, args);
+	va_end (args);
+
+	dialog = gtk_message_dialog_new (NULL,
+							   GTK_DIALOG_DESTROY_WITH_PARENT,
+							   GTK_MESSAGE_ERROR,
+							   GTK_BUTTONS_CLOSE,
+							   msg);
+	g_free (msg);
+
+	gtk_dialog_run (GTK_DIALOG (dialog));
+	gtk_widget_destroy (dialog);
+}
+
 static NMExportedConnection *
 get_active_connection (GtkTreeView *treeview)
 {
@@ -263,10 +285,10 @@
 	if (gained_privilege)
 		add_system_connection (info->list, info->connection);
 	else if (error) {
-		g_warning ("Could not obtain required privileges: %s", error->message);
+		show_error_dialog (_("Could not obtain required privileges: %s."), error->message);
 		g_error_free (error);
 	} else
-		g_warning ("Could not add system connection, permission denied");
+		show_error_dialog (_("Could not add system connection: permission denied."));
 
 	g_object_unref (info->list);
 	g_object_unref (info->connection);
@@ -318,7 +340,7 @@
 
  out:
 	if (err) {
-		g_warning ("Could not add system settings: %s", err->message);
+		show_error_dialog (_("Could not add system settings: %s."), err->message);
 		g_error_free (err);
 	}
 }
@@ -620,10 +642,10 @@
 	if (gained_privilege)
 		delete_connection (exported);
 	else if (error) {
-		g_warning ("Could not obtain required privileges: %s", error->message);
+		show_error_dialog (_("Could not obtain required privileges: %s."), error->message);
 		g_error_free (error);
 	} else
-		g_warning ("Could not remove system connection, permission denied");
+		show_error_dialog (_("Could not remove system connection: permission denied."));
 
 	g_object_unref (exported);
 }
@@ -666,7 +688,7 @@
 
  out:
 	if (err) {
-		g_warning ("Deleting the connection failed: %s", err->message);
+		show_error_dialog (_("Deleting the connection failed: %s."), err->message);
 		g_error_free (err);
 	}
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]