|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. |
|
3 * |
|
4 * This library is free software; you can redistribute it and/or |
|
5 * modify it under the terms of the GNU Lesser General Public |
|
6 * License as published by the Free Software Foundation; either |
|
7 * version 2 of the License, or (at your option) any later version. |
|
8 * |
|
9 * This library is distributed in the hope that it will be useful, |
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
12 * Lesser General Public License for more details. |
|
13 * |
|
14 * You should have received a copy of the GNU Lesser General Public |
|
15 * License along with this library; if not, write to the |
|
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
|
17 * Boston, MA 02111-1307, USA. |
|
18 * |
|
19 * Description: |
|
20 * |
|
21 */ |
|
22 #include "GlibEventHandler.h" |
|
23 #include <glib.h> |
|
24 |
|
25 CGlibEventHandler* iCGlibEventHandler; |
|
26 |
|
27 CGlibEventHandler* CGlibEventHandler::NewL() |
|
28 { |
|
29 CGlibEventHandler* self = new(ELeave) CGlibEventHandler(); |
|
30 CleanupStack::PushL(self); |
|
31 self->ConstructL(); |
|
32 CleanupStack::Pop(); |
|
33 return self; |
|
34 } |
|
35 |
|
36 |
|
37 CGlibEventHandler::~CGlibEventHandler() |
|
38 { |
|
39 |
|
40 } |
|
41 |
|
42 |
|
43 void CGlibEventHandler::Start() |
|
44 { |
|
45 iTimer.After(iStatus, TTimeIntervalMicroSeconds32(1000)); |
|
46 SetActive(); |
|
47 } |
|
48 |
|
49 |
|
50 void CGlibEventHandler::Stop() |
|
51 { |
|
52 Cancel(); |
|
53 } |
|
54 |
|
55 |
|
56 void CGlibEventHandler::RunL() |
|
57 { |
|
58 g_main_context_iteration(NULL, FALSE); |
|
59 iTimer.After(iStatus, TTimeIntervalMicroSeconds32(1000)); |
|
60 SetActive(); |
|
61 } |
|
62 |
|
63 |
|
64 void CGlibEventHandler::DoCancel() |
|
65 { |
|
66 iTimer.Cancel(); |
|
67 } |
|
68 |
|
69 |
|
70 CGlibEventHandler::CGlibEventHandler():CActive(EPriorityStandard) |
|
71 { |
|
72 iTimer.CreateLocal(); |
|
73 CActiveScheduler::Add(this); |
|
74 } |
|
75 |
|
76 void CGlibEventHandler::ConstructL() |
|
77 { |
|
78 |
|
79 } |
|
80 |