summaryrefslogtreecommitdiff
path: root/epan
diff options
context:
space:
mode:
authorRoland Knall <roland.knall@br-automation.com>2017-06-27 16:36:19 +0200
committerRoland Knall <rknall@gmail.com>2017-06-28 15:09:03 +0000
commit8020be30fd46798aa61017f0ec936806d6495d07 (patch)
tree3066cad0abaaf66d537455e1ea35488c8ce76ae9 /epan
parent9731b50bc501673a98b588be3ae6f43492ae3150 (diff)
downloadwireshark-8020be30fd46798aa61017f0ec936806d6495d07.tar.gz
Qt: Drag/Drop Filter buttons to order
Allow the ordering of the filter buttons via drag/drop in the toolbar Change-Id: Id8793d6514bae36066a7a23d6890985665e753bd Reviewed-on: https://code.wireshark.org/review/22422 Petri-Dish: Roland Knall <rknall@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Roland Knall <rknall@gmail.com>
Diffstat (limited to 'epan')
-rw-r--r--epan/uat-int.h6
-rw-r--r--epan/uat.c14
2 files changed, 20 insertions, 0 deletions
diff --git a/epan/uat-int.h b/epan/uat-int.h
index c36a5c136e..a272c8f209 100644
--- a/epan/uat-int.h
+++ b/epan/uat-int.h
@@ -112,6 +112,12 @@ WS_DLL_PUBLIC
void uat_remove_record_idx(uat_t *uat, guint rec_idx);
/**
+ * Moves the entry from the old position to the new one
+ */
+WS_DLL_PUBLIC
+void uat_move_index(uat_t *uat, guint old_idx, guint new_idx);
+
+/**
* Removes and destroys all records from the UAT.
*/
WS_DLL_PUBLIC
diff --git a/epan/uat.c b/epan/uat.c
index 71403485b7..03f73d2a34 100644
--- a/epan/uat.c
+++ b/epan/uat.c
@@ -225,6 +225,20 @@ void uat_remove_record_idx(uat_t* uat, guint idx) {
g_array_remove_index(uat->valid_data, idx);
}
+void uat_move_index(uat_t * uat, guint old_idx, guint new_idx)
+{
+ guint dir = 1;
+ guint start = old_idx;
+ if ( old_idx > new_idx )
+ dir = -1;
+
+ while ( start != new_idx )
+ {
+ uat_swap(uat, start, start + dir);
+ start += dir;
+ }
+}
+
/* The returned filename was g_malloc()'d so the caller must free it */
gchar* uat_get_actual_filename(uat_t* uat, gboolean for_writing) {
gchar *pers_fname = NULL;