2 * Dictix / DixProperties - dix-properties.vala
4 * Copyright (C) Martin Blanchard 2011 <tinram@gmx.fr>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
27 public class Properties
: Dialog
{
28 private Label title_label
;
29 private Label codec_label
;
30 private Label filename_label
;
31 private Label size_label
;
32 private Label duration_label
;
33 private Label channels_label
;
34 private Label sample_rate_label
;
35 private Label bit_rate_label
;
37 public Properties (Builder builder
) {
38 Alignment properties_alignment
= null;
39 Box content_area
= null;
41 this
.set_resizable (false);
42 this
.set_border_width (5);
43 this
.add_button (Stock
.CLOSE
, ResponseType
.CLOSE
);
44 this
.set_default_response (ResponseType
.CLOSE
);
45 this
.delete_event
.connect (hide_on_delete
);
46 this
.response
.connect (on_response_cb
);
48 content_area
= this
.get_content_area () as Box
;
49 properties_alignment
= builder
.get_object ("properties-alignment") as Alignment
;
50 content_area
.add (properties_alignment as Widget
);
52 title_label
= builder
.get_object ("title-prop-label") as Label
;
53 codec_label
= builder
.get_object ("codec-prop-label") as Label
;
54 filename_label
= builder
.get_object ("filename-prop-label") as Label
;
55 size_label
= builder
.get_object ("size-prop-label") as Label
;
56 duration_label
= builder
.get_object ("duration-prop-label") as Label
;
57 channels_label
= builder
.get_object ("channels-prop-label") as Label
;
58 sample_rate_label
= builder
.get_object ("sample-rate-prop-label") as Label
;
59 bit_rate_label
= builder
.get_object ("bit-rate-prop-label") as Label
;
62 public void on_response_cb (int response
) {
64 case ResponseType
.CLOSE
: {
74 public void set_record (TreeModel model
, TreeIter iter
) {
87 Column
.TITLE
, out title
,
88 Column
.CODEC
, out codec
,
89 Column
.SIZE
, out size
,
90 Column
.DURATION
, out duration
,
91 Column
.CHANNELS
, out channels
,
92 Column
.SAMPLE_RATE
, out sample_rate
,
93 Column
.BIT_RATE
, out bit_rate
);
96 title_label
.set_text (title
);
97 codec_label
.set_text (Utils
.codec_to_string (codec
));
99 filename_label
.set_text (Utils
.basename_from_uri (uri
));
100 size_label
.set_text (Utils
.size_to_string (size
));
101 duration_label
.set_text (Utils
.duration_to_string (duration
));
102 channels_label
.set_text (Utils
.channels_to_string (channels
));
103 sample_rate_label
.set_text (Utils
.sample_rate_to_string (sample_rate
));
104 bit_rate_label
.set_text (Utils
.bit_rate_to_string (bit_rate
));
107 public void reset () {
108 title_label
.set_text (_("Unknow record"));
109 codec_label
.set_text (_("n/a"));
111 filename_label
.set_text (_("n/a"));
112 size_label
.set_text (_("n/a"));
113 duration_label
.set_text (_("n/a"));
114 channels_label
.set_text (_("n/a"));
115 sample_rate_label
.set_text (_("n/a"));
116 bit_rate_label
.set_text (_("n/a"));