2021-11-30 13:01:36 +00:00
|
|
|
/** @file
|
|
|
|
*
|
2012-01-18 19:47:44 +00:00
|
|
|
* Routines called to write stuff to the recent file; their implementations
|
|
|
|
* are GUI-dependent, but the API's aren't
|
|
|
|
*
|
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
2018-04-30 07:47:58 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
*/
|
2012-01-18 19:47:44 +00:00
|
|
|
|
|
|
|
#ifndef __UI_RECENT_UTILS_H__
|
|
|
|
#define __UI_RECENT_UTILS_H__
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
Qt: Fix Recent Files Max Count at startup
The recent files are read from recent_common in main.cpp, which
happens before the prefs are read. (This is largely unavoidable,
as we need some things in recent first, notably the last used
preference Configuration Profile.)
That means we add the recent files before we've read the preference
that determines the maximum number of recent files, so it still
has its initial value of 10 - the number of files in recent_common
will be whatever value the last used Configuration Profile had
for the preference, and could be greater (or lesser) than 10.
It could also be different than the value for the preference
after the preferences are loaded, if Wireshark is started with
command line options like -C, -o, or -P.
Add a parameter so that on initial startup, when recent_common is
read, we add all the files to the list heedless of the pref value.
Add connections so that the Menu and the Welcome Page list update the
list of recent files whenever the Preferences are changed
(including from changing Configuration Profiles), because
that might change the max number of recent files.
Add a few guards for putting too many items in the recent common
file or the menu, for when the preference changes so that the
maximum count is lower than it was previously.
Fix #16782
2023-11-15 04:05:40 +00:00
|
|
|
/** Add a new recent capture filename to the "Recent Files" submenu
|
|
|
|
* (duplicates will be ignored)
|
|
|
|
*
|
|
|
|
* @param cf_name Capture filename to add
|
|
|
|
* @param force If true, then prefs.gui_recent_file_count_max will be
|
|
|
|
* ignored when adding the file. This is for startup, when the recent_common
|
|
|
|
* file is read before the prefs file. (It will be corrected later when
|
|
|
|
* prefs are read.)
|
|
|
|
*/
|
|
|
|
extern void add_menu_recent_capture_file(const gchar *cf_name, bool force);
|
2012-01-18 19:47:44 +00:00
|
|
|
|
|
|
|
/** Write all recent capture filenames to the user's recent file.
|
|
|
|
* @param rf recent file
|
|
|
|
*/
|
|
|
|
extern void menu_recent_file_write_all(FILE *rf);
|
|
|
|
|
|
|
|
/** Write all non-empty capture filters (until maximum count)
|
|
|
|
* of the combo box GList to the user's recent file.
|
|
|
|
*
|
|
|
|
* @param rf the recent file
|
|
|
|
*/
|
|
|
|
extern void cfilter_combo_recent_write_all(FILE *rf);
|
|
|
|
|
|
|
|
/** Add a display filter coming from the user's recent file to the dfilter combo box.
|
|
|
|
*
|
|
|
|
* @param dftext the filter string
|
|
|
|
*/
|
2012-12-26 05:57:06 +00:00
|
|
|
extern gboolean dfilter_combo_add_recent(const gchar *dftext);
|
2012-01-18 19:47:44 +00:00
|
|
|
|
|
|
|
/** Write all non-empty display filters (until maximum count)
|
|
|
|
* of the combo box GList to the user's recent file.
|
|
|
|
*
|
|
|
|
* @param rf the recent file
|
|
|
|
*/
|
|
|
|
extern void dfilter_recent_combo_write_all(FILE *rf);
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
|
|
|
#endif /* __UI_RECENT_UTILS_H__ */
|