Added non-hildon2 ModestDefaultGlobalSettingsDialog
[modest] / src / widgets / modest-default-global-settings-dialog.c
1 /* Copyright (c) 2006, 2009, Nokia Corporation
2  * All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are
6  * met:
7  *
8  * * Redistributions of source code must retain the above copyright
9  *   notice, this list of conditions and the following disclaimer.
10  * * Redistributions in binary form must reproduce the above copyright
11  *   notice, this list of conditions and the following disclaimer in the
12  *   documentation and/or other materials provided with the distribution.
13  * * Neither the name of the Nokia Corporation nor the names of its
14  *   contributors may be used to endorse or promote products derived from
15  *   this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
18  * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
20  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
21  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
24  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
25  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
26  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29
30 #ifdef HAVE_CONFIG_H
31 #include <config.h>
32 #endif /*HAVE_CONFIG_H*/
33
34 #include <modest-scrollable.h>
35
36 #include <glib/gi18n.h>
37 #include <string.h>
38 #include <gtk/gtkbox.h>
39 #include <gtk/gtkvbox.h>
40 #include <gtk/gtknotebook.h>
41 #include <gtk/gtklabel.h>
42 #include <gtk/gtkcheckbutton.h>
43 #include "modest-runtime.h"
44 #include <modest-global-settings-dialog-priv.h>
45 #include <modest-default-global-settings-dialog.h>
46 #include <modest-ui-constants.h>
47 #include "modest-text-utils.h"
48 #include "modest-defs.h"
49 #include <tny-account-store.h>
50 #include <modest-account-mgr-helpers.h>
51 #include <modest-toolkit-utils.h>
52
53
54 #define MSG_SIZE_MAX_VAL 5000
55 #define MSG_SIZE_DEF_VAL 1000
56 #define MSG_SIZE_MIN_VAL 1
57
58 #define DEFAULT_FOCUS_WIDGET "default-focus-widget"
59
60 /* 'private'/'protected' functions */
61 static void modest_default_global_settings_dialog_class_init (ModestDefaultGlobalSettingsDialogClass *klass);
62 static void modest_default_global_settings_dialog_init       (ModestDefaultGlobalSettingsDialog *obj);
63 static void modest_default_global_settings_dialog_finalize   (GObject *obj);
64
65 static ModestConnectedVia current_connection (void);
66
67 static GtkWidget* create_updating_page   (ModestDefaultGlobalSettingsDialog *self);
68
69 static void       on_auto_update_clicked (GtkButton *button,
70                                           gpointer user_data);
71 static void       update_sensitive       (ModestGlobalSettingsDialog *dialog);
72 static ModestPairList * get_accounts_list (void);
73
74 static void modest_default_global_settings_dialog_load_settings (ModestGlobalSettingsDialog *self);
75
76 typedef struct _ModestDefaultGlobalSettingsDialogPrivate ModestDefaultGlobalSettingsDialogPrivate;
77 struct _ModestDefaultGlobalSettingsDialogPrivate {
78         ModestPairList *connect_via_list;
79 };
80 #define MODEST_DEFAULT_GLOBAL_SETTINGS_DIALOG_GET_PRIVATE(o)      (G_TYPE_INSTANCE_GET_PRIVATE((o), \
81                                                            MODEST_TYPE_DEFAULT_GLOBAL_SETTINGS_DIALOG, \
82                                                            ModestDefaultGlobalSettingsDialogPrivate))
83 /* globals */
84 static GtkDialogClass *parent_class = NULL;
85
86 GType
87 modest_default_global_settings_dialog_get_type (void)
88 {
89         static GType my_type = 0;
90         if (!my_type) {
91                 static const GTypeInfo my_info = {
92                         sizeof(ModestDefaultGlobalSettingsDialogClass),
93                         NULL,           /* base init */
94                         NULL,           /* base finalize */
95                         (GClassInitFunc) modest_default_global_settings_dialog_class_init,
96                         NULL,           /* class finalize */
97                         NULL,           /* class data */
98                         sizeof(ModestDefaultGlobalSettingsDialog),
99                         1,              /* n_preallocs */
100                         (GInstanceInitFunc) modest_default_global_settings_dialog_init,
101                         NULL
102                 };
103                 my_type = g_type_register_static (MODEST_TYPE_GLOBAL_SETTINGS_DIALOG,
104                                                   "ModestDefaultGlobalSettingsDialog",
105                                                   &my_info, 0);
106         }
107         return my_type;
108 }
109
110 static void
111 modest_default_global_settings_dialog_class_init (ModestDefaultGlobalSettingsDialogClass *klass)
112 {
113         GObjectClass *gobject_class;
114         gobject_class = (GObjectClass*) klass;
115
116         parent_class            = g_type_class_peek_parent (klass);
117         gobject_class->finalize = modest_default_global_settings_dialog_finalize;
118
119         g_type_class_add_private (gobject_class, sizeof(ModestDefaultGlobalSettingsDialogPrivate));
120
121         MODEST_GLOBAL_SETTINGS_DIALOG_CLASS (klass)->current_connection_func = current_connection;
122 }
123
124 typedef struct {
125         ModestDefaultGlobalSettingsDialog *dia;
126         GtkWidget *focus_widget;
127 } SwitchPageHelper;
128
129
130 static void
131 modest_default_global_settings_dialog_init (ModestDefaultGlobalSettingsDialog *self)
132 {
133         ModestDefaultGlobalSettingsDialogPrivate *priv;
134         ModestGlobalSettingsDialogPrivate *ppriv;
135         GtkWidget *align;
136         GtkWidget *top_vbox;
137
138         priv  = MODEST_DEFAULT_GLOBAL_SETTINGS_DIALOG_GET_PRIVATE (self);
139         ppriv = MODEST_GLOBAL_SETTINGS_DIALOG_GET_PRIVATE (self);
140
141         ppriv->updating_page = create_updating_page (self);
142         top_vbox = gtk_vbox_new (FALSE, 0);
143         align = gtk_alignment_new (0.0, 0.0, 1.0, 1.0);
144         gtk_alignment_set_padding (GTK_ALIGNMENT (align), 0, 0, MODEST_MARGIN_DOUBLE, 0);
145
146         /* Add the buttons: */
147         gtk_dialog_add_button (GTK_DIALOG (self), _HL("wdgt_bd_save"), GTK_RESPONSE_OK);
148
149         /* Set the default focusable widgets */
150         g_object_set_data (G_OBJECT(ppriv->updating_page), DEFAULT_FOCUS_WIDGET,
151                            (gpointer)ppriv->auto_update);
152
153         gtk_container_add (GTK_CONTAINER (top_vbox), ppriv->updating_page);
154         gtk_container_add (GTK_CONTAINER (align), top_vbox);
155         gtk_container_add (GTK_CONTAINER (GTK_DIALOG (self)->vbox), align);
156         gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (self)->vbox), MODEST_MARGIN_HALF);
157         gtk_window_set_default_size (GTK_WINDOW (self), -1, MODEST_DIALOG_WINDOW_MAX_HEIGHT);
158
159         gtk_widget_show (align);
160         gtk_widget_show (top_vbox);
161 }
162
163 static void
164 modest_default_global_settings_dialog_finalize (GObject *obj)
165 {
166         ModestGlobalSettingsDialogPrivate *ppriv;
167         ModestDefaultGlobalSettingsDialogPrivate *priv;
168
169         priv = MODEST_DEFAULT_GLOBAL_SETTINGS_DIALOG_GET_PRIVATE (obj);
170         ppriv = MODEST_GLOBAL_SETTINGS_DIALOG_GET_PRIVATE (obj);
171
172 /*      free/unref instance resources here */
173         G_OBJECT_CLASS(parent_class)->finalize (obj);
174 }
175
176 GtkWidget*
177 modest_default_global_settings_dialog_new (void)
178 {
179         GtkWidget *self = GTK_WIDGET(g_object_new(MODEST_TYPE_DEFAULT_GLOBAL_SETTINGS_DIALOG, NULL));
180
181         /* Load settings */
182         modest_default_global_settings_dialog_load_settings (MODEST_GLOBAL_SETTINGS_DIALOG (self));
183
184         return self;
185 }
186
187 /*
188  * Creates the updating page
189  */
190 static GtkWidget*
191 create_updating_page (ModestDefaultGlobalSettingsDialog *self)
192 {
193         GtkWidget *vbox;
194         GtkSizeGroup *title_size_group;
195         GtkSizeGroup *value_size_group;
196         ModestGlobalSettingsDialogPrivate *ppriv;
197         GtkWidget *scrollable, *separator;
198         ModestDefaultGlobalSettingsDialogPrivate *priv;
199
200         priv = MODEST_DEFAULT_GLOBAL_SETTINGS_DIALOG_GET_PRIVATE (self);
201         ppriv = MODEST_GLOBAL_SETTINGS_DIALOG_GET_PRIVATE (self);
202         vbox = gtk_vbox_new (FALSE, MODEST_MARGIN_HALF);
203
204         title_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
205         value_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
206
207         /* Default account selector */
208         ppriv->accounts_list = get_accounts_list ();
209         ppriv->default_account_selector = modest_toolkit_factory_create_selector (modest_runtime_get_toolkit_factory (),
210                                                                                   ppriv->accounts_list,
211                                                                                   g_str_equal);
212         if (ppriv->accounts_list == NULL) {
213                 gtk_widget_set_sensitive (GTK_WIDGET (ppriv->default_account_selector), FALSE);
214         } else {
215                 gchar *default_account;
216
217                 default_account = modest_account_mgr_get_default_account (
218                         modest_runtime_get_account_mgr ());
219                 if (default_account) {
220                         modest_selector_set_active_id (ppriv->default_account_selector,
221                                                        default_account);
222                         ppriv->initial_state.default_account = default_account;
223                 }
224         }
225         if (GTK_IS_COMBO_BOX (ppriv->default_account_selector)) {
226                 GtkWidget *caption;
227
228                 caption = modest_toolkit_utils_create_vcaptioned (title_size_group,
229                                                                   _("mcen_ti_default_account"), FALSE,
230                                                                   ppriv->default_account_selector);
231                 gtk_widget_show (caption);
232                 gtk_box_pack_start (GTK_BOX (vbox), caption,
233                                     FALSE, FALSE, 0);
234         } else {
235                 modest_toolkit_utils_set_vbutton_layout (title_size_group,
236                                                          _("mcen_ti_default_account"),
237                                                          ppriv->default_account_selector);
238                 gtk_box_pack_start (GTK_BOX (vbox), ppriv->default_account_selector,
239                                     FALSE, FALSE, 0);
240         }
241
242         /* Message format */
243         /* Note: This ModestPairList* must exist for as long as the picker
244          * that uses it, because the ModestSelectorPicker uses the ID opaquely,
245          * so it can't know how to manage its memory. */
246         ppriv->msg_format_list = _modest_global_settings_dialog_get_msg_formats ();
247         ppriv->msg_format = modest_toolkit_factory_create_selector (modest_runtime_get_toolkit_factory (),
248                                                                     ppriv->msg_format_list, g_int_equal);
249         if (GTK_IS_COMBO_BOX (ppriv->msg_format)) {
250                 GtkWidget *caption;
251                 caption = modest_toolkit_utils_create_vcaptioned (title_size_group,
252                                                                   _("mcen_fi_options_messageformat"), FALSE,
253                                                                   ppriv->msg_format);
254                 gtk_widget_show (caption);
255                 gtk_box_pack_start (GTK_BOX (vbox), caption, FALSE, FALSE, 0);
256         } else {
257                 modest_toolkit_utils_set_vbutton_layout (title_size_group,
258                                                          _("mcen_fi_options_messageformat"),
259                                                          ppriv->msg_format);
260                 gtk_box_pack_start (GTK_BOX (vbox), ppriv->msg_format, FALSE, FALSE, 0);
261         }
262
263
264         /* Incoming notifications */
265         ppriv->notifications = modest_toolkit_factory_create_check_button (modest_runtime_get_toolkit_factory (),
266                                                                            _("mcen_fi_options_incoming_notifications"));
267         gtk_box_pack_start (GTK_BOX (vbox), ppriv->notifications, FALSE, FALSE, 0);
268
269         /* Automatic add to contacts */
270         ppriv->add_to_contacts = modest_toolkit_factory_create_check_button (modest_runtime_get_toolkit_factory (),
271                                                                              _("mcen_fi_options_automatic_add"));
272         gtk_box_pack_start (GTK_BOX (vbox), ppriv->add_to_contacts, FALSE, FALSE, 0);
273
274         /* Separator label */
275         separator = gtk_label_new (_("mcen_ti_updating"));
276         gtk_label_set_justify ((GtkLabel *) separator, GTK_JUSTIFY_CENTER);
277         gtk_box_pack_start (GTK_BOX (vbox), separator, FALSE, FALSE, MODEST_MARGIN_DEFAULT);
278
279         /* Auto update */
280         ppriv->auto_update = modest_toolkit_factory_create_check_button (modest_runtime_get_toolkit_factory (),
281                                                                          _("mcen_fi_options_autoupdate"));
282         gtk_box_pack_start (GTK_BOX (vbox), ppriv->auto_update, FALSE, FALSE, 0);
283         g_signal_connect (ppriv->auto_update, "clicked", G_CALLBACK (on_auto_update_clicked), self);
284
285         /* Connected via */
286
287         /* Note: This ModestPairList* must exist for as long as the picker
288          * that uses it, because the ModestSelectorPicker uses the ID opaquely, 
289          * so it can't know how to manage its memory. */ 
290         ppriv->connect_via_list = _modest_global_settings_dialog_get_connected_via ();
291         ppriv->connect_via = modest_toolkit_factory_create_selector (modest_runtime_get_toolkit_factory (),
292                                                                      ppriv->connect_via_list, g_int_equal);
293         if (GTK_IS_COMBO_BOX (ppriv->connect_via)) {
294                 GtkWidget *caption;
295                 caption = modest_toolkit_utils_create_vcaptioned (title_size_group,
296                                                                   _("mcen_fi_options_connectiontype"), FALSE,
297                                                                   ppriv->connect_via);
298                 gtk_widget_show (caption);
299                 gtk_box_pack_start (GTK_BOX (vbox), caption, FALSE, FALSE, 0);
300         } else {
301                 modest_toolkit_utils_set_vbutton_layout (title_size_group, 
302                                                          _("mcen_fi_options_connectiontype"),
303                                                          ppriv->connect_via);
304                 gtk_box_pack_start (GTK_BOX (vbox), ppriv->connect_via, FALSE, FALSE, 0);
305         }
306
307         /* Update interval */
308
309         /* Note: This ModestPairList* must exist for as long as the picker
310          * that uses it, because the ModestSelectorPicker uses the ID opaquely, 
311          * so it can't know how to manage its memory. */ 
312         ppriv->update_interval_list = _modest_global_settings_dialog_get_update_interval ();
313         ppriv->update_interval = modest_toolkit_factory_create_selector (modest_runtime_get_toolkit_factory (),
314                                                                          ppriv->update_interval_list, g_int_equal);
315         if (GTK_IS_COMBO_BOX (ppriv->update_interval)) {
316                 GtkWidget *caption;
317                 caption = modest_toolkit_utils_create_vcaptioned (title_size_group,
318                                                                   _("mcen_fi_options_updateinterval"), FALSE,
319                                                                   ppriv->update_interval);
320                 gtk_widget_show (caption);
321                 gtk_box_pack_start (GTK_BOX (vbox), caption, FALSE, FALSE, 0);
322         } else {
323                 modest_toolkit_utils_set_vbutton_layout (title_size_group, 
324                                                          _("mcen_fi_options_updateinterval"), 
325                                                          ppriv->update_interval);
326                 gtk_box_pack_start (GTK_BOX (vbox), ppriv->update_interval, FALSE, FALSE, 0);
327         }
328
329         scrollable = modest_toolkit_factory_create_scrollable (modest_runtime_get_toolkit_factory ());
330
331         modest_scrollable_add_with_viewport (MODEST_SCROLLABLE (scrollable), vbox);
332         gtk_widget_show (vbox);
333         gtk_widget_show (scrollable);
334
335         g_object_unref (title_size_group);
336         g_object_unref (value_size_group);
337
338         return scrollable;
339 }
340
341
342 static void
343 update_sensitive (ModestGlobalSettingsDialog *dialog)
344 {
345         ModestGlobalSettingsDialogPrivate *ppriv;
346
347         g_return_if_fail (MODEST_IS_GLOBAL_SETTINGS_DIALOG (dialog));
348         ppriv = MODEST_GLOBAL_SETTINGS_DIALOG_GET_PRIVATE (dialog);
349
350         if (modest_togglable_get_active (ppriv->auto_update)) {
351                 gtk_widget_set_sensitive (ppriv->connect_via, TRUE);
352                 gtk_widget_set_sensitive (ppriv->update_interval, TRUE);
353         } else {
354                 gtk_widget_set_sensitive (ppriv->connect_via, FALSE);
355                 gtk_widget_set_sensitive (ppriv->update_interval, FALSE);
356         }
357 }
358
359 static void
360 on_auto_update_clicked (GtkButton *button,
361                         gpointer user_data)
362 {
363         g_return_if_fail (MODEST_IS_GLOBAL_SETTINGS_DIALOG (user_data));
364         update_sensitive ((ModestGlobalSettingsDialog *) user_data);
365 }
366
367 static ModestConnectedVia
368 current_connection (void)
369 {
370         return modest_platform_get_current_connection ();
371 }
372
373 static gint
374 order_by_acc_name (gconstpointer a,
375                    gconstpointer b)
376 {
377         ModestPair *pair_a, *pair_b;
378
379         pair_a = (ModestPair *) a;
380         pair_b = (ModestPair *) b;
381
382         if (pair_a->second && pair_b->second) {
383                 gint compare = g_utf8_collate ((gchar *) pair_a->second,
384                                                (gchar *) pair_b->second);
385                 if (compare > 0)
386                         compare = -1;
387                 else if (compare < 0)
388                         compare = 1;
389
390                 return compare;
391         } else {
392                 return 0;
393         }
394 }
395
396 static ModestPairList *
397 get_accounts_list (void)
398 {
399         GSList *list = NULL;
400         GSList *cursor, *account_names;
401         ModestAccountMgr *account_mgr;
402
403         account_mgr = modest_runtime_get_account_mgr ();
404
405         cursor = account_names = modest_account_mgr_account_names (account_mgr, TRUE /*only enabled*/);
406         while (cursor) {
407                 gchar *account_name;
408                 ModestAccountSettings *settings;
409                 ModestServerAccountSettings *store_settings;
410
411                 account_name = (gchar*)cursor->data;
412
413                 settings = modest_account_mgr_load_account_settings (account_mgr, account_name);
414                 if (!settings) {
415                         g_printerr ("modest: failed to get account data for %s\n", account_name);
416                         cursor = cursor->next;
417                         continue;
418                 }
419                 store_settings = modest_account_settings_get_store_settings (settings);
420
421                 /* don't display accounts without stores */
422                 if (modest_server_account_settings_get_account_name (store_settings) != NULL) {
423
424                         if (modest_account_settings_get_enabled (settings)) {
425                                 ModestPair *pair;
426
427                                 pair = modest_pair_new (
428                                         g_strdup (account_name),
429                                         g_strdup (modest_account_settings_get_display_name (settings)),
430                                         FALSE);
431                                 list = g_slist_insert_sorted (list, pair, order_by_acc_name);
432                         }
433                 }
434
435                 g_object_unref (store_settings);
436                 g_object_unref (settings);
437                 cursor = cursor->next;
438         }
439
440         return (ModestPairList *) g_slist_reverse (list);
441 }
442
443
444 static void
445 modest_default_global_settings_dialog_load_settings (ModestGlobalSettingsDialog *self)
446 {
447         ModestConf *conf;
448         gboolean checked;
449         gint combo_id;
450         GError *error = NULL;
451         ModestGlobalSettingsDialogPrivate *ppriv;
452
453         ppriv = MODEST_GLOBAL_SETTINGS_DIALOG_GET_PRIVATE (self);
454         conf = modest_runtime_get_conf ();
455
456         /* Incoming notifications */
457         checked = modest_conf_get_bool (conf, MODEST_CONF_NOTIFICATIONS, &error);
458         if (error) {
459                 g_clear_error (&error);
460                 error = NULL;
461                 checked = FALSE;
462         }
463         modest_togglable_set_active (ppriv->notifications, checked);
464         ppriv->initial_state.notifications = checked;
465
466         /* Add to contacts */
467         checked = modest_conf_get_bool (conf, MODEST_CONF_AUTO_ADD_TO_CONTACTS, &error);
468         if (error) {
469                 g_clear_error (&error);
470                 error = NULL;
471                 checked = FALSE;
472         }
473         modest_togglable_set_active (ppriv->add_to_contacts, checked);
474         ppriv->initial_state.add_to_contacts = checked;
475
476         /* Autoupdate */
477         checked = modest_conf_get_bool (conf, MODEST_CONF_AUTO_UPDATE, &error);
478         if (error) {
479                 g_clear_error (&error);
480                 error = NULL;
481                 checked = FALSE;
482         }
483         modest_togglable_set_active (ppriv->auto_update, checked);
484         ppriv->initial_state.auto_update = checked;
485
486         /* Connected by */
487         combo_id = modest_conf_get_int (conf, MODEST_CONF_UPDATE_WHEN_CONNECTED_BY, &error);
488         if (error) {
489                 g_error_free (error);
490                 error = NULL;
491                 combo_id = MODEST_CONNECTED_VIA_WLAN_OR_WIMAX;
492         }
493         modest_selector_set_active_id (ppriv->connect_via,
494                                        (gpointer) &combo_id);
495         ppriv->initial_state.connect_via = combo_id;
496
497         /* Update interval */
498         combo_id = modest_conf_get_int (conf, MODEST_CONF_UPDATE_INTERVAL, &error);
499         if (error) {
500                 g_error_free (error);
501                 error = NULL;
502                 combo_id = MODEST_UPDATE_INTERVAL_15_MIN;
503         }
504         modest_selector_set_active_id (ppriv->update_interval,
505                                        (gpointer) &combo_id);
506         ppriv->initial_state.update_interval = combo_id;
507
508         /* Play sound */
509         checked = modest_conf_get_bool (conf, MODEST_CONF_PLAY_SOUND_MSG_ARRIVE, &error);
510         if (error) {
511                 g_error_free (error);
512                 error = NULL;
513                 checked = FALSE;
514         }
515         ppriv->initial_state.play_sound = checked;
516
517         /* Msg format */
518         checked = modest_conf_get_bool (conf, MODEST_CONF_PREFER_FORMATTED_TEXT, &error);
519         if (error) {
520                 g_error_free (error);
521                 error = NULL;
522                 combo_id = MODEST_FILE_FORMAT_FORMATTED_TEXT;
523         }
524         combo_id = (checked) ? MODEST_FILE_FORMAT_FORMATTED_TEXT : MODEST_FILE_FORMAT_PLAIN_TEXT;
525         modest_selector_set_active_id (ppriv->msg_format,
526                                        (gpointer) &combo_id);
527         ppriv->initial_state.prefer_formatted_text = checked;
528
529         /* force update of sensitiveness */
530         update_sensitive (MODEST_GLOBAL_SETTINGS_DIALOG (self));
531 }