aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStig Bjørlykke <stig@bjorlykke.org>2019-06-27 22:00:11 +0200
committerAnders Broman <a.broman58@gmail.com>2019-06-30 13:08:40 +0000
commit15cae4650f711a6658480671e4f2d1fe891a1e43 (patch)
tree7b64d90dea1a9d7f9e598904a713ad4478f51182
parenta854811c4aa40d717c17499ead06cfec5f077fa5 (diff)
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>
-rw-r--r--ui/preference_utils.c10
-rw-r--r--ui/preference_utils.h20
-rw-r--r--ui/qt/main_window_slots.cpp2
3 files changed, 5 insertions, 27 deletions
diff --git a/ui/preference_utils.c b/ui/preference_utils.c
index 3ce241dc9e..70684f5a55 100644
--- a/ui/preference_utils.c
+++ b/ui/preference_utils.c
@@ -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);
diff --git a/ui/preference_utils.h b/ui/preference_utils.h
index 791eb55b1b..0b9eb656b8 100644
--- a/ui/preference_utils.h
+++ b/ui/preference_utils.h
@@ -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.
*
diff --git a/ui/qt/main_window_slots.cpp b/ui/qt/main_window_slots.cpp
index 909ce154e3..f82589624c 100644
--- a/ui/qt/main_window_slots.cpp
+++ b/ui/qt/main_window_slots.cpp
@@ -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();