Don't mark the file as unsaved unless the capture or packet comments actually changed.
svn path=/trunk/; revision=41744
This commit is contained in:
parent
4efb92a274
commit
9c1bf7223e
18
file.c
18
file.c
|
@ -3658,10 +3658,9 @@ cf_unignore_frame(capture_file *cf, frame_data *frame)
|
||||||
const gchar*
|
const gchar*
|
||||||
cf_read_shb_comment(capture_file *cf)
|
cf_read_shb_comment(capture_file *cf)
|
||||||
{
|
{
|
||||||
wtapng_section_t* shb_inf;
|
wtapng_section_t *shb_inf;
|
||||||
const gchar *temp_str;
|
const gchar *temp_str;
|
||||||
|
|
||||||
|
|
||||||
/* Get info from SHB */
|
/* Get info from SHB */
|
||||||
shb_inf = wtap_file_get_shb_info(cf->wth);
|
shb_inf = wtap_file_get_shb_info(cf->wth);
|
||||||
if(shb_inf == NULL)
|
if(shb_inf == NULL)
|
||||||
|
@ -3676,10 +3675,23 @@ cf_read_shb_comment(capture_file *cf)
|
||||||
void
|
void
|
||||||
cf_update_capture_comment(capture_file *cf, gchar *comment)
|
cf_update_capture_comment(capture_file *cf, gchar *comment)
|
||||||
{
|
{
|
||||||
|
wtapng_section_t *shb_inf;
|
||||||
|
|
||||||
/* Get info from SHB */
|
/* Get info from SHB */
|
||||||
wtap_write_shb_comment(cf->wth, comment);
|
shb_inf = wtap_file_get_shb_info(cf->wth);
|
||||||
|
|
||||||
|
/* See if the comment has changed or not */
|
||||||
|
if (shb_inf && shb_inf->opt_comment) {
|
||||||
|
if (strcmp(shb_inf->opt_comment, comment) == 0) {
|
||||||
|
g_free(comment);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* The comment has changed, let's update it */
|
||||||
|
wtap_write_shb_comment(cf->wth, comment);
|
||||||
|
/* Mark the file as unsaved */
|
||||||
|
cf->user_saved = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
|
@ -105,8 +105,7 @@ capture_comment_text_buff_ok_cb(GtkWidget *w _U_, GtkWidget *view)
|
||||||
/*g_warning("The new comment is '%s'",new_capture_comment);*/
|
/*g_warning("The new comment is '%s'",new_capture_comment);*/
|
||||||
cf_update_capture_comment(&cfile, new_capture_comment);
|
cf_update_capture_comment(&cfile, new_capture_comment);
|
||||||
|
|
||||||
/* Mark the file as unsaved, caues a popup asking to save the file if we quit the file */
|
/* Update the menus in case the file might need to be saved */
|
||||||
cfile.user_saved = FALSE;
|
|
||||||
set_menus_for_capture_file(&cfile);
|
set_menus_for_capture_file(&cfile);
|
||||||
|
|
||||||
window_destroy(edit_or_add_capture_comment_dlg);
|
window_destroy(edit_or_add_capture_comment_dlg);
|
||||||
|
|
|
@ -1733,9 +1733,20 @@ new_packet_list_update_packet_comment(gchar *new_packet_comment)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
record = new_packet_list_get_record(model, &iter);
|
record = new_packet_list_get_record(model, &iter);
|
||||||
|
|
||||||
|
/* Check if the comment has changed */
|
||||||
|
if (record->fdata->opt_comment) {
|
||||||
|
if (strcmp(record->fdata->opt_comment, new_packet_comment) == 0) {
|
||||||
|
g_free(new_packet_comment);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* The comment has changed, let's update it */
|
||||||
g_free(record->fdata->opt_comment);
|
g_free(record->fdata->opt_comment);
|
||||||
record->fdata->opt_comment = new_packet_comment;
|
record->fdata->opt_comment = new_packet_comment;
|
||||||
/* Mark the file as unsaved, caues a popup asking to save the file if we quit the file */
|
|
||||||
|
/* Mark the file as unsaved */
|
||||||
cfile.user_saved = FALSE;
|
cfile.user_saved = FALSE;
|
||||||
set_menus_for_capture_file(&cfile);
|
set_menus_for_capture_file(&cfile);
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,8 @@ wtap_file_tsprecision(wtap *wth)
|
||||||
return wth->tsprecision;
|
return wth->tsprecision;
|
||||||
}
|
}
|
||||||
|
|
||||||
wtapng_section_t* wtap_file_get_shb_info(wtap *wth)
|
wtapng_section_t *
|
||||||
|
wtap_file_get_shb_info(wtap *wth)
|
||||||
{
|
{
|
||||||
wtapng_section_t *shb_hdr;
|
wtapng_section_t *shb_hdr;
|
||||||
|
|
||||||
|
@ -114,21 +115,23 @@ wtapng_section_t* wtap_file_get_shb_info(wtap *wth)
|
||||||
return shb_hdr;
|
return shb_hdr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wtap_write_shb_comment(wtap *wth, gchar *comment)
|
void
|
||||||
|
wtap_write_shb_comment(wtap *wth, gchar *comment)
|
||||||
{
|
{
|
||||||
g_free(wth->shb_hdr.opt_comment);
|
g_free(wth->shb_hdr.opt_comment);
|
||||||
wth->shb_hdr.opt_comment = comment;
|
wth->shb_hdr.opt_comment = comment;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wtapng_iface_descriptions_t* wtap_file_get_idb_info(wtap *wth)
|
wtapng_iface_descriptions_t *
|
||||||
|
wtap_file_get_idb_info(wtap *wth)
|
||||||
{
|
{
|
||||||
wtapng_iface_descriptions_t *idb_info;
|
wtapng_iface_descriptions_t *idb_info;
|
||||||
|
|
||||||
idb_info = g_new(wtapng_iface_descriptions_t,1);
|
idb_info = g_new(wtapng_iface_descriptions_t,1);
|
||||||
|
|
||||||
idb_info->number_of_interfaces = wth->number_of_interfaces;
|
idb_info->number_of_interfaces = wth->number_of_interfaces;
|
||||||
idb_info->interface_data = wth->interface_data;
|
idb_info->interface_data = wth->interface_data;
|
||||||
|
|
||||||
return idb_info;
|
return idb_info;
|
||||||
}
|
}
|
||||||
|
@ -601,8 +604,8 @@ int wtap_register_encap_type(char* name, char* short_name) {
|
||||||
|
|
||||||
|
|
||||||
/* Name that should be somewhat descriptive. */
|
/* Name that should be somewhat descriptive. */
|
||||||
const char
|
const char *
|
||||||
*wtap_encap_string(int encap)
|
wtap_encap_string(int encap)
|
||||||
{
|
{
|
||||||
if (encap < WTAP_ENCAP_PER_PACKET || encap >= WTAP_NUM_ENCAP_TYPES)
|
if (encap < WTAP_ENCAP_PER_PACKET || encap >= WTAP_NUM_ENCAP_TYPES)
|
||||||
return "Illegal";
|
return "Illegal";
|
||||||
|
@ -613,8 +616,8 @@ const char
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Name to use in, say, a command-line flag specifying the type. */
|
/* Name to use in, say, a command-line flag specifying the type. */
|
||||||
const char
|
const char *
|
||||||
*wtap_encap_short_string(int encap)
|
wtap_encap_short_string(int encap)
|
||||||
{
|
{
|
||||||
if (encap < WTAP_ENCAP_PER_PACKET || encap >= WTAP_NUM_ENCAP_TYPES)
|
if (encap < WTAP_ENCAP_PER_PACKET || encap >= WTAP_NUM_ENCAP_TYPES)
|
||||||
return "illegal";
|
return "illegal";
|
||||||
|
@ -664,8 +667,8 @@ static const char *wtap_errlist[] = {
|
||||||
};
|
};
|
||||||
#define WTAP_ERRLIST_SIZE (sizeof wtap_errlist / sizeof wtap_errlist[0])
|
#define WTAP_ERRLIST_SIZE (sizeof wtap_errlist / sizeof wtap_errlist[0])
|
||||||
|
|
||||||
const char
|
const char *
|
||||||
*wtap_strerror(int err)
|
wtap_strerror(int err)
|
||||||
{
|
{
|
||||||
static char errbuf[128];
|
static char errbuf[128];
|
||||||
unsigned int wtap_errlist_index;
|
unsigned int wtap_errlist_index;
|
||||||
|
@ -845,19 +848,19 @@ wtap_read_so_far(wtap *wth)
|
||||||
return file_tell_raw(wth->fh);
|
return file_tell_raw(wth->fh);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wtap_pkthdr*
|
struct wtap_pkthdr *
|
||||||
wtap_phdr(wtap *wth)
|
wtap_phdr(wtap *wth)
|
||||||
{
|
{
|
||||||
return &wth->phdr;
|
return &wth->phdr;
|
||||||
}
|
}
|
||||||
|
|
||||||
union wtap_pseudo_header*
|
union wtap_pseudo_header *
|
||||||
wtap_pseudoheader(wtap *wth)
|
wtap_pseudoheader(wtap *wth)
|
||||||
{
|
{
|
||||||
return &wth->pseudo_header;
|
return &wth->pseudo_header;
|
||||||
}
|
}
|
||||||
|
|
||||||
guint8*
|
guint8 *
|
||||||
wtap_buf_ptr(wtap *wth)
|
wtap_buf_ptr(wtap *wth)
|
||||||
{
|
{
|
||||||
return buffer_start_ptr(wth->frame_buffer);
|
return buffer_start_ptr(wth->frame_buffer);
|
||||||
|
|
Loading…
Reference in New Issue