~ubuntu-branches/ubuntu/gutsy/wireshark/gutsy-security

« back to all changes in this revision

Viewing changes to gtk/recent.c

  • Committer: Bazaar Package Importer
  • Author(s): Frederic Peters
  • Date: 2007-04-01 08:58:40 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20070401085840-or3qhrpv8alt1bwg
Tags: 0.99.5-1
* New upstream release.
* debian/patches/09_idl2wrs.dpatch: updated to patch idl2wrs.sh.in.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 * Recent "preference" handling routines
3
3
 * Copyright 2004, Ulf Lamping <ulf.lamping@web.de>
4
4
 *
5
 
 * $Id: recent.c 19749 2006-10-31 01:51:39Z gerald $
 
5
 * $Id: recent.c 20417 2007-01-13 16:06:28Z gal $
6
6
 *
7
7
 * Wireshark - Network traffic analyzer
8
8
 * By Gerald Combs <gerald@wireshark.org>
47
47
#include "cfilter_combo_utils.h"
48
48
#include "simple_dialog.h"
49
49
#include "file_util.h"
 
50
#include "u3.h"
50
51
 
51
52
#define RECENT_KEY_MAIN_TOOLBAR_SHOW        "gui.toolbar_main_show"
52
53
#define RECENT_KEY_FILTER_TOOLBAR_SHOW      "gui.filter_toolbar_show"
76
77
recent_settings_t recent;
77
78
 
78
79
static const char *ts_type_text[] =
79
 
        { "RELATIVE", "ABSOLUTE", "ABSOLUTE_WITH_DATE", "DELTA", NULL };
 
80
        { "RELATIVE", "ABSOLUTE", "ABSOLUTE_WITH_DATE", "DELTA", "EPOCH", NULL };
80
81
 
81
82
static const char *ts_precision_text[] =
82
83
        { "AUTO", "SEC", "DSEC", "CSEC", "MSEC", "USEC", "NSEC", NULL };
207
208
                  recent.packet_list_colorize == TRUE ? "TRUE" : "FALSE");
208
209
 
209
210
  fprintf(rf, "\n# Timestamp display format.\n");
210
 
  fprintf(rf, "# One of: RELATIVE, ABSOLUTE, ABSOLUTE_WITH_DATE, DELTA\n");
 
211
  fprintf(rf, "# One of: RELATIVE, ABSOLUTE, ABSOLUTE_WITH_DATE, DELTA, EPOCH\n");
211
212
  fprintf(rf, RECENT_GUI_TIME_FORMAT ": %s\n",
212
213
          ts_type_text[recent.gui_time_format]);
213
214
 
259
260
 
260
261
  if (get_last_open_dir() != NULL) {
261
262
    fprintf(rf, "\n# Last directory navigated to in File Open dialog.\n");
262
 
    fprintf(rf, RECENT_GUI_FILEOPEN_REMEMBERED_DIR ": %s\n", get_last_open_dir());
 
263
 
 
264
    if(u3_active())
 
265
      fprintf(rf, RECENT_GUI_FILEOPEN_REMEMBERED_DIR ": %s\n", u3_contract_device_path(get_last_open_dir()));
 
266
    else
 
267
      fprintf(rf, RECENT_GUI_FILEOPEN_REMEMBERED_DIR ": %s\n", get_last_open_dir());
263
268
  }
264
269
 
265
270
  window_geom_recent_write_all(rf);
297
302
 
298
303
 
299
304
/* set one user's recent file key/value pair */
300
 
static int
301
 
read_set_recent_pair_static(gchar *key, gchar *value)
 
305
static prefs_set_pref_e
 
306
read_set_recent_pair_static(gchar *key, gchar *value, void *private_data _U_)
302
307
{
303
308
  long num;
304
309
  char *p;
434
439
    recent.gui_geometry_status_pane = num;
435
440
    recent.has_gui_geometry_status_pane = TRUE;
436
441
  } else if (strcmp(key, RECENT_GUI_FILEOPEN_REMEMBERED_DIR) == 0) {
437
 
    set_last_open_dir(value);
 
442
    if(u3_active())
 
443
      set_last_open_dir(u3_expand_device_path(value));
 
444
    else
 
445
      set_last_open_dir(value);
438
446
  } else if (strncmp(key, RECENT_GUI_GEOMETRY, sizeof(RECENT_GUI_GEOMETRY)-1) == 0) {
439
447
    /* now have something like "gui.geom.main.x", split it into win and sub_key */
440
448
    char *win = &key[sizeof(RECENT_GUI_GEOMETRY)-1];
451
459
 
452
460
 
453
461
/* set one user's recent file key/value pair */
454
 
static int
455
 
read_set_recent_pair_dynamic(gchar *key, gchar *value)
 
462
static prefs_set_pref_e
 
463
read_set_recent_pair_dynamic(gchar *key, gchar *value, void *private_data _U_)
456
464
{
457
465
  if (strcmp(key, RECENT_KEY_CAPTURE_FILE) == 0) {
458
 
        add_menu_recent_capture_file(value);
 
466
    if(u3_active())
 
467
      add_menu_recent_capture_file(u3_expand_device_path(value));
 
468
    else
 
469
      add_menu_recent_capture_file(value);
459
470
  } else if (strcmp(key, RECENT_KEY_DISPLAY_FILTER) == 0) {
460
471
        dfilter_combo_add_recent(value);
461
472
  } else if (strcmp(key, RECENT_KEY_CAPTURE_FILTER) == 0) {
502
513
                return PREFS_SET_SYNTAX_ERR;
503
514
        }
504
515
 
505
 
        ret = read_set_recent_pair_static(prefarg, p);
 
516
        ret = read_set_recent_pair_static(prefarg, p, NULL);
506
517
        *colonp = ':';  /* put the colon back */
507
518
        return ret;
508
519
}
560
571
  *rf_path_return = NULL;
561
572
  if ((rf = eth_fopen(rf_path, "r")) != NULL) {
562
573
    /* We succeeded in opening it; read it. */
563
 
    read_prefs_file(rf_path, rf, read_set_recent_pair_static);
 
574
    read_prefs_file(rf_path, rf, read_set_recent_pair_static, NULL);
564
575
    fclose(rf);
565
576
    g_free(rf_path);
566
577
    rf_path = NULL;
592
603
  *rf_path_return = NULL;
593
604
  if ((rf = eth_fopen(rf_path, "r")) != NULL) {
594
605
    /* We succeeded in opening it; read it. */
595
 
    read_prefs_file(rf_path, rf, read_set_recent_pair_dynamic);
 
606
    read_prefs_file(rf_path, rf, read_set_recent_pair_dynamic, NULL);
596
607
        /* set dfilter combobox to have an empty line */
597
608
    dfilter_combo_add_empty();
598
609
    fclose(rf);