2 * camel-store-settings.c
4 * This program 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) version 3.
9 * This program 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.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with the program; if not, see <http://www.gnu.org/licenses/>
19 #include "camel-store-settings.h"
21 #define CAMEL_STORE_SETTINGS_GET_PRIVATE(obj) \
22 (G_TYPE_INSTANCE_GET_PRIVATE \
23 ((obj), CAMEL_TYPE_STORE_SETTINGS, CamelStoreSettingsPrivate))
25 struct _CamelStoreSettingsPrivate {
26 gboolean filter_inbox;
40 store_settings_set_property (GObject *object,
45 switch (property_id) {
46 case PROP_FILTER_INBOX:
47 camel_store_settings_set_filter_inbox (
48 CAMEL_STORE_SETTINGS (object),
49 g_value_get_boolean (value));
53 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
57 store_settings_get_property (GObject *object,
62 switch (property_id) {
63 case PROP_FILTER_INBOX:
66 camel_store_settings_get_filter_inbox (
67 CAMEL_STORE_SETTINGS (object)));
71 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
75 camel_store_settings_class_init (CamelStoreSettingsClass *class)
77 GObjectClass *object_class;
79 g_type_class_add_private (class, sizeof (CamelStoreSettingsPrivate));
81 object_class = G_OBJECT_CLASS (class);
82 object_class->set_property = store_settings_set_property;
83 object_class->get_property = store_settings_get_property;
85 g_object_class_install_property (
88 g_param_spec_boolean (
91 "Whether to filter new messages in Inbox",
95 G_PARAM_STATIC_STRINGS));
99 camel_store_settings_init (CamelStoreSettings *settings)
101 settings->priv = CAMEL_STORE_SETTINGS_GET_PRIVATE (settings);
105 * camel_store_settings_get_filter_inbox:
106 * @settings: a #CamelStoreSettings
108 * Returns whether to automatically apply filters to newly arrived messages
109 * in the store's Inbox folder (assuming it has an Inbox folder).
111 * Returns: whether to filter new messages in Inbox
116 camel_store_settings_get_filter_inbox (CamelStoreSettings *settings)
118 g_return_val_if_fail (CAMEL_IS_STORE_SETTINGS (settings), FALSE);
120 return settings->priv->filter_inbox;
124 * camel_store_settings_set_filter_inbox:
125 * @settings: a #CamelStoreSettings
126 * @filter_inbox: whether to filter new messages in Inbox
128 * Sets whether to automatically apply filters to newly arrived messages
129 * in the store's Inbox folder (assuming it has an Inbox folder).
134 camel_store_settings_set_filter_inbox (CamelStoreSettings *settings,
135 gboolean filter_inbox)
137 g_return_if_fail (CAMEL_IS_STORE_SETTINGS (settings));
139 if (settings->priv->filter_inbox == filter_inbox)
142 settings->priv->filter_inbox = filter_inbox;
144 g_object_notify (G_OBJECT (settings), "filter-inbox");