summaryrefslogtreecommitdiff
path: root/gtk
diff options
context:
space:
mode:
authorStig Bjørlykke <stig@bjorlykke.org>2008-06-14 16:45:06 +0000
committerStig Bjørlykke <stig@bjorlykke.org>2008-06-14 16:45:06 +0000
commit98325a69c91319ed2559227a22f80b6448cc171c (patch)
tree48758e9f49129e06973700c4d47a238dd45b756e /gtk
parentff8881072b25a4986e2336cb6a49b84d9cdc579b (diff)
downloadwireshark-98325a69c91319ed2559227a22f80b6448cc171c.tar.gz
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
Diffstat (limited to 'gtk')
-rw-r--r--gtk/main_packet_list.c10
-rw-r--r--gtk/recent.c40
-rw-r--r--gtk/recent.h7
3 files changed, 56 insertions, 1 deletions
diff --git a/gtk/main_packet_list.c b/gtk/main_packet_list.c
index 5a345ed1cd..a03aab2c32 100644
--- a/gtk/main_packet_list.c
+++ b/gtk/main_packet_list.c
@@ -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
diff --git a/gtk/recent.c b/gtk/recent.c
index afa7334b9b..28da76e9ec 100644
--- a/gtk/recent.c
+++ b/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);
+ }
+}
diff --git a/gtk/recent.h b/gtk/recent.h
index 697c6892f9..1be017a4b1 100644
--- a/gtk/recent.h
+++ b/gtk/recent.h
@@ -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 */