[network-manager-applet/th/validation-error-bgo754832: 13/13] fixup! c-e: show tooltip with validation error



commit 3bb4d4f5e16294bb6e7bcd7fa08e1e4771a8aede
Author: Thomas Haller <thaller redhat com>
Date:   Fri Sep 11 10:06:34 2015 +0200

    fixup! c-e: show tooltip with validation error
    
    Restore printing the validation error, but as message, not warning.
    It might still be useful for debugging.
    
    Also, we might want to suggest to a user that he looks at stdout for
    messages -- which would also semi-work with prevous version (although
    the message being less helpfull).

 src/connection-editor/nm-connection-editor.c |   14 ++++++++++++--
 src/connection-editor/nm-connection-editor.h |    2 ++
 2 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/src/connection-editor/nm-connection-editor.c b/src/connection-editor/nm-connection-editor.c
index 6dca0e2..9c7a1ef 100644
--- a/src/connection-editor/nm-connection-editor.c
+++ b/src/connection-editor/nm-connection-editor.c
@@ -216,6 +216,14 @@ connection_editor_validate (NMConnectionEditor *editor)
        }
 
 done:
+       if (g_strcmp0 (validation_error, editor->last_validation_error) != 0) {
+               if (editor->last_validation_error && !validation_error)
+                       g_message ("Connection validates and can be saved");
+               else if (validation_error)
+                       g_message ("Cannot save connection due to error: %s", validation_error);
+               g_free (editor->last_validation_error);
+               editor->last_validation_error = g_strdup (validation_error);
+       }
        ce_polkit_button_set_validation_error (CE_POLKIT_BUTTON (editor->ok_button), validation_error);
        gtk_widget_set_sensitive (editor->export_button, !!validation_error);
 
@@ -234,8 +242,8 @@ ok_button_actionable_cb (GtkWidget *button,
 
 static void
 permissions_changed_cb (NMClient *client,
-                           NMClientPermission permission,
-                           NMClientPermissionResult result,                       
+                        NMClientPermission permission,
+                        NMClientPermissionResult result,
                         NMConnectionEditor *editor)
 {
        if (permission != NM_CLIENT_PERMISSION_SETTINGS_MODIFY_SYSTEM)
@@ -351,6 +359,8 @@ dispose (GObject *object)
        g_signal_handler_disconnect (editor->client, editor->permission_id);
        g_object_unref (editor->client);
 
+       g_clear_pointer (&editor->last_validation_error, g_free);
+
 out:
        G_OBJECT_CLASS (nm_connection_editor_parent_class)->dispose (object);
 }
diff --git a/src/connection-editor/nm-connection-editor.h b/src/connection-editor/nm-connection-editor.h
index 7c953b8..259e8dc 100644
--- a/src/connection-editor/nm-connection-editor.h
+++ b/src/connection-editor/nm-connection-editor.h
@@ -64,6 +64,8 @@ typedef struct {
        gboolean busy;
        gboolean init_run;
        guint validate_id;
+
+       char *last_validation_error;
 } NMConnectionEditor;
 
 typedef struct {


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