summaryrefslogtreecommitdiff
path: root/ui/preference_utils.c
AgeCommit message (Collapse)AuthorFilesLines
2017-01-22Internalize struct preferenceMichael Mann1-10/+2
Move "struct preference" into prefs.c, essentially creating a "private" structure to handle preferences. The 2 motivating factors were: 1. Better memory management so that clients/users of API don't have to worry about it. 2. Hide the ugliness of the union stuff and make it transparent to the API. A few bugs related to preference <-> Decode As integration were fixed while in the neighborhood. Change-Id: I509b9a236235d066b139c98222b701475e0ed365 Reviewed-on: https://code.wireshark.org/review/19578 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-01-07Refactor range preference.Michael Mann1-277/+0
Refactored so that all handling of ranges in struct preference can be internal to prefs.c Change-Id: I68577909f9c07b23a16ab3443a523355d4645314 Reviewed-on: https://code.wireshark.org/review/19577 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-01-07Convert range API to always use wmem memory.Michael Mann1-9/+9
This is mostly to address memory leaks in range preferences (the biggest user of range functionality) on shutdown. Now range preferences must use epan scoped memory when referencing internal preference structures to keep consistency. Change-Id: Idc644f59b5b42fa1d46891542b53ff13ea754157 Reviewed-on: https://code.wireshark.org/review/19387 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Peter Wu <peter@lekensteyn.nl> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-10-08Combine Decode As and port preferences for tcp.port dissector table.Michael Mann1-7/+93
This patch introduces new APIs to allow dissectors to have a preference for a (TCP) port, but the underlying data is actually part of Decode As functionality. For now the APIs are intentionally separate from the regular APIs that register a dissector within a dissector table. It may be possible to eventually combine the two so that all dissectors that register with a dissector table have an opportunity to "automatically" have a preference to adjust the "table value" through the preferences dialog. The tcp.port dissector table was used as the guinea pig. This will eventually be expanded to other dissector tables as well (most notably UDP ports). Some dissectors that "shared" a TCP/UDP port preference were also converted. It also removed the need for some preference callback functions (mostly when the callback function was the proto_reg_handoff function) so there is cleanup around that. Dissectors that has a port preference whose default was 0 were switched to using the dissector_add_for_decode_as_with_preference API rather than dissector_add_uint_with_preference Also added comments for TCP ports used that aren't IANA registered. Change-Id: I99604f95d426ad345f4b494598d94178b886eb67 Reviewed-on: https://code.wireshark.org/review/17724 Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-01-26prefutils: Add convenience functionRoland Knall1-2/+45
This is a convenience function for allowing multiple key/values to be saved to the preference system, without having to reference pref_t or the real underlying value. It is used by the extcap save functionality, to store the saved values Change-Id: I1c8bf787db8ed2d17628024ec1cd19073e49d017 Reviewed-on: https://code.wireshark.org/review/13471 Petri-Dish: Roland Knall <rknall@gmail.com> Reviewed-by: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Roland Knall <rknall@gmail.com>
2016-01-08Fix warnings for epan/prefs.c [-Wcast-qual]João Valverde1-2/+2
Change-Id: I86032d624ee37edc86a868eb2aaaffce81a8807b Reviewed-on: https://code.wireshark.org/review/12719 Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: João Valverde <j@v6e.pt>
2015-12-20Qt: Add missing multi-field column validationMichal Labedzki1-4/+4
GTK already has it, but Qt forgot about it, so multi-field custom column works ok if previously saved in GTK-shark. Invalid validation prevent from modifying and saving multi-field custom column in Qt version. While at it, rename "custom field" to "custom fields" to ensure we think about multi-field custom column. Change-Id: I99588150ccb38be11b75f5dd5b0f6443e7055ebb Reviewed-on: https://code.wireshark.org/review/12685 Petri-Dish: Michal Labedzki <michal.labedzki@tieto.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-12-13Start deprecating the capture info API.Gerald Combs1-1/+1
The GTK+ UI has a capture info dialog which shows a summary of captured protocols, including IPX (!), NetBIOS (!!) and VINES (!!OMG!!). It's been disabled by default since 2006 (g59aa9e40). Remove the preference in the Qt UI capture pane. It's still available via the advanced prefs. Add comments in various parts of the code noting that the capture_info routines and structs are GTK+ only. Also note that if we *do* want to add a Qt capture info dialog we'll probably want to modernize the information we show. Change-Id: I3c63f6f01b60f0767fb33602a7f0c3b537dbde51 Reviewed-on: https://code.wireshark.org/review/10991 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-06-25Plugin Interface: Add GUI callbacksRoland Knall1-0/+42
Rename ext_menubar to a more appropriate plugin_if. External menus can be implemented by plugins to present additional menus for deep-packet analysis. One side-effect of such menus being implemented as plugins is, that they are being executed in different threads and therefore can only use limited access to the main GUI. Also, there is no safe cross-gui (GTK and Qt) way for many features. This patch implements a first functionality, by which a plugin implemented using ext_menubar can apply a display filter to the main view. For now the implementation supports filtering, as well as saving a preference. Change-Id: Iffe4caa954bbeb8ce356352de4dae348a50efba9 Reviewed-on: https://code.wireshark.org/review/8773 Reviewed-by: Roland Knall <rknall@gmail.com> Petri-Dish: Anders Broman <a.broman58@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-05-15Qt: Implement "Apply as Column" for packet contextRoland Knall1-2/+8
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>
2015-01-01Remove unneeded includes from ui folderMartin Mathieson1-2/+0
Change-Id: Ifd1eebff9080cd3867e44e4dcb2d2681370ed60a Reviewed-on: https://code.wireshark.org/review/6128 Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
2014-03-04Remove all $Id$ from top of fileAlexis La Goutte1-2/+0
(Using sed : sed -i '/^ \* \$Id\$/,+1 d') Fix manually some typo (in export_object_dicom.c and crc16-plain.c) Change-Id: I4c1ae68d1c4afeace8cb195b53c715cf9e1227a8 Reviewed-on: https://code.wireshark.org/review/497 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-02-25Remove trailing whitespaceBill Meier1-1/+1
Change-Id: I8116f63ff88687c8db3fd6e8e23b22ab2f759af0 Reviewed-on: https://code.wireshark.org/review/385 Reviewed-by: Bill Meier <wmeier@newsguy.com> Tested-by: Bill Meier <wmeier@newsguy.com>
2013-11-17Move the epan/filesystem.c routines to wsutil; they're not specific toGuy Harris1-1/+1
packet dissection, they're specific to the entire Wireshark suite of programs. svn path=/trunk/; revision=53377
2013-10-18After looking for something in the column-*.h files andJörg Mayer1-1/+1
not finding it, I finally found it in column_info.h Renamed column_info.h to column-info.h to have consistency with the column*h files. svn path=/trunk/; revision=52667
2013-03-20 From beroset:Bill Meier1-1/+1
remove C++ incompatibilities https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8416 attachment #10397 svn path=/trunk/; revision=48438
2013-02-08Add a directory name preference type (PREF_DIRNAME) and registrationGerald Combs1-0/+4
routine (prefs_register_directory_preference). Add PREF_FILENAME and PREF_DIRNAME support to the Qt module preferences. Change a couple of preferences to directory names. Clean up some names and default settings. svn path=/trunk/; revision=47573
2013-01-23Add column preferences.Gerald Combs1-0/+57
svn path=/trunk/; revision=47231
2013-01-18Don't call prefs_airpcap_update() for now. Remove some debugging code.Gerald Combs1-3/+1
svn path=/trunk/; revision=47141
2013-01-18Fix compilation on Windows.Gerald Combs1-8/+0
svn path=/trunk/; revision=47140
2013-01-18Rename the "saved_val" preference element to "stashed_val" in order toGerald Combs1-0/+295
more clearly indicate that it's a copy of a preference value rather than something we've saved in the preferences file. Update prefs_pref_to_str() to handle default, stashed, and current prefs. Create ui/preference_utils.[ch] and move some common routines there. Use prefs_pref_type_name() in the GTK+ preferences dialog. Make the "OK" button in the Qt preferences dialog work. We simply write the prefs and redissect on "OK" and do nothing on "Cancel". This is intentionally different from the Apply/OK/Cancel behavior in the GTK+ version. Add a general "emitAppSignal" method to wsApp and use it for packet dissection and preference changes. Suggest that we might want to create a WsString class to make conversion between QStrings, gchar *s, and GStrings easier. svn path=/trunk/; revision=47139