diff options
author | Roland Knall <roland.knall@br-automation.com> | 2015-03-09 08:11:13 +0100 |
---|---|---|
committer | Michal Labedzki <michal.labedzki@tieto.com> | 2015-05-15 06:05:01 +0000 |
commit | 57716e13659a8c9c26124e249a86fce9577d609f (patch) | |
tree | 4e2d950b9364a4541c9c5bf72774db2689f75d4e /ui/preference_utils.c | |
parent | 7f424b5a550f0a5f6d370b46b8ffbb327754fa3d (diff) | |
download | wireshark-57716e13659a8c9c26124e249a86fce9577d609f.tar.gz wireshark-57716e13659a8c9c26124e249a86fce9577d609f.tar.bz2 wireshark-57716e13659a8c9c26124e249a86fce9577d609f.zip |
Qt: Implement "Apply as Column" for packet context
Implement the same functionality for "Apply as Column" as it
exists in the GTK version of Wireshark. Especially for the
context menu in the packet view panel.
Change-Id: Id25b7797616ff3b3acf7aa920395516c8a4e9bf9
Reviewed-on: https://code.wireshark.org/review/7604
Reviewed-by: Roland Knall <rknall@gmail.com>
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com>
Tested-by: Michal Labedzki <michal.labedzki@tieto.com>
Diffstat (limited to 'ui/preference_utils.c')
-rw-r--r-- | ui/preference_utils.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/ui/preference_utils.c b/ui/preference_utils.c index 1bed39bd2f..1e358bd7d0 100644 --- a/ui/preference_utils.c +++ b/ui/preference_utils.c @@ -273,11 +273,12 @@ prefs_main_write(void) } } -void +gint column_prefs_add_custom(gint fmt, const gchar *title, const gchar *custom_field, gint custom_occurrence) { GList *clp; fmt_data *cfmt, *last_cfmt; + gint colnr; cfmt = (fmt_data *) g_malloc(sizeof(fmt_data)); /* @@ -291,13 +292,16 @@ column_prefs_add_custom(gint fmt, const gchar *title, const gchar *custom_field, cfmt->custom_occurrence = custom_occurrence; cfmt->resolved = TRUE; + colnr = g_list_length(prefs.col_list); + if (custom_field) { cfmt->visible = TRUE; clp = g_list_last(prefs.col_list); last_cfmt = (fmt_data *) clp->data; if (last_cfmt->fmt == COL_INFO) { /* Last column is COL_INFO, add custom column before this */ - prefs.col_list = g_list_insert(prefs.col_list, cfmt, g_list_length(prefs.col_list)-1); + colnr -= 1; + prefs.col_list = g_list_insert(prefs.col_list, cfmt, colnr); } else { prefs.col_list = g_list_append(prefs.col_list, cfmt); } @@ -305,6 +309,8 @@ column_prefs_add_custom(gint fmt, const gchar *title, const gchar *custom_field, cfmt->visible = FALSE; /* Will be set to TRUE in visible_toggled() when added to list */ prefs.col_list = g_list_append(prefs.col_list, cfmt); } + + return colnr; } void |