packet-smb2: fix lease epoch fields
[metze/wireshark/wip.git] / ui / recent.h
1 /* recent.h
2  * Definitions for recent "preference" handling routines
3  * Copyright 2004, Ulf Lamping <ulf.lamping@web.de>
4  *
5  * $Id$
6  *
7  * Wireshark - Network traffic analyzer
8  * By Gerald Combs <gerald@wireshark.org>
9  * Copyright 1998 Gerald Combs
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License
13  * as published by the Free Software Foundation; either version 2
14  * of the License, or (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24  */
25
26 #ifndef __RECENT_H__
27 #define __RECENT_H__
28
29 #ifdef __cplusplus
30 extern "C" {
31 #endif /* __cplusplus */
32
33 #include <glib.h>
34
35 #include "epan/timestamp.h"
36 #include "ui/ui_util.h"
37
38 /** @file
39  *  Recent user interface settings.
40  *  @ingroup main_window_group
41  */
42
43 /** ???. */
44 #define RECENT_KEY_CAPTURE_FILE         "recent.capture_file"
45
46 /** ???. */
47 #define RECENT_KEY_DISPLAY_FILTER       "recent.display_filter"
48
49 #define RECENT_KEY_COL_WIDTH            "column.width"
50
51 #define RECENT_KEY_CAPTURE_FILTER       "recent.capture_filter"
52
53 #define RECENT_KEY_REMOTE_HOST          "recent.remote_host"
54
55 typedef struct _col_width_data {
56   gint   cfmt;
57   gchar *cfield;
58   gint   width;
59   gchar  xalign;
60 } col_width_data;
61
62 /** Defines used in col_width_data.xalign */
63 #define COLUMN_XALIGN_DEFAULT  0
64 #define COLUMN_XALIGN_LEFT    'L'
65 #define COLUMN_XALIGN_CENTER  'C'
66 #define COLUMN_XALIGN_RIGHT   'R'
67
68 /** Recent settings. */
69 typedef struct recent_settings_tag {
70     gboolean    main_toolbar_show;
71     gboolean    filter_toolbar_show;
72     gboolean    wireless_toolbar_show;
73     gboolean    airpcap_driver_check_show;
74     gboolean    packet_list_show;
75     gboolean    tree_view_show;
76     gboolean    byte_view_show;
77     gboolean    statusbar_show;
78     gboolean    packet_list_colorize;
79     ts_type     gui_time_format;
80     gint        gui_time_precision;
81     ts_seconds_type gui_seconds_format;
82     gint        gui_zoom_level;
83     gint        gui_bytes_view;
84
85     gint        gui_geometry_main_x;
86     gint        gui_geometry_main_y;
87     gint        gui_geometry_main_width;
88     gint        gui_geometry_main_height;
89
90     gboolean    gui_geometry_main_maximized;
91
92     gboolean    has_gui_geometry_main_upper_pane;   /* gui_geometry_main_upper_pane is valid */
93     gint        gui_geometry_main_upper_pane;
94     gboolean    has_gui_geometry_main_lower_pane;   /* gui_geometry_main_lower_pane is valid */
95     gint        gui_geometry_main_lower_pane;
96     gboolean    has_gui_geometry_status_pane;       /* gui_geometry_status_pane is valid */
97     gint        gui_geometry_status_pane_left;
98     gint        gui_geometry_status_pane_right;
99     gint        gui_geometry_wlan_stats_pane;
100     gboolean    privs_warn_if_elevated;
101     gboolean    privs_warn_if_no_npf;
102     GList      *col_width_list;                     /* column widths */
103     gchar      *gui_fileopen_remembered_dir;        /* folder of last capture loaded in File Open dialog */
104 } recent_settings_t;
105
106 /** Global recent settings. */
107 extern recent_settings_t recent;
108
109 /** Write recent settings file.
110  *
111  * @return TRUE if succeeded, FALSE if failed
112  */
113 extern gboolean write_recent(void);
114
115 /** Write profile recent settings file.
116  *
117  * @return TRUE if succeeded, FALSE if failed
118  */
119 extern gboolean write_profile_recent(void);
120
121 /** Read recent settings file (static part).
122  *
123  * @param rf_path_return path to recent file if function failed
124  * @param rf_errno_return if failed
125  */
126 extern void recent_read_static(char **rf_path_return, int *rf_errno_return);
127
128 /** Read profile recent settings file (static part).
129  *
130  * @param rf_path_return path to recent file if function failed
131  * @param rf_errno_return if failed
132  */
133 extern void recent_read_profile_static(char **rf_path_return, int *rf_errno_return);
134
135 /** Read recent settings file (dynamic part).
136  *
137  * @param rf_path_return path to recent file if function failed
138  * @param rf_errno_return if failed
139  */
140 extern void recent_read_dynamic(char **rf_path_return, int *rf_errno_return);
141
142 /**
143  * Given a -o command line string, parse it and set the recent value in
144  * question.  Return an indication of whether it succeeded or failed
145  * in some fashion.
146  *
147  * @param prefarg a string of the form "<recent name>:<recent value>", as might appear
148  * as an argument to a "-o" command line option
149  * @return PREFS_SET_OK or PREFS_SET_SYNTAX_ERR
150  */
151 extern int recent_set_arg(char *prefarg);
152
153 /** Get the column width for the given column
154  *
155  * @param col column number
156  */
157 extern gint recent_get_column_width(gint col);
158
159 /** Set the column width for the given column
160  *
161  * @param col column number
162  * @param width column width
163  */
164 extern void recent_set_column_width(gint col, gint width);
165
166 /** Get the column xalign for the given column
167  *
168  * @param col column number
169  */
170 extern gchar recent_get_column_xalign(gint col);
171
172 /** Set the column xalign for the given column
173  *
174  * @param col column number
175  * @param xalign column alignment
176  */
177 extern void recent_set_column_xalign(gint col, gchar xalign);
178
179 /* save the window and its current geometry into the geometry hashtable */
180 extern void window_geom_save(const gchar *name, window_geometry_t *geom);
181
182 /* load the desired geometry for this window from the geometry hashtable */
183 extern gboolean window_geom_load(const gchar *name, window_geometry_t *geom);
184
185 /**
186  * Returns a list of recent capture filters.
187  *
188  * @param ifname interface name; NULL refers to the global list.
189  */
190 extern GList *recent_get_cfilter_list(const gchar *ifname);
191
192 /**
193  * Add a capture filter to the global recent capture filter list or
194  * the recent capture filter list for an interface.
195  *
196  * @param ifname interface name; NULL refers to the global list.
197  * @param s text of capture filter
198  */
199 extern void recent_add_cfilter(const gchar *ifname, const gchar *s);
200
201 #ifdef __cplusplus
202 }
203 #endif /* __cplusplus */
204
205 #endif /* recent.h */
206
207 /*
208  * Editor modelines
209  *
210  * Local Variables:
211  * c-basic-offset: 4
212  * tab-width: 8
213  * indent-tabs-mode: nil
214  * End:
215  *
216  * ex: set shiftwidth=4 tabstop=8 expandtab:
217  * :indentSize=4:tabSize=8:noTabs=true:
218  */