| 23 | | * Use the placement new syntax for private structures |
| 24 | | * Let glib allocate the private structure using g_type_class_add_private() as usual |
| 25 | | * In the init method use the following syntax |
| | 23 | * Use WEBKIT_DEFINE_ macros instead of G_DEFINE_ ones. There some small differences: |
| | 24 | * The private struct is allocated by the macro using the placement new syntax, so you can use smart pointers in the private struct. |
| | 25 | * You only need to define a class_init method but not init() nor finalize(). |
| | 26 | * Don't call g_type_class_add_private() in class_init() since it's already done by the macro. |
| | 27 | * If you need to add some initialization for instances, override GObjectClass::constructor() or use the private struct constructor |
| 27 | | static void webkit_foo_init(WebKitFoo* foo) |
| 28 | | { |
| 29 | | WebKitFooPrivate* priv = G_TYPE_INSTANCE_GET_PRIVATE(foo, WEBKIT_TYPE_FOO, WebKitFooPrivate); |
| 30 | | foo->priv = priv; |
| 31 | | new (priv) WebKitFooPrivate(); |
| 32 | | } |
| | 29 | struct _WebKitSettingsPrivate { |
| | 30 | _WebKitSettingsPrivate() |
| | 31 | : preferences(WebPreferences::create()) |
| | 32 | { |
| | 33 | defaultFontFamily = preferences->standardFontFamily().utf8(); |
| | 34 | monospaceFontFamily = preferences->fixedFontFamily().utf8(); |
| | 35 | serifFontFamily = preferences->serifFontFamily().utf8(); |
| | 36 | sansSerifFontFamily = preferences->sansSerifFontFamily().utf8(); |
| | 37 | cursiveFontFamily = preferences->cursiveFontFamily().utf8(); |
| | 38 | fantasyFontFamily = preferences->fantasyFontFamily().utf8(); |
| | 39 | pictographFontFamily = preferences->pictographFontFamily().utf8(); |
| | 40 | defaultCharset = preferences->defaultTextEncodingName().utf8(); |
| | 41 | } |
| | 42 | |
| | 43 | RefPtr<WebPreferences> preferences; |
| | 44 | CString defaultFontFamily; |
| | 45 | CString monospaceFontFamily; |
| | 46 | CString serifFontFamily; |
| | 47 | CString sansSerifFontFamily; |
| | 48 | CString cursiveFontFamily; |
| | 49 | CString fantasyFontFamily; |
| | 50 | CString pictographFontFamily; |
| | 51 | CString defaultCharset; |
| | 52 | CString userAgent; |
| | 53 | bool allowModalDialogs; |
| | 54 | bool zoomTextOnly; |
| | 55 | }; |