~ubuntu-branches/ubuntu/lucid/aptitude/lucid-proposed

« back to all changes in this revision

Viewing changes to src/apt_options.cc

  • Committer: Bazaar Package Importer
  • Author(s): Michael Vogt
  • Date: 2008-05-27 10:28:10 UTC
  • mfrom: (1.2.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20080527102810-pxc090mnjkr4xlek
Tags: 0.4.11.2-1ubuntu1
* Merge from debian unstable, remaining changes:
  - 03_branding.dpatch: ubuntu branding
  - 04_changelog.dpatch: take changelogs from changelogs.ubuntu.com
  - 07_hide_recommends_warning.dpatch: do not show a warning about
    missing recommends
  - 08_ubuntu_default_source.dpatch: do not clean lists directory
    on transient network failures
  - 11_gxx43.dpatch:build tests without -Werror
* Updated:
  - 03_branding.dpatch
* Disabled 07_hide_recommends warning because we do install 
  recommends now by default too

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
// apt_options.cc
2
2
//
3
 
//   Copyright (C) 2000, 2007 Daniel Burrows
 
3
//   Copyright (C) 2000, 2007-2008 Daniel Burrows
4
4
//
5
5
//   This program is free software; you can redistribute it and/or
6
6
//   modify it under the terms of the GNU General Public License as
63
63
struct option_item
64
64
{
65
65
  enum {OPTION_BOOL, OPTION_STRING, OPTION_RADIO, OPTION_END} type;
66
 
  const char *description;
67
 
  const char *long_description;
 
66
  const char *untranslated_description;
 
67
  const char *untranslated_long_description;
68
68
  const char *option_name;
69
69
 
70
70
  union
79
79
  vector<radio_choice> choices;
80
80
 
81
81
  option_item()
82
 
    :type(OPTION_END), description(NULL), option_name(NULL)
 
82
    :type(OPTION_END), untranslated_description(NULL), option_name(NULL)
83
83
  {
84
84
  }
85
85
 
86
 
  option_item(const char *_description,
87
 
              const char *_long_description,
 
86
  option_item(const char *_untranslated_description,
 
87
              const char *_untranslated_long_description,
88
88
              const char *_option_name, bool def)
89
89
    :type(OPTION_BOOL),
90
 
     description(_description),
91
 
     long_description(_long_description),
 
90
     untranslated_description(_untranslated_description),
 
91
     untranslated_long_description(_untranslated_long_description),
92
92
     option_name(_option_name),
93
93
     b_default(def)
94
94
  {
95
95
  }
96
96
 
97
 
  option_item(const char *_description,
98
 
              const char *_long_description,
 
97
  option_item(const char *_untranslated_description,
 
98
              const char *_untranslated_long_description,
99
99
              const char *_option_name,
100
100
              const char *def)
101
101
    :type(OPTION_STRING),
102
 
     description(_description),
103
 
     long_description(_long_description),
 
102
     untranslated_description(_untranslated_description),
 
103
     untranslated_long_description(_untranslated_long_description),
104
104
     option_name(_option_name),
105
105
     s_default(def)
106
106
  {
109
109
  /** \brief Construct a radio item from a list of choices,
110
110
   *  destroying each choice after it's inserted into the list.
111
111
   */
112
 
  static option_item radio(const char *description,
113
 
                           const char *long_description,
 
112
  static option_item radio(const char *untranslated_description,
 
113
                           const char *untranslated_long_description,
114
114
                           const char *option_name,
115
115
                           const char *def,
116
116
                           const radio_choice *choice_1,
122
122
    va_start(args, choice_1);
123
123
 
124
124
    rval.type=OPTION_RADIO;
125
 
    rval.description=description;
126
 
    rval.long_description = long_description;
127
 
    rval.option_name=option_name;
 
125
    rval.untranslated_description = untranslated_description;
 
126
    rval.untranslated_long_description = untranslated_long_description;
 
127
    rval.option_name = option_name;
128
128
    rval.s_default=def;
129
129
 
130
130
    rval.choices.push_back(*choice_1);
148
148
};
149
149
 
150
150
        radio_choice *choice(const char *value,
151
 
                             const char *description,
152
 
                             const char *long_description)
 
151
                             const char *untranslated_description,
 
152
                             const char *untranslated_long_description)
153
153
        {
154
154
          return new radio_choice(value,
155
 
                                  W_(description),
156
 
                                  W_(long_description));
 
155
                                  untranslated_description,
 
156
                                  untranslated_long_description);
157
157
        }
158
158
 
159
159
option_item ui_options[]={
196
196
                     N_("This option controls whether aptitude will wait for confirmation after a download before it goes ahead and installs packages."),
197
197
                     PACKAGE "::UI::Pause-After-Download",
198
198
                     "OnlyIfError",
199
 
                     choice("No", _("Never"),
200
 
                            _("Never wait for the user after downloading packages: always begin the installation immediately.")),
201
 
                     choice("OnlyIfError", _("When an error occurs"),
202
 
                            _("Wait for confirmation if an error occurred during the download.  If there were no errors, begin installing packages immediately.")),
203
 
                     choice("Yes", _("Always"),
204
 
                            _("Always wait for the user to confirm the download before proceeding with the installation.")),
 
199
                     choice("No", N_("Never"),
 
200
                            N_("Never wait for the user after downloading packages: always begin the installation immediately.")),
 
201
                     choice("OnlyIfError", N_("When an error occurs"),
 
202
                            N_("Wait for confirmation if an error occurred during the download.  If there were no errors, begin installing packages immediately.")),
 
203
                     choice("Yes", N_("Always"),
 
204
                            N_("Always wait for the user to confirm the download before proceeding with the installation.")),
205
205
                     NULL),
206
206
  option_item(N_("Use a 'status-line' download indicator for all downloads"),
207
207
              N_("If this option is enabled, aptitude will display "
208
208
                 "the status of ongoing downloads at the bottom of "
209
209
                 "the screen, rather than opening a new view."),
210
210
              PACKAGE "::UI::Minibuf-Download-Bar", false),
211
 
  option_item(N_("Display the extended description area by default"),
212
 
              N_("If this option is enabled, the long description "
 
211
  option_item(N_("Display the information area by default"),
 
212
              N_("If this option is enabled, the information "
213
213
                 "area (the pane at the bottom of the screen) in the "
214
214
                 "package list will be visible when the program "
215
215
                 "starts; otherwise, it will be initially hidden."),
216
216
              PACKAGE "::UI::Description-Visible-By-Default", true),
 
217
  option_item(N_("Display tabs for the available views"),
 
218
              N_("If this option is enabled, tabs will appear at the top "
 
219
                 "of the screen listing the currently opened views."),
 
220
              PACKAGE "::UI::ViewTabs", true),
 
221
  option_item(N_("Display tabs for the information area"),
 
222
              N_("If this option is enabled, tabs will appear at the top of "
 
223
                 "the information area (the pane at the bottom of the screen) "
 
224
                 "listing the different displays of information that can be "
 
225
                 "viewed there."),
 
226
              PACKAGE "::UI::InfoAreaTabs", false),
217
227
  option_item(N_("Advance to the next item after changing the state of a package"),
218
228
              N_("If this option is enabled, then performing an "
219
229
                 "action on a package (for instance, installing or "
278
288
  option_item(N_("URL to use to download changelogs"),
279
289
              N_("This option controls the template that's used to "
280
290
                 "download changelogs from the Debian Web site.  You "
281
 
                 "should only need to change this if the URL of "
282
 
                 "the package archive changes."),
 
291
                 "should only need to change this if the changelogs move "
 
292
                 "to a different URL."),
283
293
              PACKAGE "::Changelog-URL-Template",
284
294
              "http://cgi.debian.org/cgi-bin/get-changelog?package=%s"),
285
295
  option_item(N_("Display a preview of what will be done before doing it"),
345
355
              N_("If this option is enabled, and you perform an "
346
356
                 "install run while some packages are broken, "
347
357
                 "aptitude will automatically apply the current "
348
 
                 "suggestion of the problem resolver.  Otherwise,"
 
358
                 "suggestion of the problem resolver.  Otherwise, "
349
359
                 "aptitude will prompt you for a solution to the "
350
360
                 "broken dependencies."),
351
361
              PACKAGE "::Auto-Fix-Broken", true),
352
362
  option_item(N_("Install recommended packages automatically"),
353
 
              N_("If this option is enabled  and \"automatically "
 
363
              N_("If this option is enabled and \"automatically "
354
364
                 "resolve dependencies\" is also enabled, aptitude "
355
365
                 "will attempt to install the recommendations of "
356
366
                 "newly installed packages in addition to their "
360
370
                 "If this option is enabled and \"Remove unused "
361
371
                 "packages automatically\" is enabled, packages "
362
372
                 "that are recommended by an installed package "
363
 
                 "will not automatically be removed."),
364
 
              PACKAGE "::Recommends-Important", true),
 
373
                 "will not be automatically removed."),
 
374
              "Apt::Install-Recommends", true),
365
375
  option_item(N_("Remove unused packages automatically"),
366
376
              N_("If this option is enabled, packages that are "
367
377
                 "automatically installed and that no manually "
380
390
                 "depends on them: they will never be targeted "
381
391
                 "for removal as unused packages."),
382
392
              PACKAGE "::Keep-Unused-Pattern", ""),
 
393
  option_item(N_("Allow dependency resolutions that break holds or forbids"),
 
394
              N_("If this option is enabled, then whenever aptitude "
 
395
                 "solves a dependency problem, it will consider "
 
396
                 "modifying held packages, or installing forbidden "
 
397
                 "package versions.  With this option disabled, these "
 
398
                 "solutions will be rejected by default."
 
399
                 "\n"
 
400
                 "NOTE: At present, this restriction only applies to situations "
 
401
                 "in which aptitude's dependency resolver (the red bar "
 
402
                 "at the bottom of the screen) is activated.  aptitude "
 
403
                 "will still break holds when automatically installing "
 
404
                 "the dependencies of a package that has just been "
 
405
                 "selected for installation or upgrade, due to apt bug "
 
406
                 "#470035."),
 
407
              PACKAGE "::ProblemResolver::Allow-Break-Holds", false),
383
408
  option_item()
384
409
};
385
410
 
410
435
          }
411
436
        };
412
437
 
 
438
        /** \brief Instantiate a widget for the given option description.
 
439
         *
 
440
         *  Any untranslated strings in the structure are translated
 
441
         *  by calls to gettext().
 
442
         */
413
443
        cw::treeitem *parse_option(const option_item &option)
414
444
        {
415
445
          eassert(option.type != option_item::OPTION_END);
416
446
          switch(option.type)
417
447
            {
418
448
            case option_item::OPTION_BOOL:
419
 
              return make_boolean_item(W_(option.description),
420
 
                                       W_(option.long_description),
 
449
              return make_boolean_item(W_(option.untranslated_description),
 
450
                                       _(option.untranslated_long_description),
421
451
                                       option.option_name,
422
452
                                       option.b_default);
423
453
            case option_item::OPTION_STRING:
424
 
              return make_string_item(W_(option.description),
425
 
                                      W_(option.long_description),
 
454
              return make_string_item(W_(option.untranslated_description),
 
455
                                      _(option.untranslated_long_description),
426
456
                                      option.option_name,
427
457
                                      option.s_default);
428
458
            case option_item::OPTION_RADIO:
429
 
              return make_radio_item(W_(option.description),
430
 
                                     W_(option.long_description),
 
459
              return make_radio_item(W_(option.untranslated_description),
 
460
                                     _(option.untranslated_long_description),
431
461
                                     option.option_name,
432
462
                                     option.choices,
433
463
                                     option.s_default);
505
535
 
506
536
            // Use an empty label to produce a "bar" dividing the two
507
537
            // halves of the screen.
508
 
            cw::label_ref middle_label = cw::label::create("", cw::get_style("Status"));
 
538
 
 
539
            // These declarations are workarounds for strange behavior
 
540
            // in g++ 4.3.
 
541
            std::string empty_label;
 
542
            cw::style status_style(cw::get_style("Status"));
 
543
            cw::label_ref middle_label = cw::label::create(empty_label, status_style);
509
544
            desc_area = cw::text_layout::create();
510
545
 
511
546
            cw::scrollbar_ref desc_area_scrollbar = cw::scrollbar::create(cw::scrollbar::VERTICAL);