fixes compile
[platform/upstream/ibus-libpinyin.git] / src / PYPConfig.h
1 /* vim:set et ts=4 sts=4:
2  *
3  * ibus-libpinyin - Intelligent Pinyin engine based on libpinyin for IBus
4  *
5  * Copyright (c) 2008-2010 Peng Huang <shawn.p.huang@gmail.com>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2, or (at your option)
10  * any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
20  */
21 #ifndef __PY_LIBPINYIN_CONFIG_H_
22 #define __PY_LIBPINYIN_CONFIG_H_
23
24 #ifdef HAVE_CONFIG_H
25 #  include <config.h>
26 #endif
27
28 #include <string>
29 #include <ibus.h>
30 #include "PYUtil.h"
31 #include "PYObject.h"
32 #include "PYConfig.h"
33 #include <pinyin.h>
34
35 namespace PY {
36
37 class Bus;
38
39 class LibPinyinConfig : public Config {
40 protected:
41     LibPinyinConfig (Bus & bus, const std::string & name);
42     virtual ~LibPinyinConfig (void);
43
44 public:
45
46 protected:
47     void initDefaultValues (void);
48
49     virtual void readDefaultValues (void);
50     virtual gboolean valueChanged (const std::string &section,
51                                    const std::string &name,
52                                    GVariant          *value);
53 private:
54     static void valueChangedCallback (IBusConfig     *config,
55                                       const gchar    *section,
56                                       const gchar    *name,
57                                       GVariant       *value,
58                                       LibPinyinConfig *self);
59
60 protected:
61 };
62
63 /* PinyinConfig */
64 class LibPinyinPinyinConfig : public LibPinyinConfig {
65 public:
66     static void init (Bus & bus);
67     static LibPinyinPinyinConfig & instance (void) { return *m_instance; }
68
69 protected:
70     LibPinyinPinyinConfig (Bus & bus);
71     virtual void readDefaultValues (void);
72
73     virtual gboolean valueChanged (const std::string &section,
74                                    const std::string &name,
75                                    GVariant          *value);
76
77 private:
78     static std::unique_ptr<LibPinyinPinyinConfig> m_instance;
79 };
80
81 /* Bopomof Config */
82 class LibPinyinBopomofoConfig : public LibPinyinConfig {
83 public:
84     static void init (Bus & bus);
85     static LibPinyinBopomofoConfig & instance (void) { return *m_instance; }
86
87 protected:
88     LibPinyinBopomofoConfig (Bus & bus);
89     virtual void readDefaultValues (void);
90
91     virtual gboolean valueChanged (const std::string &section,
92                                    const std::string &name,
93                                    GVariant          *value);
94
95 private:
96     static std::unique_ptr<LibPinyinBopomofoConfig> m_instance;
97 };
98
99 };
100 #endif