ui: Refactoring column_prefs_add_custom

Unify column_prefs_add_custom() and column_prefs_add_custom_with_position()
because the former is unused in the current implementation.

Remove the unused custom_occurrence parameter.

Change-Id: Ib018b9dc614674fc175810827ef789ef469059eb
Reviewed-on: https://code.wireshark.org/review/33760
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
Stig Bjørlykke 2019-06-27 22:00:11 +02:00 committed by Anders Broman
parent a854811c4a
commit 15cae4650f
3 changed files with 5 additions and 27 deletions

View File

@ -154,13 +154,7 @@ 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, -1);
}
gint
column_prefs_add_custom_with_position(gint fmt, const gchar *title, const gchar *custom_fields, gint custom_occurrence, gint position)
column_prefs_add_custom(gint fmt, const gchar *title, const gchar *custom_fields, gint position)
{
GList *clp;
fmt_data *cfmt, *last_cfmt;
@ -175,7 +169,7 @@ column_prefs_add_custom_with_position(gint fmt, const gchar *title, const gchar
cfmt->title = g_strdup(title);
cfmt->fmt = fmt;
cfmt->custom_fields = g_strdup(custom_fields);
cfmt->custom_occurrence = custom_occurrence;
cfmt->custom_occurrence = 0;
cfmt->resolved = TRUE;
colnr = g_list_length(prefs.col_list);

View File

@ -63,29 +63,13 @@ extern gboolean prefs_store_ext_multiple(const char * module, GHashTable * pref_
* @param fmt column format
* @param title column title
* @param custom_field column custom field
* @param custom_occurrence custom occurrence
* @param position the intended position of the insert
*
* @return The index of the inserted column
*/
gint column_prefs_add_custom(gint fmt, const gchar *title,
const gchar *custom_field,
gint custom_occurrence);
/** Add a custom column at the given position
*
* @param fmt column format
* @param title column title
* @param custom_field column custom field
* @param custom_occurrence custom occurrence
* @param position the intended position of the insert
*
* @return The index of the inserted column
*/
gint
column_prefs_add_custom_with_position(gint fmt, const gchar *title,
const gchar *custom_fields,
gint custom_occurrence,
gint position);
gint position);
/** Remove a column.
*

View File

@ -3776,7 +3776,7 @@ void MainWindow::insertColumn(QString name, QString abbrev, gint pos)
gint colnr = 0;
if ( name.length() > 0 && abbrev.length() > 0 )
{
colnr = column_prefs_add_custom_with_position(COL_CUSTOM, name.toStdString().c_str(), abbrev.toStdString().c_str(), 0, pos);
colnr = column_prefs_add_custom(COL_CUSTOM, name.toStdString().c_str(), abbrev.toStdString().c_str(), pos);
packet_list_->columnsChanged();
packet_list_->resizeColumnToContents(colnr);
prefs_main_write();