1 /*
2 * camel-smtp-settings.c
3 *
4 * This library is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation.
7 *
8 * This library is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
10 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
11 * for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this library. If not, see <http://www.gnu.org/licenses/>.
15 *
16 */
17
18 #include "camel-smtp-settings.h"
19
20 enum {
21 PROP_0,
22 PROP_AUTH_MECHANISM,
23 PROP_HOST,
24 PROP_PORT,
25 PROP_SECURITY_METHOD,
26 PROP_USER
27 };
28
G_DEFINE_TYPE_WITH_CODE(CamelSmtpSettings,camel_smtp_settings,CAMEL_TYPE_SETTINGS,G_IMPLEMENT_INTERFACE (CAMEL_TYPE_NETWORK_SETTINGS,NULL))29 G_DEFINE_TYPE_WITH_CODE (
30 CamelSmtpSettings,
31 camel_smtp_settings,
32 CAMEL_TYPE_SETTINGS,
33 G_IMPLEMENT_INTERFACE (
34 CAMEL_TYPE_NETWORK_SETTINGS, NULL))
35
36 static void
37 smtp_settings_set_property (GObject *object,
38 guint property_id,
39 const GValue *value,
40 GParamSpec *pspec)
41 {
42 switch (property_id) {
43 case PROP_AUTH_MECHANISM:
44 camel_network_settings_set_auth_mechanism (
45 CAMEL_NETWORK_SETTINGS (object),
46 g_value_get_string (value));
47 return;
48
49 case PROP_HOST:
50 camel_network_settings_set_host (
51 CAMEL_NETWORK_SETTINGS (object),
52 g_value_get_string (value));
53 return;
54
55 case PROP_PORT:
56 camel_network_settings_set_port (
57 CAMEL_NETWORK_SETTINGS (object),
58 g_value_get_uint (value));
59 return;
60
61 case PROP_SECURITY_METHOD:
62 camel_network_settings_set_security_method (
63 CAMEL_NETWORK_SETTINGS (object),
64 g_value_get_enum (value));
65 return;
66
67 case PROP_USER:
68 camel_network_settings_set_user (
69 CAMEL_NETWORK_SETTINGS (object),
70 g_value_get_string (value));
71 return;
72 }
73
74 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
75 }
76
77 static void
smtp_settings_get_property(GObject * object,guint property_id,GValue * value,GParamSpec * pspec)78 smtp_settings_get_property (GObject *object,
79 guint property_id,
80 GValue *value,
81 GParamSpec *pspec)
82 {
83 switch (property_id) {
84 case PROP_AUTH_MECHANISM:
85 g_value_take_string (
86 value,
87 camel_network_settings_dup_auth_mechanism (
88 CAMEL_NETWORK_SETTINGS (object)));
89 return;
90
91 case PROP_HOST:
92 g_value_take_string (
93 value,
94 camel_network_settings_dup_host (
95 CAMEL_NETWORK_SETTINGS (object)));
96 return;
97
98 case PROP_PORT:
99 g_value_set_uint (
100 value,
101 camel_network_settings_get_port (
102 CAMEL_NETWORK_SETTINGS (object)));
103 return;
104
105 case PROP_SECURITY_METHOD:
106 g_value_set_enum (
107 value,
108 camel_network_settings_get_security_method (
109 CAMEL_NETWORK_SETTINGS (object)));
110 return;
111
112 case PROP_USER:
113 g_value_take_string (
114 value,
115 camel_network_settings_dup_user (
116 CAMEL_NETWORK_SETTINGS (object)));
117 return;
118 }
119
120 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
121 }
122
123 static void
camel_smtp_settings_class_init(CamelSmtpSettingsClass * class)124 camel_smtp_settings_class_init (CamelSmtpSettingsClass *class)
125 {
126 GObjectClass *object_class;
127
128 object_class = G_OBJECT_CLASS (class);
129 object_class->set_property = smtp_settings_set_property;
130 object_class->get_property = smtp_settings_get_property;
131
132 /* Inherited from CamelNetworkSettings. */
133 g_object_class_override_property (
134 object_class,
135 PROP_AUTH_MECHANISM,
136 "auth-mechanism");
137
138 /* Inherited from CamelNetworkSettings. */
139 g_object_class_override_property (
140 object_class,
141 PROP_HOST,
142 "host");
143
144 /* Inherited from CamelNetworkSettings. */
145 g_object_class_override_property (
146 object_class,
147 PROP_PORT,
148 "port");
149
150 /* Inherited from CamelNetworkSettings. */
151 g_object_class_override_property (
152 object_class,
153 PROP_SECURITY_METHOD,
154 "security-method");
155
156 /* Inherited from CamelNetworkSettings. */
157 g_object_class_override_property (
158 object_class,
159 PROP_USER,
160 "user");
161 }
162
163 static void
camel_smtp_settings_init(CamelSmtpSettings * settings)164 camel_smtp_settings_init (CamelSmtpSettings *settings)
165 {
166 }
167
168