aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2014-04-29 00:06:02 +0200
committerAnders Broman <a.broman58@gmail.com>2014-04-29 04:16:23 +0000
commite8cb6231661ef36f17d3c2a7a9f9d12600120047 (patch)
tree5c2a00e54bd7f69a5e54c9ff297ae34f4002ece9 /ui
parentb086b783c2106bb24ebce425f97dd86036ccbb13 (diff)
prefs: spelling fix, simplify code
Found spelling error "a another". All those dynamic allocations and magic numbers are horrible and unnecessary. Simplify the gtk code rewording the message and merging strings. Simplify the version code by using fscanf to take care of matching the first line of a preference file. Change-Id: I1e75803aacaa494ba5005791bcbd023e0807aaaa Reviewed-on: https://code.wireshark.org/review/1424 Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'ui')
-rw-r--r--ui/gtk/prefs_dlg.c29
1 files changed, 10 insertions, 19 deletions
diff --git a/ui/gtk/prefs_dlg.c b/ui/gtk/prefs_dlg.c
index fc3c4abc78..17a903b592 100644
--- a/ui/gtk/prefs_dlg.c
+++ b/ui/gtk/prefs_dlg.c
@@ -1410,31 +1410,22 @@ prefs_main_save(gpointer parent_w)
{
if (prefs.unknown_prefs) {
gpointer dialog;
- gchar *msg;
- const gchar *msg1 = "These preferences were last saved at version ";
- const gchar *msg2 = "Obsolete or unrecognized preferences have been detected. "
- "If you plan to use this profile with ";
- const gchar *msg3 = "that version of Wireshark, ";
- const gchar *msg4 = "an older or nonstandard Wireshark version, ";
- const gchar *msg5 = "click 'Continue without Saving' and save this profile under a another name.\n";
+ const gchar *msg =
+ "Obsolete or unrecognized preferences have been detected and will be "
+ "discarded when saving this profile. If you would like to preserve "
+ "these preferences for a different Wireshark version, click "
+ "'Continue without Saving' and save this profile under a different name.";
if (prefs.saved_at_version) {
- gulong tot_msg_len = 246 + (gulong)strlen(prefs.saved_at_version) + 1;
-
- msg = (gchar *)g_malloc(tot_msg_len);
- g_snprintf(msg, tot_msg_len, "%s\"%s\". %s%s%s",
- msg1, prefs.saved_at_version, msg2, msg3, msg5);
- dialog = simple_dialog(ESD_TYPE_CONFIRMATION, ESD_BTNS_SAVE_DONTSAVE, "%s", msg);
+ dialog = simple_dialog(ESD_TYPE_CONFIRMATION, ESD_BTNS_SAVE_DONTSAVE,
+ "These preferences were last saved at version \"%s\".\n%s",
+ prefs.saved_at_version, msg);
} else {
- msg = (gchar *)g_malloc(214);
-
- g_snprintf(msg, 214, "%s%s%s", msg2, msg4, msg5);
- dialog = simple_dialog(ESD_TYPE_CONFIRMATION, ESD_BTNS_SAVE_DONTSAVE, "%s", msg);
+ dialog = simple_dialog(ESD_TYPE_CONFIRMATION, ESD_BTNS_SAVE_DONTSAVE,
+ "%s", msg);
}
simple_dialog_set_cb(dialog, overwrite_existing_prefs_cb, parent_w);
- g_free(msg);
-
} else {
prefs_main_write();
}