forked from osmocom/wireshark
Save the column width in the recent list on every change so we can
pick the correct width when changing the time precision. svn path=/trunk/; revision=25451
This commit is contained in:
parent
ff8881072b
commit
98325a69c9
|
@ -255,6 +255,12 @@ packet_list_click_column_cb(GtkCList *clist, gint column, gpointer data)
|
|||
gtk_clist_sort(clist);
|
||||
}
|
||||
|
||||
static void
|
||||
packet_list_resize_column_cb(GtkCList *clist _U_, gint column, gint width, gpointer data _U_)
|
||||
{
|
||||
recent_set_column_width (column, width);
|
||||
}
|
||||
|
||||
/* What to do when a list item is selected/unselected */
|
||||
static void
|
||||
packet_list_select_cb(GtkWidget *w _U_, gint row, gint col _U_, GdkEventButton *event _U_, gpointer evt _U_) {
|
||||
|
@ -598,7 +604,9 @@ packet_list_set_column_titles(void)
|
|||
}
|
||||
gtk_clist_column_titles_show(GTK_CLIST(packet_list));
|
||||
g_signal_connect(packet_list, "click-column", G_CALLBACK(packet_list_click_column_cb),
|
||||
col_arrows);
|
||||
col_arrows);
|
||||
g_signal_connect(packet_list, "resize-column", G_CALLBACK(packet_list_resize_column_cb),
|
||||
NULL);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
40
gtk/recent.c
40
gtk/recent.c
|
@ -911,3 +911,43 @@ recent_get_column_width(gint col)
|
|||
|
||||
return -1;
|
||||
}
|
||||
|
||||
void
|
||||
recent_set_column_width(gint col, gint width)
|
||||
{
|
||||
GList *col_l;
|
||||
col_width_data *col_w;
|
||||
gint cfmt;
|
||||
const gchar *cfield = NULL;
|
||||
gboolean found = FALSE;
|
||||
|
||||
cfmt = get_column_format(col);
|
||||
if (cfmt == COL_CUSTOM) {
|
||||
cfield = get_column_custom_field(col);
|
||||
}
|
||||
|
||||
col_l = g_list_first(recent.col_width_list);
|
||||
while (col_l) {
|
||||
col_w = (col_width_data *) col_l->data;
|
||||
if (col_w->cfmt == cfmt) {
|
||||
if (cfmt != COL_CUSTOM || strcmp (cfield, col_w->cfield) == 0) {
|
||||
col_w->width = width;
|
||||
found = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
col_l = col_l->next;
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
col_w = (col_width_data *) g_malloc(sizeof(col_width_data));
|
||||
col_w->cfmt = cfmt;
|
||||
if (cfield) {
|
||||
col_w->cfield = g_strdup(cfield);
|
||||
} else {
|
||||
col_w->cfield = NULL;
|
||||
}
|
||||
col_w->width = width;
|
||||
recent.col_width_list = g_list_append(recent.col_width_list, col_w);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -142,4 +142,11 @@ extern int recent_set_arg(char *prefarg);
|
|||
*/
|
||||
extern gint recent_get_column_width(gint col);
|
||||
|
||||
/** Set the column width for the given column
|
||||
*
|
||||
* @param col column number
|
||||
* @param width column width
|
||||
*/
|
||||
extern void recent_set_column_width(gint col, gint width);
|
||||
|
||||
#endif /* recent.h */
|
||||
|
|
Loading…
Reference in New Issue