Re: [PATCH] applet: show an error dialog on connection failures

2012-03-27 Thread Jirka Klimes
On Monday 19 of March 2012 15:26:49 Jirka Klimes wrote:
> The patch adds a functionality to present a user with an error dialog (in
> addition to writting a message to console), when there is a connection
> failure.
> 
> Using the notifications would be an option, but I think a dialog is more
> appropriate in this case, because notifications can be disabled and we
> really want to alert the user.
> 
> Jirka

It's been pushed as ba8381aed2cebaea13b8fc739a80bc63c7e153a3

Jirka

___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: [PATCH] applet: show an error dialog on connection failures

2012-03-22 Thread Dan Williams
On Mon, 2012-03-19 at 15:26 +0100, Jirka Klimes wrote:
> The patch adds a functionality to present a user with an error dialog (in
> addition to writting a message to console), when there is a connection
> failure.
> 
> Using the notifications would be an option, but I think a dialog is more
> appropriate in this case, because notifications can be disabled and we really
> want to alert the user.

Yeah, probably the right thing to do.

Dan

___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: [PATCH] applet: show an error dialog on connection failures

2012-03-19 Thread Shrikant Sharma
Hi
I am using ubuntu 11.10, i am very new to linux. With the help of different
forums, i am able to connect my Micromax  MMX 310g usb modem through
network manager and sakis 3g also.
But there are few problems-
Only at boot time network manager recognize usb modem not at any time when
i plug it.
It takes minimum 5 mins to identify the modem.
Sometime it drops the connection.
And sakis3g scripts works only when i am lucky.

Help me.

Thanks,
Shrikant Sharma


On Mon, Mar 19, 2012 at 7:56 PM, Jirka Klimes  wrote:

> The patch adds a functionality to present a user with an error dialog (in
> addition to writting a message to console), when there is a connection
> failure.
>
> Using the notifications would be an option, but I think a dialog is more
> appropriate in this case, because notifications can be disabled and we
> really
> want to alert the user.
>
> Jirka
>
> ___
> networkmanager-list mailing list
> networkmanager-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/networkmanager-list
>
>
___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


[PATCH] applet: show an error dialog on connection failures

2012-03-19 Thread Jirka Klimes
The patch adds a functionality to present a user with an error dialog (in
addition to writting a message to console), when there is a connection
failure.

Using the notifications would be an option, but I think a dialog is more
appropriate in this case, because notifications can be disabled and we really
want to alert the user.

Jirka
>From d947c6366be6e13d3eaf5aea0f874fb494a22b73 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= 
Date: Mon, 19 Mar 2012 11:02:45 +0100
Subject: [PATCH] applet: show an error dialog on connection failures
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Show the user an error dialog, when connection activation failed, so that
he knows what's the problem. This is useful mainly for situations when
user is not allowed to perform an action, PolicyKit is misconfigured or
something.

Signed-off-by: Jiří Klimeš 
---
 src/applet-device-wifi.c|   22 +---
 src/applet.c|   33 +++---
 src/gconf-helpers/tests/Makefile.am |2 +
 src/utils/utils.c   |   37 +++
 src/utils/utils.h   |7 ++
 5 files changed, 89 insertions(+), 12 deletions(-)

diff --git a/src/applet-device-wifi.c b/src/applet-device-wifi.c
index f17324c..15fcf7b 100644
--- a/src/applet-device-wifi.c
+++ b/src/applet-device-wifi.c
@@ -1377,8 +1377,15 @@ activate_existing_cb (NMClient *client,
   GError *error,
   gpointer user_data)
 {
-	if (error)
-		g_warning ("Failed to activate connection: (%d) %s", error->code, error->message);
+	if (error) {
+		const char *text = _("Failed to activate connection");
+		char *err_text = g_strdup_printf ("(%d) %s", error->code,
+		  error->message ? error->message : _("Unknown error"));
+
+		g_warning ("%s: %s", text, err_text);
+		utils_show_error_dialog (_("Connection failure"), text, err_text, FALSE, NULL);
+		g_free (err_text);
+	}
 	applet_schedule_update_icon (NM_APPLET (user_data));
 }
 
@@ -1389,8 +1396,15 @@ activate_new_cb (NMClient *client,
  GError *error,
  gpointer user_data)
 {
-	if (error)
-		g_warning ("Failed to add new connection: (%d) %s", error->code, error->message);
+	if (error) {
+		const char *text = _("Failed to add new connection");
+		char *err_text = g_strdup_printf ("(%d) %s", error->code,
+		  error->message ? error->message : _("Unknown error"));
+
+		g_warning ("%s: %s", text, err_text);
+		utils_show_error_dialog (_("Connection failure"), text, err_text, FALSE, NULL);
+		g_free (err_text);
+	}
 	applet_schedule_update_icon (NM_APPLET (user_data));
 }
 
diff --git a/src/applet.c b/src/applet.c
index cb5b5e4..c7a362e 100644
--- a/src/applet.c
+++ b/src/applet.c
@@ -483,8 +483,15 @@ add_and_activate_cb (NMClient *client,
  GError *error,
  gpointer user_data)
 {
-	if (error)
-		g_warning ("Failed to add/activate connection: (%d) %s", error->code, error->message);
+	if (error) {
+		const char *text = _("Failed to add/activate connection");
+		char *err_text = g_strdup_printf ("(%d) %s", error->code,
+		  error->message ? error->message : _("Unknown error"));
+
+		g_warning ("%s: %s", text, err_text);
+		utils_show_error_dialog (_("Connection failure"), text, err_text, FALSE, NULL);
+		g_free (err_text);
+	}
 
 	applet_schedule_update_icon (NM_APPLET (user_data));
 }
@@ -521,10 +528,13 @@ static void
 disconnect_cb (NMDevice *device, GError *error, gpointer user_data)
 {
 	if (error) {
-		g_warning ("%s: device disconnect failed: (%d) %s",
-		   __func__,
-		   error ? error->code : -1,
-		   error && error->message ? error->message : "(unknown)");
+		const char *text = _("Device disconnect failed");
+		char *err_text = g_strdup_printf ("(%d) %s", error->code,
+		  error->message ? error->message : _("Unknown error"));
+
+		g_warning ("%s: %s: %s", __func__, text, err_text);
+		utils_show_error_dialog (_("Disconnect failure"), text, err_text, FALSE, NULL);
+		g_free (err_text);
 	}
 }
 
@@ -543,8 +553,15 @@ activate_connection_cb (NMClient *client,
 GError *error,
 gpointer user_data)
 {
-	if (error)
-		g_warning ("Connection activation failed: %s", error->message);
+	if (error) {
+		const char *text = _("Connection activation failed");
+		char *err_text = g_strdup_printf ("(%d) %s", error