[network-manager-applet] applet: tidy up the error dialogs a bit



commit 7bb56034be86e414efa701b91382ab96a2b6a737
Author: Lubomir Rintel <lkundrak v3 sk>
Date:   Tue Mar 8 15:38:00 2022 +0100

    applet: tidy up the error dialogs a bit
    
    Remove the numeric error code, it doens't belong in the GUI.
    Before:
    
       Failed to activate connection
       (7) wpa_supplicant doesn't support...
    
    After:
    
       Failed to activate connection
       wpa_supplicant doesn't support...
    
    While at that, don't spew useless warnings on the stderr.
    
    https://gitlab.gnome.org/GNOME/network-manager-applet/-/merge_requests/111

 src/applet-device-wifi.c | 10 ++--------
 src/applet.c             | 15 +++------------
 2 files changed, 5 insertions(+), 20 deletions(-)
---
diff --git a/src/applet-device-wifi.c b/src/applet-device-wifi.c
index 8de2f667..0a0783b9 100644
--- a/src/applet-device-wifi.c
+++ b/src/applet-device-wifi.c
@@ -1344,12 +1344,9 @@ activate_existing_cb (GObject *client,
        g_clear_object (&active);
        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"));
+               const char *err_text = 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);
                g_error_free (error);
        }
        applet_schedule_update_icon (NM_APPLET (user_data));
@@ -1367,12 +1364,9 @@ activate_new_cb (GObject *client,
        g_clear_object (&active);
        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"));
+               const char *err_text = 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);
                g_error_free (error);
        }
        applet_schedule_update_icon (NM_APPLET (user_data));
diff --git a/src/applet.c b/src/applet.c
index bc7099f6..3b9c5a6e 100644
--- a/src/applet.c
+++ b/src/applet.c
@@ -410,12 +410,9 @@ add_and_activate_cb (GObject *client,
 
        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"));
+               const char *err_text = 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);
                g_error_free (error);
        }
 
@@ -464,12 +461,9 @@ disconnect_cb (GObject *device,
        nm_device_disconnect_finish (NM_DEVICE (device), result, &error);
        if (error) {
                const char *text = _("Device disconnect failed");
-               char *err_text = g_strdup_printf ("(%d) %s", error->code,
-                                                 error->message ? error->message : _("Unknown error"));
+               const char *err_text = 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);
                g_error_free (error);
        }
 
@@ -499,12 +493,9 @@ activate_connection_cb (GObject *client,
 
        if (error) {
                const char *text = _("Connection activation failed");
-               char *err_text = g_strdup_printf ("(%d) %s", error->code,
-                                                 error->message ? error->message : _("Unknown error"));
+               const char *err_text = 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);
                g_error_free (error);
        }
 


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