diff options
author | Roland Knall <rknall@gmail.com> | 2019-06-12 16:35:29 -0700 |
---|---|---|
committer | Roland Knall <rknall@gmail.com> | 2019-06-13 15:11:10 +0000 |
commit | 5ae259c4954a1894992b31de8661b0562ba87115 (patch) | |
tree | 86dc71c707be5e0523fc320d306aa5f0b2c7d284 /ui/preference_utils.c | |
parent | 36f99fd6f986a36ee3cef4acd90c9994cbad0b4e (diff) |
Qt: Allow dropping fields to add columns and indicate width
Allows for dropping fields on the columns to add them as well as indicate
width while dragging the columns
Change-Id: Ic98ae431886e5eb2ebd9ba50390742995bf22d5a
Reviewed-on: https://code.wireshark.org/review/33573
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
Diffstat (limited to 'ui/preference_utils.c')
-rw-r--r-- | ui/preference_utils.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/ui/preference_utils.c b/ui/preference_utils.c index c9b0dff569..5f8617f2ac 100644 --- a/ui/preference_utils.c +++ b/ui/preference_utils.c @@ -156,6 +156,12 @@ 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); +} + +gint +column_prefs_add_custom_with_position(gint fmt, const gchar *title, const gchar *custom_fields, gint custom_occurrence, guint position) +{ GList *clp; fmt_data *cfmt, *last_cfmt; gint colnr; @@ -178,7 +184,10 @@ column_prefs_add_custom(gint fmt, const gchar *title, const gchar *custom_fields cfmt->visible = TRUE; clp = g_list_last(prefs.col_list); last_cfmt = (fmt_data *) clp->data; - if (last_cfmt->fmt == COL_INFO) { + if (position <= (guint) 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) { /* Last column is COL_INFO, add custom column before this */ colnr -= 1; prefs.col_list = g_list_insert(prefs.col_list, cfmt, colnr); |