diff options
author | Stig Bjørlykke <stig@bjorlykke.org> | 2019-06-27 21:51:49 +0200 |
---|---|---|
committer | Stig Bjørlykke <stig@bjorlykke.org> | 2019-06-28 09:18:15 +0000 |
commit | 44c5e62635e646b3b6933563ec59a749c19fd0b0 (patch) | |
tree | ab7e3739961021f88d12f311406b964506a112ec /ui/preference_utils.c | |
parent | fe5015f60384cbc462fa0b0ef48d7e2ed8390901 (diff) |
Qt: Fix default position when "Apply as Column"
The default position for a column when "Apply as Column" is before
the Info column if this is last, else add last.
This bug was introduced in g5ae259c4.
Change-Id: I68adaec5092e0ed1c65e771f171c42000fdc83fc
Reviewed-on: https://code.wireshark.org/review/33759
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
Diffstat (limited to 'ui/preference_utils.c')
-rw-r--r-- | ui/preference_utils.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/ui/preference_utils.c b/ui/preference_utils.c index 5f8617f2ac..3ce241dc9e 100644 --- a/ui/preference_utils.c +++ b/ui/preference_utils.c @@ -156,11 +156,11 @@ prefs_store_ext_multiple(const char * module, GHashTable * pref_values) gint column_prefs_add_custom(gint fmt, const gchar *title, const gchar *custom_fields, gint custom_occurrence) { - return column_prefs_add_custom_with_position(fmt, title, custom_fields, custom_occurrence, 0); + return column_prefs_add_custom_with_position(fmt, title, custom_fields, custom_occurrence, -1); } gint -column_prefs_add_custom_with_position(gint fmt, const gchar *title, const gchar *custom_fields, gint custom_occurrence, guint position) +column_prefs_add_custom_with_position(gint fmt, const gchar *title, const gchar *custom_fields, gint custom_occurrence, gint position) { GList *clp; fmt_data *cfmt, *last_cfmt; @@ -184,7 +184,7 @@ column_prefs_add_custom_with_position(gint fmt, const gchar *title, const gchar cfmt->visible = TRUE; clp = g_list_last(prefs.col_list); last_cfmt = (fmt_data *) clp->data; - if (position <= (guint) colnr) { + if (position > 0 && position <= colnr) { /* Custom fields may be added at any position, depending on the given argument */ prefs.col_list = g_list_insert(prefs.col_list, cfmt, position); } else if (last_cfmt->fmt == COL_INFO) { |