~noskcaj/ubuntu/vivid/banshee-community-extensions/merge

« back to all changes in this revision

Viewing changes to src/AlbumArtWriter/Banshee.AlbumArtWriter/ConfigurationDialog.cs

  • Committer: Package Import Robot
  • Author(s): Chow Loong Jin
  • Date: 2012-04-09 22:56:37 UTC
  • mfrom: (4.2.11 sid)
  • Revision ID: package-import@ubuntu.com-20120409225637-95tnzf6blgujwiff
Tags: 2.4.0-1ubuntu1
* [8075ffb] Merge from Debian Unstable (LP: #977236), remaining changes:
  + Enable AppIndicator extension

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//
 
2
// AlbumArtWriterService.cs
 
3
//
 
4
// Authors:
 
5
//   Kevin Anthony <Kevin.S.Anthony@gmail.com>
 
6
//
 
7
// Copyright (C) 2011 Kevin Anthony
 
8
//
 
9
// Permission is hereby granted, free of charge, to any person obtaining
 
10
// a copy of this software and associated documentation files (the
 
11
// "Software"), to deal in the Software without restriction, including
 
12
// without limitation the rights to use, copy, modify, merge, publish,
 
13
// distribute, sublicense, and/or sell copies of the Software, and to
 
14
// permit persons to whom the Software is furnished to do so, subject to
 
15
// the following conditions:
 
16
//
 
17
// The above copyright notice and this permission notice shall be
 
18
// included in all copies or substantial portions of the Software.
 
19
//
 
20
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 
21
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 
22
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 
23
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
 
24
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
 
25
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 
26
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
27
//
 
28
 
 
29
 
 
30
using System;
 
31
using Gtk;
 
32
using Mono.Addins;
 
33
 
 
34
using Banshee.Gui.Dialogs;
 
35
 
 
36
namespace Banshee.AlbumArtWriter
 
37
{
 
38
    public class ConfigurationDialog : BansheeDialog
 
39
    {
 
40
        private AlbumArtWriterService service;
 
41
        private Entry artname_entry;
 
42
        private RadioButton jpg;
 
43
        private RadioButton png;
 
44
 
 
45
        public ConfigurationDialog (AlbumArtWriterService service) : base (AddinManager.CurrentLocalizer.GetString ("Album Art Writer Configuration"))
 
46
        {
 
47
            this.service = service;
 
48
 
 
49
            Frame artframe = new Frame("artbox_frame");
 
50
            artframe.Label = AddinManager.CurrentLocalizer.GetString("Output File Name (No Extension)");
 
51
            HBox artname_box = new HBox ();
 
52
            artname_box.PackStart (new Label (AddinManager.CurrentLocalizer.GetString ("File Name:")), false, false, 0);
 
53
            artname_entry = new Entry ();
 
54
            artname_box.PackStart (artname_entry, true, true, 3);
 
55
 
 
56
            artframe.Add(artname_box);
 
57
            artframe.ShadowType = (ShadowType) 4;
 
58
 
 
59
            VBox.PackStart( artframe,false,false,3);
 
60
 
 
61
            Frame fileframe = new Frame("artbox_frame");
 
62
            fileframe.Label = AddinManager.CurrentLocalizer.GetString("Output File type");
 
63
            HBox image_radio_button_h_box = new HBox ();
 
64
            jpg = new RadioButton  (null, "JPG File");
 
65
            png = new RadioButton  (jpg, "PNG File");
 
66
            image_radio_button_h_box.PackStart(jpg, false, false, 3);
 
67
            image_radio_button_h_box.PackStart(png, false, false, 3);
 
68
            fileframe.Add(image_radio_button_h_box);
 
69
            fileframe.ShadowType = (ShadowType) 4;
 
70
            VBox.PackStart (fileframe, false, false, 3);
 
71
            AddDefaultCloseButton ();
 
72
            ShowAll();
 
73
 
 
74
            // initialize values
 
75
            artname_entry.Text = service.ArtName;
 
76
            if (service.JPG){
 
77
                jpg.Activate();
 
78
            } else if (service.PNG) {
 
79
                png.Activate();
 
80
            }
 
81
 
 
82
            // attach change handlers
 
83
            artname_entry.Changed += new EventHandler (on_ArtName_Changed);
 
84
            jpg.Toggled += new EventHandler(on_Radio_Clicked);
 
85
            png.Toggled += new EventHandler(on_Radio_Clicked);
 
86
        }
 
87
 
 
88
        private void on_ArtName_Changed (object source, System.EventArgs args)
 
89
        {
 
90
            service.ArtName = artname_entry.Text;
 
91
        }
 
92
        private void on_Radio_Clicked (object source, System.EventArgs args)
 
93
        {
 
94
            service.JPG = jpg.Active;
 
95
            service.PNG = png.Active;
 
96
        }
 
97
    }
 
98
}