~ubuntu-branches/ubuntu/vivid/banshee-community-extensions/vivid

« back to all changes in this revision

Viewing changes to src/AlarmClock/Banshee.AlarmClock/SleepTimerConfigDialog.cs

  • Committer: Bazaar Package Importer
  • Author(s): Chow Loong Jin
  • Date: 2010-10-02 16:40:06 UTC
  • mfrom: (1.1.5 upstream) (4.1.4 experimental)
  • Revision ID: james.westby@ubuntu.com-20101002164006-7f3ep20zug2aj5vl
Tags: 1.8.0-1ubuntu1
* Merge from Debian experimental, remaining changes:
  + Enable building of AppIndicator, Lirc, SoundMenu, and U1MS
  + Also enable SoundMenu extension by default

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
using Gtk;
32
32
using Mono.Addins;
33
33
 
 
34
using Banshee.Gui.Dialogs;
 
35
 
34
36
namespace Banshee.AlarmClock
35
37
{
36
 
    public class SleepTimerConfigDialog : Dialog
 
38
    public class SleepTimerConfigDialog : BansheeDialog
37
39
    {
38
 
        AlarmClockService plugin;
 
40
        AlarmClockService service;
39
41
 
40
42
        SpinButton sleepHour;
41
43
        SpinButton sleepMin;
42
44
 
43
 
        public SleepTimerConfigDialog (AlarmClockService plugin) : base ()
 
45
        public SleepTimerConfigDialog (AlarmClockService service) : base (AddinManager.CurrentLocalizer.GetString ("Sleep Timer"))
44
46
        {
45
 
            this.plugin = plugin;
 
47
            this.service = service;
46
48
 
47
 
            Title = AddinManager.CurrentLocalizer.GetString ("Sleep Timer");
48
49
            WidthRequest = 250;
49
50
            HeightRequest = 150;
50
 
            VBox.Spacing = 10;
51
51
 
52
52
            BuildWidget ();
53
53
            ShowAll ();
58
58
            sleepHour = new SpinButton (0,23,1);
59
59
            sleepMin  = new SpinButton (0,59,1);
60
60
 
61
 
            sleepHour.Value = (int) plugin.GetSleepTimer () / 60 ;
62
 
            sleepMin.Value = plugin.GetSleepTimer () - (sleepHour.Value * 60);
 
61
            sleepHour.Value = (int) service.GetSleepTimer () / 60 ;
 
62
            sleepMin.Value = service.GetSleepTimer () - (sleepHour.Value * 60);
63
63
 
64
64
            sleepHour.WidthChars = 2;
65
65
            sleepMin.WidthChars  = 2;
79
79
            topbox.PackStart (separator);
80
80
            topbox.PackStart (sleepMin);
81
81
 
82
 
            this.AddActionWidget (OK, 0);
 
82
            AddActionWidget (OK, 0);
83
83
 
84
 
            this.VBox.PackStart (topbox);
85
 
            this.VBox.PackStart (comment);
 
84
            VBox.PackStart (topbox);
 
85
            VBox.PackStart (comment);
86
86
        }
87
87
 
88
88
        public void OnSleepTimerOK (object o, EventArgs a)
89
89
        {
90
90
            int timervalue = (int)sleepHour.Value * 60 + (int)sleepMin.Value;
91
 
            plugin.SetSleepTimer (timervalue);
92
 
            this.Destroy ();
 
91
            service.SetSleepTimer (timervalue);
 
92
            Destroy ();
93
93
        }
94
94
    }
95
95
}