Store "Show Resolved" setting for custom columns.

svn path=/trunk/; revision=34220
This commit is contained in:
Stig Bjørlykke 2010-09-23 19:41:55 +00:00
parent a1b2b3cbcb
commit f5ab6c1930
2 changed files with 14 additions and 4 deletions

View File

@ -2037,22 +2037,27 @@ set_pref(gchar *pref_name, gchar *value, void *private_data _U_)
if (strncmp(col_l_elt->data, cust_format, cust_format_len) == 0) {
cfmt->fmt = g_strdup(cust_format);
prefs_fmt = g_strdup(col_l_elt->data);
cust_format_info = g_strsplit(&prefs_fmt[cust_format_len+1],":",2); /* add 1 for ':' */
cust_format_info = g_strsplit(&prefs_fmt[cust_format_len+1],":",3); /* add 1 for ':' */
cfmt->custom_field = g_strdup(cust_format_info[0]);
if (cfmt->custom_field && cust_format_info[1]) {
cfmt->custom_occurrence = (int)strtol(cust_format_info[1],NULL,10);
} else {
cfmt->custom_occurrence = 0;
}
if (cfmt->custom_field && cust_format_info[2]) {
cfmt->resolved = (cust_format_info[2][0] == 'U') ? FALSE : TRUE;
} else {
cfmt->resolved = TRUE;
}
g_strfreev(cust_format_info);
} else {
cfmt->fmt = g_strdup(col_l_elt->data);
prefs_fmt = g_strdup(cfmt->fmt);
cfmt->custom_field = NULL;
cfmt->custom_occurrence = 0;
cfmt->resolved = TRUE;
}
cfmt->visible = prefs_is_column_hidden (cols_hidden_list, prefs_fmt) ? FALSE : TRUE;
cfmt->resolved = TRUE;
g_free (prefs_fmt);
col_l_elt = col_l_elt->next;
prefs.col_list = g_list_append(prefs.col_list, cfmt);
@ -3077,7 +3082,8 @@ write_prefs(char **pf_path_return)
cfmt = (fmt_data *) clp->data;
col_l = g_list_append(col_l, g_strdup(cfmt->title));
if ((strcmp(cfmt->fmt, cust_format) == 0) && (cfmt->custom_field)) {
prefs_fmt = g_strdup_printf("%s:%s:%d", cfmt->fmt, cfmt->custom_field, cfmt->custom_occurrence);
prefs_fmt = g_strdup_printf("%s:%s:%d:%c", cfmt->fmt, cfmt->custom_field,
cfmt->custom_occurrence, cfmt->resolved ? 'R' : 'U');
col_l = g_list_append(col_l, prefs_fmt);
} else {
prefs_fmt = cfmt->fmt;

View File

@ -450,6 +450,10 @@ new_packet_list_toggle_resolved (GtkWidget *w, gint col_id)
if (g_object_get_data(G_OBJECT(w), "skip-update") == NULL) {
set_column_resolved (col_id, get_column_resolved (col_id) ? FALSE : TRUE);
if (!prefs.gui_use_pref_save) {
prefs_main_write();
}
new_packet_list_recreate();
}
}
@ -1496,7 +1500,7 @@ new_packet_list_recent_write_all(FILE *rf)
for (col = 0; col < num_cols; col++) {
col_fmt = get_column_format(col);
if (col_fmt == COL_CUSTOM) {
fprintf (rf, " %%Cus:%s,", get_column_custom_field(col));
fprintf (rf, " %%Cus:%s,", get_column_custom_field(col));
} else {
fprintf (rf, " %s,", col_format_to_string(col_fmt));
}