]> git.0d.be Git - empathy.git/blob - src/empathy-import-dialog.c
Added empathy_import_dialog_accounts_to_import. (Jonny Lamb)
[empathy.git] / src / empathy-import-dialog.c
1 /*
2  * Copyright (C) 2008 Collabora Ltd.
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License as
6  * published by the Free Software Foundation; either version 2 of the
7  * License, or (at your option) any later version.
8  *
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  * General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public
15  * License along with this program; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  *
19  * Authors: Jonny Lamb <jonny.lamb@collabora.co.uk>
20  * */
21
22 #include <config.h>
23
24 #include <string.h>
25
26 #include <glib.h>
27 #include <gtk/gtk.h>
28 #include <glade/glade.h>
29 #include <glib/gi18n.h>
30 #include <glib/gstdio.h>
31
32 #include <libxml/parser.h>
33 #include <libxml/tree.h>
34
35 #include <libmissioncontrol/mc-account.h>
36 #include <telepathy-glib/util.h>
37
38 #include "empathy-import-dialog.h"
39
40 #define DEBUG_FLAG EMPATHY_DEBUG_OTHER
41 #include <libempathy/empathy-debug.h>
42 #include <libempathy/empathy-utils.h>
43
44 #include <libempathy-gtk/empathy-ui-utils.h>
45
46 /* Pidgin to MC map */
47 typedef struct
48 {
49   gchar *protocol;
50   gchar *pidgin_name;
51   gchar *mc_name;
52 } PidginMcMapItem;
53
54 static PidginMcMapItem pidgin_mc_map[] =
55 {
56   { "msn", "server", "server" },
57   { "msn", "port", "port" },
58
59   { "jabber", "connect_server", "server" },
60   { "jabber", "port", "port" },
61   { "jabber", "require_tls", "require-encryption" },
62   { "jabber", "old_ssl", "old-ssl" },
63
64   { "aim", "server", "server" },
65   { "aim", "port", "port" },
66
67   { "salut", "first", "first-name" },
68   { "salut", "last", "last-name" },
69   { "salut", "jid", "jid" },
70   { "salut", "email", "email" },
71
72   { "groupwise", "server", "server" },
73   { "groupwise", "port", "port" },
74
75   { "icq", "server", "server" },
76   { "icq", "port", "port" },
77
78   { "irc", "realname", "fullname" },
79   { "irc", "ssl", "use-ssl" },
80   { "irc", "port", "port" },
81
82   { "yahoo", "server", "server" },
83   { "yahoo", "port", "port" },
84   { "yahoo", "xfer_port", "xfer-port" },
85   { "yahoo", "ignore_invites", "ignore-invites" },
86   { "yahoo", "yahoojp", "yahoojp" },
87   { "yahoo", "xferjp_host", "xferjp-host" },
88   { "yahoo", "serverjp", "serverjp" },
89   { "yahoo", "xfer_host", "xfer-host" },
90 };
91
92 typedef struct
93 {
94   GHashTable *settings;
95   gchar *protocol;
96 } AccountData;
97
98 typedef struct
99 {
100   GtkWidget *window;
101   GtkWidget *treeview;
102   GtkWidget *button_ok;
103   GtkWidget *button_cancel;
104
105   guint no_imported;
106   guint no_not_imported;
107   guint no_ignored;
108 } EmpathyImportDialog;
109
110 #define PIDGIN_ACCOUNT_TAG_NAME "name"
111 #define PIDGIN_ACCOUNT_TAG_ACCOUNT "account"
112 #define PIDGIN_ACCOUNT_TAG_PROTOCOL "protocol"
113 #define PIDGIN_ACCOUNT_TAG_PASSWORD "password"
114 #define PIDGIN_ACCOUNT_TAG_SETTINGS "settings"
115 #define PIDGIN_SETTING_PROP_TYPE "type"
116 #define PIDGIN_PROTOCOL_BONJOUR "bonjour"
117 #define PIDGIN_PROTOCOL_NOVELL "novell"
118
119 enum
120 {
121   COL_IMPORT = 0,
122   COL_PROTOCOL,
123   COL_NAME,
124   COL_SOURCE,
125   COL_ACCOUNT_DATA,
126   COL_COUNT
127 };
128
129
130 static void import_dialog_add_setting (GHashTable *settings,
131     gchar *key, gpointer value, EmpathyImportSettingType  type);
132 static gboolean import_dialog_add_account (gchar *protocol_name,
133     GHashTable *settings);
134 static void import_dialog_pidgin_parse_setting (gchar *protocol,
135     xmlNodePtr setting, GHashTable *settings);
136 static void import_dialog_pidgin_import_accounts ();
137 static void import_dialog_button_ok_clicked_cb (GtkButton *button,
138     EmpathyImportDialog *dialog);
139 static void import_dialog_button_cancel_clicked_cb (GtkButton *button,
140     EmpathyImportDialog *dialog);
141
142 static void
143 import_dialog_account_data_free (AccountData *data)
144 {
145         g_free (data->protocol);
146         g_hash_table_destroy (data->settings);
147 }
148
149 static gboolean
150 import_dialog_add_account (AccountData *data)
151 {
152   McProfile *profile;
153   McAccount *account;
154   GHashTableIter iter;
155   gpointer key, value;
156   gchar *display_name;
157   GValue *username;
158
159   DEBUG ("Looking up profile with protocol '%s'", data->protocol);
160   profile = mc_profile_lookup (data->protocol);
161
162   if (profile == NULL)
163     return FALSE;
164
165   account = mc_account_create (profile);
166
167   g_hash_table_iter_init (&iter, data->settings);
168   while (g_hash_table_iter_next (&iter, &key, &value))
169     {
170       const gchar *param = key;
171       GValue *gvalue = value;
172
173       switch (G_VALUE_TYPE (gvalue))
174         {
175           case G_TYPE_STRING:
176             DEBUG ("Set param '%s' to '%s' (string)",
177                 param, g_value_get_string (gvalue));
178             mc_account_set_param_string (account,
179                 param, g_value_get_string (gvalue));
180             break;
181
182           case G_TYPE_BOOLEAN:
183             DEBUG ("Set param '%s' to %s (boolean)",
184                 param, g_value_get_boolean (gvalue) ? "TRUE" : "FALSE");
185             mc_account_set_param_boolean (account,
186                 param, g_value_get_boolean (gvalue));
187             break;
188
189           case G_TYPE_INT:
190             DEBUG ("Set param '%s' to '%i' (integer)",
191                 param, g_value_get_int (gvalue));
192             mc_account_set_param_int (account,
193                 param, g_value_get_int (gvalue));
194             break;
195         }
196     }
197
198   /* Set the display name of the account */
199   username = g_hash_table_lookup (data->settings, "account");
200   display_name = g_strdup_printf ("%s (%s)",
201       mc_profile_get_display_name (profile), g_value_get_string (username));
202   mc_account_set_display_name (account, display_name);
203
204   g_free (display_name);
205   g_object_unref (account);
206   g_object_unref (profile);
207
208   return TRUE;
209 }
210
211 static void
212 import_dialog_pidgin_parse_setting (AccountData *data,
213                                     xmlNodePtr setting)
214 {
215   PidginMcMapItem *item = NULL;
216   gchar *tag_name;
217   gchar *type = NULL;
218   gchar *content;
219   gint i;
220   GValue *value = NULL;
221
222   /* We can't do anything if we didn't discovered the protocol yet */
223   if (!data->protocol)
224     return;
225
226   /* We can't do anything if the setting don't have a name */
227   tag_name = (gchar *) xmlGetProp (setting, PIDGIN_ACCOUNT_TAG_NAME);
228   if (!tag_name)
229     return;
230
231   /* Search for the map corresponding to setting we are parsing */
232   for (i = 0; i < G_N_ELEMENTS (pidgin_mc_map); i++)
233     {
234       if (!tp_strdiff (data->protocol, pidgin_mc_map[i].protocol) &&
235           !tp_strdiff (tag_name, pidgin_mc_map[i].pidgin_name))
236         {
237           item = pidgin_mc_map + i;
238           break;
239         }
240     }
241   g_free (tag_name);
242
243   /* If we didn't find the item, there is nothing we can do */
244   if (!item)
245     return;
246
247   type = (gchar *) xmlGetProp (setting, PIDGIN_SETTING_PROP_TYPE);
248   content = (gchar *) xmlNodeGetContent (setting);
249
250   if (!tp_strdiff (type, "bool"))
251     {
252       i = (gint) g_ascii_strtod (content, NULL);
253       value = tp_g_value_slice_new (G_TYPE_BOOLEAN);
254       g_value_set_boolean (value, i != 0);
255     }
256   else if (!tp_strdiff (type, "int"))
257     {
258       i = (gint) g_ascii_strtod (content, NULL);
259       value = tp_g_value_slice_new (G_TYPE_INT);
260       g_value_set_int (value, i);
261     }
262   else if (!tp_strdiff (type, "string"))
263     {
264       value = tp_g_value_slice_new (G_TYPE_STRING);
265       g_value_set_string (value, content);
266     }
267
268   if (value)
269     g_hash_table_insert (data->settings, item->mc_name, value);
270
271   g_free (type);
272   g_free (content);
273 }
274
275 static GList *
276 import_dialog_pidgin_load (void)
277 {
278   xmlNodePtr rootnode, node, child, setting;
279   xmlParserCtxtPtr ctxt;
280   xmlDocPtr doc;
281   gchar *filename;
282   GList *accounts = NULL;
283
284   /* Load pidgin accounts xml */
285   ctxt = xmlNewParserCtxt ();
286   filename = g_build_filename (g_get_home_dir (), ".purple", "accounts.xml",
287       NULL);
288
289   if (g_access (filename, R_OK) != 0)
290     goto FILENAME;
291
292   doc = xmlCtxtReadFile (ctxt, filename, NULL, 0);
293
294   rootnode = xmlDocGetRootElement (doc);
295   if (rootnode == NULL)
296     goto OUT;
297
298   for (node = rootnode->children; node; node = node->next)
299     {
300       AccountData *data;
301
302       /* If it is not an account node, skip. */
303       if (tp_strdiff ((gchar *) node->name, PIDGIN_ACCOUNT_TAG_ACCOUNT))
304         continue;
305
306       /* Create account data struct */
307       data = g_slice_new0 (AccountData);
308       data->settings = g_hash_table_new_full (g_str_hash, g_str_equal, NULL,
309         (GDestroyNotify) tp_g_value_slice_free);
310
311       /* Parse account's child nodes to fill the account data struct */
312       for (child = node->children; child; child = child->next)
313         {
314           GValue *value;
315
316           /* Protocol */
317           if (!tp_strdiff ((gchar *) child->name,
318               PIDGIN_ACCOUNT_TAG_PROTOCOL))
319             {
320               const gchar *protocol;
321               gchar *content;
322
323               protocol = content = (gchar *) xmlNodeGetContent (child);
324
325               if (g_str_has_prefix (protocol, "prpl-"))
326                 protocol += 5;
327
328               if (!tp_strdiff (protocol, PIDGIN_PROTOCOL_BONJOUR))
329                 protocol = "salut";
330               else if (!tp_strdiff (protocol, PIDGIN_PROTOCOL_NOVELL))
331                 protocol = "groupwise";
332
333               data->protocol = g_strdup (protocol);
334               g_free (content);
335             }
336
337           /* Username and IRC server. */
338           else if (!tp_strdiff ((gchar *) child->name,
339               PIDGIN_ACCOUNT_TAG_NAME))
340             {
341               gchar *name;
342               GStrv name_resource = NULL;
343               GStrv nick_server = NULL;
344               const gchar *username;
345
346               name = (gchar *) xmlNodeGetContent (child);
347
348               /* Split "username/resource" */
349               if (g_strrstr (name, "/") != NULL)
350                 {
351                   name_resource = g_strsplit (name, "/", 2);
352                   username = name_resource[0];
353                 }
354               else
355                 username = name;
356
357              /* Split "username@server" if it is an IRC account */
358              if (data->protocol && strstr (name, "@") &&
359                  !tp_strdiff (data->protocol, "irc"))
360               {
361                 nick_server = g_strsplit (name, "@", 2);
362                 username = nick_server[0];
363
364                 /* Add the server setting */
365                 value = tp_g_value_slice_new (G_TYPE_STRING);
366                 g_value_set_string (value, nick_server[1]);
367                 g_hash_table_insert (data->settings, "server", value);
368               }
369
370               /* Add the account setting */
371               value = tp_g_value_slice_new (G_TYPE_STRING);
372               g_value_set_string (value, username);
373               g_hash_table_insert (data->settings, "account", value);
374
375               g_strfreev (name_resource);
376               g_strfreev (nick_server);
377               g_free (name);
378             }
379
380           /* Password */
381           else if (!tp_strdiff ((gchar *) child->name,
382               PIDGIN_ACCOUNT_TAG_PASSWORD))
383             {
384               gchar *password;
385
386               password = (gchar *) xmlNodeGetContent (child);
387
388               /* Add the password setting */
389               value = tp_g_value_slice_new (G_TYPE_STRING);
390               g_value_set_string (value, password);
391               g_hash_table_insert (data->settings, "password", value);
392
393               g_free (password);
394             }
395
396           /* Other settings */
397           else if (!tp_strdiff ((gchar *) child->name,
398               PIDGIN_ACCOUNT_TAG_SETTINGS))
399               for (setting = child->children; setting; setting = setting->next)
400                 import_dialog_pidgin_parse_setting (data, setting);
401         }
402
403       /* If we have the needed settings, add the account data to the list,
404        * otherwise free the data */
405       if (data->protocol && g_hash_table_size (data->settings) > 0)
406         accounts = g_list_prepend (accounts, data);
407       else
408         import_dialog_account_data_free (data);
409     }
410
411 OUT:
412   xmlFreeDoc(doc);
413   xmlFreeParserCtxt (ctxt);
414
415 FILENAME:
416   g_free (filename);
417
418   return accounts;
419 }
420
421 gboolean
422 empathy_import_dialog_accounts_to_import (void)
423 {
424   GList *list;
425   gboolean out;
426
427   list = import_dialog_pidgin_load ();
428
429   out = (g_list_length (list) > 0);
430
431   g_list_free (list);
432
433   return out;
434 }
435
436 static gboolean
437 import_dialog_tree_model_foreach (GtkTreeModel *model,
438                                   GtkTreePath *path,
439                                   GtkTreeIter *iter,
440                                   gpointer user_data)
441 {
442   EmpathyImportDialog *dialog = (EmpathyImportDialog *) user_data;
443   gboolean to_import;
444   AccountData *data;
445   GValue *value;
446
447   gtk_tree_model_get (model, iter,
448       COL_IMPORT, &to_import,
449       COL_ACCOUNT_DATA, &value,
450       -1);
451
452   if (!to_import)
453     {
454       dialog->no_ignored++;
455       return FALSE;
456     }
457
458   data = g_value_get_pointer (value);
459
460   if (import_dialog_add_account (data))
461     dialog->no_imported++;
462   else
463     dialog->no_not_imported++;
464
465   return FALSE;
466 }
467
468 static void
469 import_dialog_free (EmpathyImportDialog *dialog)
470 {
471   gtk_widget_destroy (dialog->window);
472   g_slice_free (EmpathyImportDialog, dialog);
473 }
474
475 static void
476 import_dialog_button_ok_clicked_cb (GtkButton *button,
477                                     EmpathyImportDialog *dialog)
478 {
479   GtkTreeModel *model;
480   GtkWidget *message;
481
482   model = gtk_tree_view_get_model (GTK_TREE_VIEW (dialog->treeview));
483
484   gtk_tree_model_foreach (model, import_dialog_tree_model_foreach, dialog);
485
486   message = gtk_message_dialog_new (GTK_WINDOW (dialog->window),
487       GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE,
488       _("%u accounts imported successfully.\n"
489         "%u accounts failed to import.\n"
490         "%u accounts were ignored."),
491       dialog->no_imported, dialog->no_not_imported, dialog->no_ignored);
492
493   gtk_dialog_run (GTK_DIALOG (message));
494   gtk_widget_destroy (message);
495
496   import_dialog_free (dialog);
497 }
498
499 static void
500 import_dialog_button_cancel_clicked_cb (GtkButton *button,
501                                         EmpathyImportDialog *dialog)
502 {
503   import_dialog_free (dialog);
504 }
505
506 static gboolean
507 import_dialog_filter_mc_accounts (McAccount *account,
508                                   gpointer user_data)
509 {
510   gchar *value;
511   const gchar *username;
512   gboolean result;
513
514   username = (const gchar *) user_data;
515
516   if (mc_account_get_param_string (account, "account", &value)
517       == MC_ACCOUNT_SETTING_ABSENT)
518     return FALSE;
519
520   result = tp_strdiff (value, username);
521
522   g_free (value);
523
524   return !result;
525 }
526
527 static gboolean
528 import_dialog_add_accounts_to_model (EmpathyImportDialog *dialog)
529 {
530   GtkTreeModel *model;
531   GtkTreeIter iter;
532   GList *accounts, *account;
533   guint length;
534
535   model = gtk_tree_view_get_model (GTK_TREE_VIEW (dialog->treeview));
536
537   accounts = import_dialog_pidgin_load ();
538
539   length = g_list_length (accounts);
540
541   for (account = accounts; account; account = account->next)
542     {
543       GValue *value, *account_data;
544       AccountData *data = (AccountData *) account->data;
545       gboolean import;
546       GList *accounts, *all_accounts;
547       McProfile *profile;
548
549       account_data = tp_g_value_slice_new (G_TYPE_POINTER);
550       g_value_set_pointer (account_data, data);
551
552       value = g_hash_table_lookup (data->settings, "account");
553
554       /* Get the profile of the account we're adding to get all current
555        * accounts in MC. */
556       profile = mc_profile_lookup (data->protocol);
557
558       all_accounts = profile ? mc_accounts_list_by_profile (profile) :
559         mc_accounts_list ();
560
561       /* Filter the list of all relevant accounts to remove ones which are NOT
562        * the same as the one we're now adding. */
563       accounts = mc_accounts_filter (all_accounts,
564           import_dialog_filter_mc_accounts,
565           (gpointer) g_value_get_string (value));
566
567       /* Make the checkbox ticked if there is *no* account already with the
568        * relevant details. */
569       import = (g_list_length (accounts) == 0);
570
571       mc_accounts_list_free (accounts);
572       g_object_unref (profile);
573
574       gtk_list_store_append (GTK_LIST_STORE (model), &iter);
575
576       gtk_list_store_set (GTK_LIST_STORE (model), &iter,
577           COL_IMPORT, import,
578           COL_PROTOCOL, data->protocol,
579           COL_NAME, g_value_get_string (value),
580           COL_SOURCE, "Pidgin",
581           COL_ACCOUNT_DATA, account_data,
582           -1);
583     }
584
585   g_list_free (accounts);
586
587   if (length == 0)
588     {
589       GtkWidget *message;
590
591       message = gtk_message_dialog_new (
592           gtk_window_get_transient_for (GTK_WINDOW (dialog->window)),
593           GTK_DIALOG_MODAL, GTK_MESSAGE_WARNING, GTK_BUTTONS_CLOSE,
594           _("No accounts to import could be found. Empathy currently only "
595             "supports importing accounts from Pidgin."));
596
597       gtk_dialog_run (GTK_DIALOG (message));
598       gtk_widget_destroy (message);
599       import_dialog_free (dialog);
600       return FALSE;
601     }
602   else
603     return TRUE;
604 }
605
606 static void
607 import_dialog_cell_toggled_cb (GtkCellRendererToggle *cell_renderer,
608                                const gchar *path_str,
609                                EmpathyImportDialog *dialog)
610 {
611   GtkTreeModel *model;
612   GtkTreeIter iter;
613   GtkTreePath *path;
614
615   path = gtk_tree_path_new_from_string (path_str);
616   model = gtk_tree_view_get_model (GTK_TREE_VIEW (dialog->treeview));
617
618   gtk_tree_model_get_iter (model, &iter, path);
619
620   gtk_list_store_set (GTK_LIST_STORE (model), &iter,
621       COL_IMPORT, !gtk_cell_renderer_toggle_get_active (cell_renderer),
622       -1);
623
624   gtk_tree_path_free (path);
625 }
626
627 static gboolean
628 import_dialog_set_up_account_list (EmpathyImportDialog *dialog)
629 {
630   GtkListStore *store;
631   GtkTreeView *view;
632   GtkTreeViewColumn *column;
633   GtkCellRenderer *cell;
634
635   store = gtk_list_store_new (COL_COUNT, G_TYPE_BOOLEAN, G_TYPE_STRING,
636       G_TYPE_STRING, G_TYPE_STRING, G_TYPE_VALUE);
637
638   gtk_tree_view_set_model (GTK_TREE_VIEW (dialog->treeview),
639       GTK_TREE_MODEL (store));
640
641   g_object_unref (store);
642
643   view = GTK_TREE_VIEW (dialog->treeview);
644   gtk_tree_view_set_headers_visible (view, TRUE);
645
646   /* Import column */
647   cell = gtk_cell_renderer_toggle_new ();
648   gtk_tree_view_insert_column_with_attributes (view, -1,
649       _("Import"), cell,
650       "active", COL_IMPORT,
651       NULL);
652
653   g_signal_connect (cell, "toggled",
654       G_CALLBACK (import_dialog_cell_toggled_cb), dialog);
655
656   /* Protocol column */
657   column = gtk_tree_view_column_new ();
658   gtk_tree_view_column_set_title (column, _("Protocol"));
659   gtk_tree_view_column_set_expand (column, TRUE);
660   gtk_tree_view_append_column (view, column);
661
662   cell = gtk_cell_renderer_text_new ();
663   g_object_set (cell,
664       "editable", FALSE,
665       NULL);
666   gtk_tree_view_column_pack_start (column, cell, TRUE);
667   gtk_tree_view_column_add_attribute (column, cell, "text", COL_PROTOCOL);
668
669   /* Account column */
670   column = gtk_tree_view_column_new ();
671   gtk_tree_view_column_set_title (column, _("Account"));
672   gtk_tree_view_column_set_expand (column, TRUE);
673   gtk_tree_view_append_column (view, column);
674
675   cell = gtk_cell_renderer_text_new ();
676   g_object_set (cell,
677       "editable", FALSE,
678       NULL);
679   gtk_tree_view_column_pack_start (column, cell, TRUE);
680   gtk_tree_view_column_add_attribute (column, cell, "text", COL_NAME);
681
682   /* Source column */
683   column = gtk_tree_view_column_new ();
684   gtk_tree_view_column_set_title (column, _("Source"));
685   gtk_tree_view_column_set_expand (column, TRUE);
686   gtk_tree_view_append_column (view, column);
687
688   cell = gtk_cell_renderer_text_new ();
689   g_object_set (cell,
690       "editable", FALSE,
691       NULL);
692   gtk_tree_view_column_pack_start (column, cell, TRUE);
693   gtk_tree_view_column_add_attribute (column, cell, "text", COL_SOURCE);
694
695   return import_dialog_add_accounts_to_model (dialog);
696 }
697
698 void
699 empathy_import_dialog_show (GtkWindow *parent)
700 {
701   static EmpathyImportDialog *dialog = NULL;
702   GladeXML *glade;
703   gchar *filename;
704
705   if (dialog)
706     {
707       gtk_window_present (GTK_WINDOW (dialog->window));
708       return;
709     }
710
711   dialog = g_slice_new0 (EmpathyImportDialog);
712
713   filename = empathy_file_lookup ("empathy-import-dialog.glade", "src");
714   glade = empathy_glade_get_file (filename,
715       "import_dialog",
716       NULL,
717       "import_dialog", &dialog->window,
718       "treeview", &dialog->treeview,
719       NULL);
720
721   empathy_glade_connect (glade,
722       dialog,
723       "button_ok", "clicked", import_dialog_button_ok_clicked_cb,
724       "button_cancel", "clicked", import_dialog_button_cancel_clicked_cb,
725       NULL);
726
727   g_object_add_weak_pointer (G_OBJECT (dialog->window), (gpointer) &dialog);
728
729   g_free (filename);
730   g_object_unref (glade);
731
732   if (parent)
733     gtk_window_set_transient_for (GTK_WINDOW (dialog->window), parent);
734
735   if (import_dialog_set_up_account_list (dialog))
736     gtk_widget_show (dialog->window);
737 }