~ubuntu-branches/ubuntu/saucy/padre/saucy-proposed

« back to all changes in this revision

Viewing changes to lib/Padre/Wx/Choice/Theme.pm

  • Committer: Package Import Robot
  • Author(s): Dominique Dumont, gregor herrmann, Dominique Dumont
  • Date: 2012-01-04 12:04:20 UTC
  • mfrom: (1.3.3)
  • Revision ID: package-import@ubuntu.com-20120104120420-i5oybqwf91m1d3il
Tags: 0.92.ds1-1
[ gregor herrmann ]
* Remove debian/source/local-options; abort-on-upstream-changes
  and unapply-patches are default in dpkg-source since 1.16.1.
* Swap order of alternative (build) dependencies after the perl
  5.14 transition.

[ Dominique Dumont ]
* Imported Upstream version 0.92.ds1
* removed fix-spelling patch (applied upstream)
* lintian-override: use wildcard to avoid listing a gazillion files
* updated size of some 'not-real-man-page' entries
* rules: remove dekstop cruft (replaced by a file provided in debian
  directory)
* control: removed Breaks statement. Add /me to uploaders. Updated
  dependencies
* rules: make sure that non-DFSG file (i.e. the cute butterfly, sigh)
  is not distributed

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package Padre::Wx::Choice::Theme;
 
2
 
 
3
# Theme selection choice box
 
4
 
 
5
use 5.008;
 
6
use strict;
 
7
use warnings;
 
8
use Padre::Locale         ();
 
9
use Padre::Wx             ();
 
10
use Padre::Wx::Role::Main ();
 
11
use Padre::Wx::Theme      ();
 
12
 
 
13
our $VERSION = '0.92';
 
14
our @ISA     = qw{
 
15
        Padre::Wx::Role::Main
 
16
        Wx::Choice
 
17
};
 
18
 
 
19
# Provide a custom config_load hook so that Padre::Wx::Role::Config will let
 
20
# let us load our own data instead of doing it for us.
 
21
 
 
22
sub config_load {
 
23
        my $self    = shift;
 
24
        my $setting = shift;
 
25
        my $value   = shift;
 
26
 
 
27
        # Instead of using the vanilla options provided by configuration,
 
28
        # use the elevated ones provided by the theme engine.
 
29
        my $locale  = Padre::Locale::rfc4646();
 
30
        my $options = Padre::Wx::Theme->labels($locale);
 
31
        if ($options) {
 
32
                $self->Clear;
 
33
 
 
34
                # NOTE: This assumes that the list will not be
 
35
                # sorted in Wx via a style flag and that the
 
36
                # order of the fields should be that of the key
 
37
                # and not of the translated label.
 
38
                # Doing sort in Wx will probably break this.
 
39
                foreach my $option ( sort keys %$options ) {
 
40
                        # Don't localise the label as Padre::Wx::Theme will do
 
41
                        # the localisation for us in this special case.
 
42
                        my $label = $options->{$option};
 
43
                        $self->Append( $label => $option );
 
44
                        next unless $option eq $value;
 
45
                        $self->SetSelection( $self->GetCount - 1 );
 
46
                }
 
47
        }
 
48
 
 
49
        return 1;
 
50
}
 
51
 
 
52
1;
 
53
 
 
54
# Copyright 2008-2011 The Padre development team as listed in Padre.pm.
 
55
# LICENSE
 
56
# This program is free software; you can redistribute it and/or
 
57
# modify it under the same terms as Perl 5 itself.