Qt: Register import_hexdump.json as a profile file

Profile files which is only used in Qt is not automatically registered
during startup and must be explicit registered.

Add profile_register_persconffile() to handle this registration.
This commit is contained in:
Stig Bjørlykke 2021-09-21 10:38:05 +02:00 committed by Wireshark GitLab Utility
parent 0c735dcf0a
commit 533d859499
4 changed files with 24 additions and 9 deletions

View File

@ -182,6 +182,7 @@ libwsutil.so.0 libwsutil0 #MINVER#
plugins_get_descriptions@Base 1.12.0~rc1 plugins_get_descriptions@Base 1.12.0~rc1
printable_char_or_period@Base 1.99.0 printable_char_or_period@Base 1.99.0
profile_exists@Base 1.12.0~rc1 profile_exists@Base 1.12.0~rc1
profile_register_persconffile@Base 3.5.1
profile_store_persconffiles@Base 1.12.0~rc1 profile_store_persconffiles@Base 1.12.0~rc1
qword_to_hex@Base 3.5.1 qword_to_hex@Base 3.5.1
qword_to_hex_punct@Base 3.5.1 qword_to_hex_punct@Base 3.5.1

View File

@ -1040,10 +1040,11 @@ int main(int argc, char *qt_argv[])
} }
#endif /* HAVE_LIBPCAP */ #endif /* HAVE_LIBPCAP */
// UAT files used in configuration profiles which are used in Qt dialogs // UAT and UI settings files used in configuration profiles which are used
// are not registered during startup because they only get loaded when // in Qt dialogs are not registered during startup because they only get
// the dialog is shown. Register them here. // loaded when the dialog is shown. Register them here.
g_free(get_persconffile_path("io_graphs", TRUE)); profile_register_persconffile("io_graphs");
profile_register_persconffile("import_hexdump.json");
profile_store_persconffiles(FALSE); profile_store_persconffiles(FALSE);

View File

@ -1218,6 +1218,15 @@ profile_store_persconffiles(gboolean store)
do_store_persconffiles = store; do_store_persconffiles = store;
} }
void
profile_register_persconffile(const char *filename)
{
if (do_store_persconffiles && !g_hash_table_lookup (profile_files, filename)) {
/* Store filenames so we know which filenames belongs to a configuration profile */
g_hash_table_insert (profile_files, g_strdup(filename), g_strdup(filename));
}
}
/* /*
* Get the directory in which personal configuration files reside. * Get the directory in which personal configuration files reside.
* *
@ -1846,12 +1855,10 @@ get_persconffile_path(const char *filename, gboolean from_profile)
{ {
char *path, *dir = NULL; char *path, *dir = NULL;
if (do_store_persconffiles && from_profile && !g_hash_table_lookup (profile_files, filename)) {
/* Store filenames so we know which filenames belongs to a configuration profile */
g_hash_table_insert (profile_files, g_strdup(filename), g_strdup(filename));
}
if (from_profile) { if (from_profile) {
/* Store filenames so we know which filenames belongs to a configuration profile */
profile_register_persconffile(filename);
dir = get_persconffile_dir(persconfprofile); dir = get_persconffile_dir(persconfprofile);
} else { } else {
dir = get_persconffile_dir(NULL); dir = get_persconffile_dir(NULL);

View File

@ -146,6 +146,12 @@ WS_DLL_PUBLIC char *get_global_profiles_dir(void);
*/ */
WS_DLL_PUBLIC void profile_store_persconffiles(gboolean store); WS_DLL_PUBLIC void profile_store_persconffiles(gboolean store);
/*
* Register a filename to the personal config files storage.
* This is for files which are not read using get_persconffile_path() during startup.
*/
WS_DLL_PUBLIC void profile_register_persconffile(const char *filename);
/* /*
* Check if given configuration profile exists. * Check if given configuration profile exists.
*/ */