diff options
author | Stig Bjørlykke <stig@bjorlykke.org> | 2017-02-07 21:35:16 +0100 |
---|---|---|
committer | Stig Bjørlykke <stig@bjorlykke.org> | 2017-02-08 09:07:17 +0000 |
commit | 64984b7a59ca52ec32d6608ad6ca298c054ff49e (patch) | |
tree | 02ee9212a6212bcc144d40e7e5048c63a12b1fc6 /ui/profile.c | |
parent | b3068a0d1bfa8b8eec2bcf0f851e5feae118fbec (diff) |
Qt: Add check for valid profile name
Add check for a valid profile name in the Profile dialog and disable
the Ok button and mark the invalid profile if error.
The GTK dialog does not close on errors but the Qt dialog does, so
ensure the user is informed beforehand.
Change-Id: If31ffe75183066cf49e2b5a082112bfe62d6c06e
Reviewed-on: https://code.wireshark.org/review/19995
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
Diffstat (limited to 'ui/profile.c')
-rw-r--r-- | ui/profile.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/ui/profile.c b/ui/profile.c index dba694e3e5..2319f4e647 100644 --- a/ui/profile.c +++ b/ui/profile.c @@ -124,7 +124,9 @@ const gchar *apply_profile_changes(void) profile1 = (profile_def *) fl1->data; g_strstrip(profile1->name); if ((err_msg = profile_name_is_valid(profile1->name)) != NULL) { - return err_msg; + gchar *message = g_strdup_printf("%s\nProfiles unchanged.", err_msg); + g_free((gchar *)err_msg); + return message; } fl1 = g_list_next(fl1); } @@ -386,7 +388,7 @@ profile_name_is_valid(const gchar *name) #endif if (reason) { - message = g_strdup_printf("A profile name cannot %s\nProfiles unchanged.", reason); + message = g_strdup_printf("A profile name cannot %s", reason); g_free(reason); return message; } |