aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorStig Bjørlykke <stig@bjorlykke.org>2019-06-27 21:51:49 +0200
committerStig Bjørlykke <stig@bjorlykke.org>2019-06-28 09:18:15 +0000
commit44c5e62635e646b3b6933563ec59a749c19fd0b0 (patch)
treeab7e3739961021f88d12f311406b964506a112ec /ui
parentfe5015f60384cbc462fa0b0ef48d7e2ed8390901 (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')
-rw-r--r--ui/preference_utils.c6
-rw-r--r--ui/preference_utils.h2
-rw-r--r--ui/qt/main_window.h2
-rw-r--r--ui/qt/main_window_slots.cpp2
4 files changed, 6 insertions, 6 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) {
diff --git a/ui/preference_utils.h b/ui/preference_utils.h
index f2905bad25..791eb55b1b 100644
--- a/ui/preference_utils.h
+++ b/ui/preference_utils.h
@@ -85,7 +85,7 @@ gint
column_prefs_add_custom_with_position(gint fmt, const gchar *title,
const gchar *custom_fields,
gint custom_occurrence,
- guint position);
+ gint position);
/** Remove a column.
*
diff --git a/ui/qt/main_window.h b/ui/qt/main_window.h
index 5a5da269eb..9f6cf1061c 100644
--- a/ui/qt/main_window.h
+++ b/ui/qt/main_window.h
@@ -129,7 +129,7 @@ public:
QString getMwFileName();
void setMwFileName(QString fileName);
- void insertColumn(QString name, QString abbrev, unsigned int pos = 0);
+ void insertColumn(QString name, QString abbrev, gint pos = -1);
protected:
virtual bool eventFilter(QObject *obj, QEvent *event);
diff --git a/ui/qt/main_window_slots.cpp b/ui/qt/main_window_slots.cpp
index c7a6e8ac6b..3e84b215b3 100644
--- a/ui/qt/main_window_slots.cpp
+++ b/ui/qt/main_window_slots.cpp
@@ -3771,7 +3771,7 @@ void MainWindow::showExtcapOptionsDialog(QString &device_name)
}
}
-void MainWindow::insertColumn(QString name, QString abbrev, unsigned int pos)
+void MainWindow::insertColumn(QString name, QString abbrev, gint pos)
{
gint colnr = 0;
if ( name.length() > 0 && abbrev.length() > 0 )