1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
|
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* e-shell.c
*
* Copyright (C) 2000, 2001, 2002, 2003 Ximian, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
* Author: Ettore Perazzoli
*/
#include <config.h>
#include <string.h>
#include <sys/types.h>
#include <glib.h>
#include <glib/gstdio.h>
#include <gtk/gtkmain.h>
#include <gtk/gtksignal.h>
#ifdef GDK_WINDOWING_X11
#include <gdk/gdkprivate.h>
#include <gdk/gdkx.h>
#include <X11/Xatom.h>
#include <X11/Xlib.h>
#elif defined (GDK_WINDOWING_WIN32)
/* gdkwin32.h includes <windows.h> which stomps over the namespace */
#undef DATADIR
#define interface windows_interface
#include <gdk/gdkwin32.h>
#undef interface
#endif
#include <glib/gi18n.h>
#include <libgnome/gnome-util.h>
#include <gconf/gconf-client.h>
#include <bonobo-activation/bonobo-activation.h>
#include <bonobo/bonobo-exception.h>
#include <bonobo/bonobo-moniker-util.h>
#include <libedataserver/e-xml-utils.h>
#include <libedataserverui/e-passwords.h>
#include "e-util/e-bconf-map.h"
#include "e-util/e-dialog-utils.h"
#include "e-util/e-error.h"
#include "e-util/e-fsutils.h"
#include "e-util/e-util.h"
#include "Evolution.h"
#include "e-shell-constants.h"
#include "e-shell-marshal.h"
#include "e-shell-settings-dialog.h"
#include "e-shell.h"
#include "e-shell-view.h"
#include "es-event.h"
#include "evolution-listener.h"
#include "evolution-shell-component-utils.h"
static void set_line_status_complete(EvolutionListener *el, void *data);
#define PARENT_TYPE bonobo_object_get_type ()
static BonoboObjectClass *parent_class = NULL;
static gboolean session_started = FALSE;
struct _EShellPrivate {
/* IID for registering the object on OAF. */
char *iid;
GList *windows;
/* EUriSchemaRegistry *uri_schema_registry; FIXME */
EComponentRegistry *component_registry;
/* Names for the types of the folders that have maybe crashed. */
/* FIXME TODO */
GList *crash_type_names; /* char * */
/* Line status and controllers */
EShellLineStatus line_status;
int line_status_pending;
EShellLineStatus line_status_working;
EvolutionListener *line_status_listener;
/* Settings Dialog */
union {
GtkWidget *widget;
gpointer pointer;
} settings_dialog;
/* If we're quitting and things are still busy, a timeout handler */
guint quit_timeout;
/* Whether the shell is succesfully initialized. This is needed during
the start-up sequence, to avoid CORBA calls to do make wrong things
to happen while the shell is initializing. */
unsigned int is_initialized : 1;
/* Wether the shell is working in "interactive" mode or not.
(Currently, it's interactive IIF there is at least one active
view.) */
unsigned int is_interactive : 1;
/* Whether quit has been requested, and the shell is now waiting for
permissions from all the components to quit. */
unsigned int preparing_to_quit : 1;
};
/* Signals. */
enum {
NO_WINDOWS_LEFT,
LINE_STATUS_CHANGED,
NEW_WINDOW_CREATED,
LAST_SIGNAL
};
static guint signals[LAST_SIGNAL] = { 0 };
/* Utility functions. */
static gboolean
get_config_start_offline (void)
{
GConfClient *client;
gboolean value;
client = gconf_client_get_default ();
value = gconf_client_get_bool (client, "/apps/evolution/shell/start_offline", NULL);
g_object_unref (client);
return value;
}
/* Interactivity handling. */
static void
set_interactive (EShell *shell,
gboolean interactive)
{
GSList *component_list;
GSList *p;
GList *first_element;
int num_windows;
GtkWidget *view;
g_return_if_fail (E_IS_SHELL (shell));
shell->priv->is_interactive = interactive;
num_windows = g_list_length (shell->priv->windows);
/* We want to send the "interactive" message only when the first
window is created */
if (num_windows != 1)
return;
first_element = g_list_first (shell->priv->windows);
view = GTK_WIDGET (first_element->data);
component_list = e_component_registry_peek_list (shell->priv->component_registry);
for (p = component_list; p != NULL; p = p->next) {
EComponentInfo *info = p->data;
CORBA_Environment ev;
CORBA_exception_init (&ev);
#ifdef GDK_WINDOWING_X11
GNOME_Evolution_Component_interactive (info->iface, interactive,GPOINTER_TO_INT (GDK_WINDOW_XWINDOW (view->window)), &ev);
#elif defined (GDK_WINDOWING_WIN32)
GNOME_Evolution_Component_interactive (info->iface, interactive,GPOINTER_TO_INT (GDK_WINDOW_HWND (view->window)), &ev);
#else
#error Port this to your windowing system
#endif
/* Ignore errors, the components can decide to not implement
this interface. */
CORBA_exception_free (&ev);
}
}
/* CORBA interface implementation. */
static gboolean
raise_exception_if_not_ready (PortableServer_Servant servant,
CORBA_Environment *ev)
{
EShell *shell;
shell = E_SHELL (bonobo_object_from_servant (servant));
if (! shell->priv->is_initialized) {
CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
ex_GNOME_Evolution_Shell_NotReady, NULL);
return TRUE;
}
return FALSE;
}
static GNOME_Evolution_ShellView
impl_Shell_createNewWindow (PortableServer_Servant servant,
const CORBA_char *component_id,
CORBA_Environment *ev)
{
BonoboObject *bonobo_object;
EShell *shell;
EShellWindow *shell_window;
EShellView *shell_view;
if (raise_exception_if_not_ready (servant, ev))
return CORBA_OBJECT_NIL;
bonobo_object = bonobo_object_from_servant (servant);
shell = E_SHELL (bonobo_object);
if (component_id[0] == '\0')
component_id = NULL;
shell_window = e_shell_create_window (shell, component_id, NULL);
if (shell_window == NULL) {
CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
ex_GNOME_Evolution_Shell_ComponentNotFound, NULL);
return CORBA_OBJECT_NIL;
}
/* refs?? */
shell_view = e_shell_view_new(shell_window);
return BONOBO_OBJREF(shell_view);
}
static void
impl_Shell_handleURI (PortableServer_Servant servant,
const CORBA_char *uri,
CORBA_Environment *ev)
{
EShell *shell = E_SHELL (bonobo_object_from_servant (servant));
EComponentInfo *component_info;
char *schema, *p;
int show = FALSE;
schema = g_alloca(strlen(uri)+1);
strcpy(schema, uri);
p = strchr(schema, ':');
if (p)
*p = 0;
component_info = e_component_registry_peek_info(shell->priv->component_registry, ECR_FIELD_SCHEMA, schema);
if (component_info == NULL) {
show = TRUE;
component_info = e_component_registry_peek_info(shell->priv->component_registry, ECR_FIELD_ALIAS, schema);
}
if (component_info == NULL) {
CORBA_exception_set (ev, CORBA_USER_EXCEPTION, ex_GNOME_Evolution_Shell_UnsupportedSchema, NULL);
return;
}
if (show) {
GtkWidget *shell_window;
shell_window = (GtkWidget *)e_shell_create_window (shell, component_info->id, NULL);
if (shell_window == NULL) {
CORBA_exception_set (ev, CORBA_USER_EXCEPTION, ex_GNOME_Evolution_Shell_ComponentNotFound, NULL);
return;
}
}
GNOME_Evolution_Component_handleURI (component_info->iface, uri, ev);
/* not an error not to implement it */
if (ev->_id != NULL && strcmp(ev->_id, ex_CORBA_NO_IMPLEMENT) == 0)
memset(ev, 0, sizeof(*ev));
}
static void
impl_Shell_setLineStatus (PortableServer_Servant servant,
CORBA_boolean online,
CORBA_Environment *ev)
{
BonoboObject *bonobo_object;
EShell *shell;
if (raise_exception_if_not_ready (servant, ev))
return;
bonobo_object = bonobo_object_from_servant (servant);
shell = E_SHELL (bonobo_object);
/* let the password manager know out online status */
e_passwords_set_online(online);
if (online)
e_shell_go_online (shell, NULL, GNOME_Evolution_USER_ONLINE);
else
e_shell_go_offline (shell, NULL, GNOME_Evolution_USER_OFFLINE);
}
/*
static GNOME_Evolution_Component
impl_Shell_findComponent(PortableServer_Servant servant,
const CORBA_char *id,
CORBA_Environment *ev)
{
EShell *shell;
EComponentInfo *ci;
if (raise_exception_if_not_ready (servant, ev))
return CORBA_OBJECT_NIL;
shell = (EShell *)bonobo_object_from_servant (servant);
ci = e_component_registry_peek_info(shell->priv->component_registry, ECR_FIELD_ALIAS, id);
if (ci == NULL) {
CORBA_exception_set (ev, CORBA_USER_EXCEPTION, ex_GNOME_Evolution_Shell_ComponentNotFound, NULL);
return CORBA_OBJECT_NIL;
} else if (ci->iface == NULL) {
CORBA_exception_set (ev, CORBA_USER_EXCEPTION, ex_GNOME_Evolution_Shell_NotReady, NULL);
return CORBA_OBJECT_NIL;
} else {
return ci->iface;
}
}
*/
/* EShellWindow handling and bookkeeping. */
static int
window_delete_event_cb (GtkWidget *widget,
GdkEventAny *ev,
void *data)
{
EShell *shell;
g_return_val_if_fail (E_IS_SHELL_WINDOW (widget), TRUE);
shell = E_SHELL (data);
return ! e_shell_request_close_window (shell, E_SHELL_WINDOW (widget));
}
static gboolean
notify_no_windows_left_idle_cb (void *data)
{
EShell *shell;
EShellPrivate *priv;
shell = E_SHELL (data);
priv = shell->priv;
set_interactive (shell, FALSE);
g_signal_emit (shell, signals [NO_WINDOWS_LEFT], 0);
if (priv->iid != NULL)
bonobo_activation_active_server_unregister (priv->iid,
bonobo_object_corba_objref (BONOBO_OBJECT (shell)));
bonobo_object_unref (BONOBO_OBJECT (shell));
return FALSE;
}
static void
window_weak_notify (void *data,
GObject *where_the_object_was)
{
EShell *shell;
int num_windows;
shell = E_SHELL (data);
num_windows = g_list_length (shell->priv->windows);
/* If this is our last window, save settings now because in the callback
for no_windows_left shell->priv->windows will be NULL and settings won't
be saved because of that. */
if (num_windows == 1)
e_shell_save_settings (shell);
shell->priv->windows = g_list_remove (shell->priv->windows, where_the_object_was);
if (shell->priv->windows == NULL) {
bonobo_object_ref (BONOBO_OBJECT (shell));
g_idle_add (notify_no_windows_left_idle_cb, shell);
}
}
/* GObject methods. */
static void
impl_dispose (GObject *object)
{
EShell *shell;
EShellPrivate *priv;
GList *p;
shell = E_SHELL (object);
priv = shell->priv;
priv->is_initialized = FALSE;
#if 0 /* FIXME */
if (priv->uri_schema_registry != NULL) {
g_object_unref (priv->uri_schema_registry);
priv->uri_schema_registry = NULL;
}
#endif
if (priv->component_registry != NULL) {
g_object_unref (priv->component_registry);
priv->component_registry = NULL;
}
if (priv->quit_timeout) {
g_source_remove(priv->quit_timeout);
priv->quit_timeout = 0;
}
for (p = priv->windows; p != NULL; p = p->next) {
EShellWindow *window;
window = E_SHELL_WINDOW (p->data);
g_signal_handlers_disconnect_by_func (window, G_CALLBACK (window_delete_event_cb), shell);
g_object_weak_unref (G_OBJECT (window), window_weak_notify, shell);
gtk_object_destroy (GTK_OBJECT (window));
}
g_list_free (priv->windows);
priv->windows = NULL;
/* No unreffing for these as they are aggregate. */
/* bonobo_object_unref (BONOBO_OBJECT (priv->corba_storage_registry)); */
if (priv->settings_dialog.widget != NULL) {
gtk_widget_destroy (priv->settings_dialog.widget);
priv->settings_dialog.widget = NULL;
}
if (priv->line_status_listener) {
priv->line_status_listener->complete = NULL;
bonobo_object_unref(BONOBO_OBJECT(priv->line_status_listener));
priv->line_status_listener = NULL;
}
g_free (priv->iid);
(* G_OBJECT_CLASS (parent_class)->dispose) (object);
}
static void
impl_finalize (GObject *object)
{
EShell *shell;
EShellPrivate *priv;
shell = E_SHELL (object);
priv = shell->priv;
g_list_foreach (priv->crash_type_names, (GFunc) g_free, NULL);
g_list_free (priv->crash_type_names);
g_free (priv);
(* G_OBJECT_CLASS (parent_class)->finalize) (object);
}
/* Initialization. */
static void
e_shell_class_init (EShellClass *klass)
{
GObjectClass *object_class;
POA_GNOME_Evolution_Shell__epv *epv;
parent_class = g_type_class_ref(PARENT_TYPE);
object_class = G_OBJECT_CLASS (klass);
object_class->dispose = impl_dispose;
object_class->finalize = impl_finalize;
signals[NO_WINDOWS_LEFT] =
g_signal_new ("no_windows_left",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (EShellClass, no_windows_left),
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
signals[LINE_STATUS_CHANGED] =
g_signal_new ("line_status_changed",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (EShellClass, line_status_changed),
NULL, NULL,
g_cclosure_marshal_VOID__INT,
G_TYPE_NONE, 1,
G_TYPE_INT);
signals[NEW_WINDOW_CREATED] =
g_signal_new ("new_window_created",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (EShellClass, new_window_created),
NULL, NULL,
g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE, 1,
G_TYPE_POINTER);
epv = & klass->epv;
epv->createNewWindow = impl_Shell_createNewWindow;
epv->handleURI = impl_Shell_handleURI;
epv->setLineStatus = impl_Shell_setLineStatus;
/* epv->findComponent = impl_Shell_findComponent;*/
}
static void
e_shell_init (EShell *shell)
{
EShellPrivate *priv;
priv = g_new0 (EShellPrivate, 1);
priv->line_status = E_SHELL_LINE_STATUS_OFFLINE;
priv->component_registry = e_component_registry_new ();
shell->priv = priv;
priv->line_status_listener = evolution_listener_new(set_line_status_complete, shell);
}
static void
detect_version (GConfClient *gconf, int *major, int *minor, int *revision)
{
char *val, *evolution_dir;
struct stat st;
evolution_dir = g_build_filename (g_get_home_dir (), "evolution", NULL);
val = gconf_client_get_string(gconf, "/apps/evolution/version", NULL);
if (val) {
/* Since 1.4.0 We've been keeping the version key in gconf */
sscanf(val, "%d.%d.%d", major, minor, revision);
g_free(val);
} else if (g_lstat (evolution_dir, &st) != 0 || !S_ISDIR (st.st_mode)) {
/* If ~/evolution does not exit or is not a directory it must be a new installation */
*major = 0;
*minor = 0;
*revision = 0;
} else {
xmlDocPtr config_doc;
xmlNodePtr source;
char *tmp;
tmp = g_build_filename (evolution_dir, "config.xmldb", NULL);
config_doc = e_xml_parse_file (tmp);
g_free (tmp);
tmp = NULL;
if (config_doc
&& (source = e_bconf_get_path (config_doc, "/Shell"))
&& (tmp = e_bconf_get_value (source, "upgrade_from_1_0_to_1_2_performed"))
&& tmp[0] == '1' ) {
*major = 1;
*minor = 2;
*revision = 0;
} else {
*major = 1;
*minor = 0;
*revision = 0;
}
g_free (tmp);
if (config_doc)
xmlFreeDoc (config_doc);
}
g_free (evolution_dir);
}
/* calls components to perform upgrade */
static gboolean
attempt_upgrade (EShell *shell, int major, int minor, int revision)
{
GSList *component_infos, *p;
gboolean success;
int res;
success = TRUE;
component_infos = e_component_registry_peek_list (shell->priv->component_registry);
for (p = component_infos; success && p != NULL; p = p->next) {
const EComponentInfo *info = p->data;
CORBA_Environment ev;
CORBA_exception_init (&ev);
GNOME_Evolution_Component_upgradeFromVersion (info->iface, major, minor, revision, &ev);
if (BONOBO_EX (&ev)) {
char *exception_text;
CORBA_char *id = CORBA_exception_id(&ev);
if (strcmp (id, ex_CORBA_NO_IMPLEMENT) == 0) {
/* Ignore components that do not implement this version, it
might just mean that they don't need an upgrade path. */
} else if (strcmp (id, ex_GNOME_Evolution_Component_UpgradeFailed) == 0) {
GNOME_Evolution_Component_UpgradeFailed *ex = CORBA_exception_value(&ev);
res = e_error_run(NULL, "shell:upgrade-failed", ex->what, ex->why, NULL);
if (res == GTK_RESPONSE_CANCEL)
success = FALSE;
} else if (strcmp (id, ex_GNOME_Evolution_Component_UnsupportedVersion) == 0) {
/* This is non-fatal */
/* DO WE CARE??? */
printf("Upgrade of component failed, unsupported prior version\n");
} else {
exception_text = bonobo_exception_get_text (&ev);
res = e_error_run(NULL, "shell:upgrade-failed", exception_text, _("Uknown system error."), NULL);
g_free (exception_text);
if (res == GTK_RESPONSE_CANCEL)
success = FALSE;
}
}
CORBA_exception_free (&ev);
}
return success;
}
/**
* e_shell_construct:
* @shell: An EShell object to construct
* @iid: OAFIID for registering the shell into the name server
* @startup_line_mode: How to set up the line mode (online or offline) initally.
*
* Construct @shell so that it uses the specified @corba_object.
*
* Return value: The result of the operation.
**/
EShellConstructResult
e_shell_construct (EShell *shell,
const char *iid,
EShellStartupLineMode startup_line_mode)
{
EShellPrivate *priv;
CORBA_Object corba_object;
gboolean start_online;
GSList *component;
g_return_val_if_fail (E_IS_SHELL (shell), E_SHELL_CONSTRUCT_RESULT_INVALIDARG);
g_return_val_if_fail (startup_line_mode == E_SHELL_STARTUP_LINE_MODE_CONFIG
|| startup_line_mode == E_SHELL_STARTUP_LINE_MODE_ONLINE
|| startup_line_mode == E_SHELL_STARTUP_LINE_MODE_OFFLINE,
E_SHELL_CONSTRUCT_RESULT_INVALIDARG);
priv = shell->priv;
priv->iid = g_strdup (iid);
/* Now we can register into OAF. Notice that we shouldn't be
registering into OAF until we are sure we can complete. */
/* FIXME: Multi-display stuff. */
corba_object = bonobo_object_corba_objref (BONOBO_OBJECT (shell));
if (bonobo_activation_active_server_register (iid, corba_object) != Bonobo_ACTIVATION_REG_SUCCESS)
return E_SHELL_CONSTRUCT_RESULT_CANNOTREGISTER;
while (gtk_events_pending ())
gtk_main_iteration ();
/* activate all the components (peek list does this implictly) */
/* Do we really need to assign the result of this to the list? */
component = e_component_registry_peek_list (shell->priv->component_registry);
e_shell_attempt_upgrade(shell);
priv->is_initialized = TRUE;
switch (startup_line_mode) {
case E_SHELL_STARTUP_LINE_MODE_CONFIG:
start_online = ! get_config_start_offline ();
break;
case E_SHELL_STARTUP_LINE_MODE_ONLINE:
start_online = TRUE;
break;
case E_SHELL_STARTUP_LINE_MODE_OFFLINE:
start_online = FALSE;
break;
default:
start_online = FALSE; /* Make compiler happy. */
g_return_val_if_reached(E_SHELL_CONSTRUCT_RESULT_OK);
}
e_passwords_set_online(start_online);
if (start_online)
e_shell_go_online (shell, NULL, GNOME_Evolution_USER_ONLINE);
else
e_shell_go_online (shell, NULL, GNOME_Evolution_FORCED_OFFLINE);
return E_SHELL_CONSTRUCT_RESULT_OK;
}
/**
* e_shell_new:
* @start_online: Whether to start in on-line mode or not.
* @construct_result_return: A pointer to an EShellConstructResult variable into
* which the result of the operation will be stored.
*
* Create a new EShell.
*
* Return value:
**/
EShell *
e_shell_new (EShellStartupLineMode startup_line_mode,
EShellConstructResult *construct_result_return)
{
EShell *new;
EShellConstructResult construct_result;
new = g_object_new (e_shell_get_type (), NULL);
construct_result = e_shell_construct (new, E_SHELL_OAFIID, startup_line_mode);
if (construct_result != E_SHELL_CONSTRUCT_RESULT_OK) {
*construct_result_return = construct_result;
bonobo_object_unref (BONOBO_OBJECT (new));
return NULL;
}
*construct_result_return = E_SHELL_CONSTRUCT_RESULT_OK;
return new;
}
static int
remove_dir(const char *root, const char *path)
{
GDir *dir;
const char *dname;
int res = -1;
char *new = NULL;
struct stat st;
dir = g_dir_open(path, 0, NULL);
if (dir == NULL)
return -1;
while ( (dname = g_dir_read_name(dir)) ) {
new = g_build_filename(path, dname, NULL);
if (g_stat(new, &st) == -1)
goto fail;
/* make sure we're really removing something from evolution dir */
g_return_val_if_fail (strlen(path) >= strlen(root)
&& strncmp(root, path, strlen(root)) == 0, -1);
if (S_ISDIR(st.st_mode)) {
if (remove_dir(root, new) == -1)
goto fail;
} else {
if (g_unlink(new) == -1)
goto fail;
}
g_free(new);
new = NULL;
}
res = g_rmdir(path);
fail:
g_free(new);
g_dir_close(dir);
return res;
}
/**
* e_shell_attempt_upgrade:
* @shell:
*
* Upgrade config and components from the currently installed version.
*
* Return value: %TRUE If it works. If it fails the application will exit.
**/
gboolean
e_shell_attempt_upgrade (EShell *shell)
{
GConfClient *gconf_client;
int major = 0, minor = 0, revision = 0;
int lmajor, lminor, lrevision;
int cmajor, cminor, crevision;
char *version_string, *last_version = NULL;
int done_upgrade = FALSE;
char *oldpath;
struct stat st;
ESEvent *ese;
gconf_client = gconf_client_get_default();
oldpath = g_build_filename(g_get_home_dir(), "evolution", NULL);
g_return_val_if_fail (sscanf(BASE_VERSION, "%u.%u", &cmajor, &cminor) == 2, TRUE);
crevision = atoi(UPGRADE_REVISION);
detect_version (gconf_client, &major, &minor, &revision);
if (!(cmajor > major
|| (cmajor == major && cminor > minor)
|| (cminor == minor && crevision > revision)))
goto check_old;
/* if upgrading from < 1.5, we need to copy most data from ~/evolution to ~/.evolution */
if (major == 1 && minor < 5) {
long size, space;
size = e_fsutils_usage(oldpath);
space = e_fsutils_avail(g_get_home_dir());
if (size != -1 && space != -1 && space < size) {
char *required = g_strdup_printf(_("%ld KB"), size);
char *have = g_strdup_printf(_("%ld KB"), space);
e_error_run(NULL, "shell:upgrade-nospace", required, have, NULL);
g_free(required);
g_free(have);
_exit(0);
}
}
if (!attempt_upgrade (shell, major, minor, revision))
_exit(0);
/* mark as upgraded */
version_string = g_strdup_printf ("%s.%s", BASE_VERSION, UPGRADE_REVISION);
gconf_client_set_string (gconf_client, "/apps/evolution/version", version_string, NULL);
done_upgrade = TRUE;
check_old:
/* if the last upgraded version was old, check for stuff to remove */
if (done_upgrade
|| (last_version = gconf_client_get_string (gconf_client, "/apps/evolution/last_version", NULL)) == NULL
|| sscanf(last_version, "%d.%d.%d", &lmajor, &lminor, &lrevision) != 3) {
lmajor = major;
lminor = minor;
lrevision = revision;
}
g_free(last_version);
if (lmajor == 1 && lminor < 5
&& g_stat(oldpath, &st) == 0
&& S_ISDIR(st.st_mode)) {
int res;
last_version = g_strdup_printf("%d.%d.%d", lmajor, lminor, lrevision);
res = e_error_run(NULL, "shell:upgrade-remove-1-4", last_version, NULL);
g_free(last_version);
switch (res) {
case GTK_RESPONSE_OK: /* 'delete' */
if (e_error_run(NULL, "shell:upgrade-remove-1-4-confirm", NULL) == GTK_RESPONSE_OK)
remove_dir(oldpath, oldpath);
else
break;
/* falls through */
case GTK_RESPONSE_ACCEPT: /* 'keep' */
lmajor = cmajor;
lminor = cminor;
lrevision = crevision;
break;
default:
/* cancel - noop */
break;
}
} else {
/* otherwise 'last version' is now the same as current */
lmajor = cmajor;
lminor = cminor;
lrevision = crevision;
}
last_version = g_strdup_printf("%d.%d.%d", lmajor, lminor, lrevision);
gconf_client_set_string (gconf_client, "/apps/evolution/last_version", last_version, NULL);
g_free(last_version);
g_free(oldpath);
g_object_unref (gconf_client);
/** @Event: Shell attempted upgrade
* @Id: upgrade.done
* @Target: ESMenuTargetState
*
* This event is emitted whenever the shell successfully attempts an upgrade.
*
*/
ese = es_event_peek();
e_event_emit((EEvent *)ese, "upgrade.done", (EEventTarget *)es_event_target_new_upgrade(ese, cmajor, cminor, crevision));
return TRUE;
}
/**
* e_shell_create_window:
* @shell: The shell for which to create a new window.
* @component_id: Id or alias of the component to display in the new window.
* @template_window: Window from which to copy the window settings (can be %NULL).
*
* Create a new window for @uri.
*
* Return value: The new window.
**/
EShellWindow *
e_shell_create_window (EShell *shell,
const char *component_id,
EShellWindow *template_window)
{
EShellWindow *window;
/* FIXME need to actually copy settings from template_window. */
g_return_val_if_fail (shell != NULL, NULL);
g_return_val_if_fail (E_IS_SHELL (shell), NULL);
window = E_SHELL_WINDOW (e_shell_window_new (shell, component_id));
g_signal_connect (window, "delete_event", G_CALLBACK (window_delete_event_cb), shell);
g_object_weak_ref (G_OBJECT (window), window_weak_notify, shell);
shell->priv->windows = g_list_prepend (shell->priv->windows, window);
g_signal_emit (shell, signals[NEW_WINDOW_CREATED], 0, window);
gtk_widget_show (GTK_WIDGET (window));
e_error_default_parent((GtkWindow *)window);
set_interactive (shell, TRUE);
if (!session_started) {
ESEvent *ese;
session_started = TRUE;
ese = es_event_peek();
e_event_emit((EEvent *)ese, "started.done", (EEventTarget *)es_event_target_new_shell(ese, shell));
}
return window;
}
gboolean
e_shell_request_close_window (EShell *shell,
EShellWindow *shell_window)
{
g_return_val_if_fail (E_IS_SHELL (shell), FALSE);
g_return_val_if_fail (E_IS_SHELL_WINDOW (shell_window), FALSE);
e_shell_save_settings (shell);
if (g_list_length (shell->priv->windows) != 1) {
/* Not the last window. */
return TRUE;
}
return e_shell_quit(shell);
}
#if 0 /* FIXME */
/**
* e_shell_peek_uri_schema_registry:
* @shell: An EShell object.
*
* Get the schema registry associated to @shell.
*
* Return value: A pointer to the EUriSchemaRegistry associated to @shell.
**/
EUriSchemaRegistry *
e_shell_peek_uri_schema_registry (EShell *shell)
{
g_return_val_if_fail (E_IS_SHELL (shell), NULL);
return shell->priv->uri_schema_registry;
}
#endif
/**
* e_shell_peek_component_registry:
* @shell:
*
* Get the component registry associated to @shell.
*
* Return value:
**/
EComponentRegistry *
e_shell_peek_component_registry (EShell *shell)
{
g_return_val_if_fail (E_IS_SHELL (shell), NULL);
return shell->priv->component_registry;
}
/**
* e_shell_save_settings:
* @shell:
*
* Save the settings for this shell.
*
* Return value: %TRUE if it worked, %FALSE otherwise. Even if %FALSE is
* returned, it is possible that at least part of the settings for the windows
* have been saved.
**/
gboolean
e_shell_save_settings (EShell *shell)
{
GConfClient *client;
gboolean is_offline;
is_offline = ( e_shell_get_line_status (shell) == E_SHELL_LINE_STATUS_OFFLINE || e_shell_get_line_status (shell) == E_SHELL_LINE_STATUS_FORCED_OFFLINE);
client = gconf_client_get_default ();
gconf_client_set_bool (client, "/apps/evolution/shell/start_offline", is_offline, NULL);
g_object_unref (client);
return TRUE;
}
/**
* e_shell_close_all_windows:
* @shell:
*
* Destroy all the windows in @shell.
**/
void
e_shell_close_all_windows (EShell *shell)
{
EShellPrivate *priv;
GList *p, *pnext;
g_return_if_fail (shell != NULL);
g_return_if_fail (E_IS_SHELL (shell));
if (shell->priv->windows)
e_shell_save_settings (shell);
priv = shell->priv;
for (p = priv->windows; p != NULL; p = pnext) {
pnext = p->next;
/* Note that this will also remove the window from the list... Hence the
need for the pnext variable. */
gtk_widget_destroy (GTK_WIDGET (p->data));
}
}
/**
* e_shell_get_line_status:
* @shell: A pointer to an EShell object.
*
* Get the line status for @shell.
*
* Return value: The current line status for @shell.
**/
EShellLineStatus
e_shell_get_line_status (EShell *shell)
{
g_return_val_if_fail (shell != NULL, E_SHELL_LINE_STATUS_OFFLINE);
g_return_val_if_fail (E_IS_SHELL (shell), E_SHELL_LINE_STATUS_OFFLINE);
return shell->priv->line_status;
}
/* Offline/online handling. */
static void
set_line_status_finished(EShell *shell)
{
EShellPrivate *priv = shell->priv;
ESEvent *ese;
priv->line_status = priv->line_status_working;
e_passwords_set_online (priv->line_status == E_SHELL_LINE_STATUS_ONLINE);
g_signal_emit (shell, signals[LINE_STATUS_CHANGED], 0, priv->line_status);
/** @Event: Shell online state changed
* @Id: state.changed
* @Target: ESMenuTargetState
*
* This event is emitted whenever the shell online state changes.
*
* Only the online and offline states are emitted.
*/
ese = es_event_peek();
e_event_emit((EEvent *)ese, "state.changed", (EEventTarget *)es_event_target_new_state(ese, priv->line_status == E_SHELL_LINE_STATUS_ONLINE));
}
static void
set_line_status_complete(EvolutionListener *el, void *data)
{
EShell *shell = data;
EShellPrivate *priv = shell->priv;
if (priv->line_status_pending > 0) {
priv->line_status_pending--;
if (priv->line_status_pending == 0)
set_line_status_finished(shell);
}
}
static void
set_line_status(EShell *shell, GNOME_Evolution_ShellState shell_state)
{
EShellPrivate *priv;
GSList *component_infos;
GSList *p;
CORBA_Environment ev;
GConfClient *client;
gboolean status;
gboolean forced = FALSE;
priv = shell->priv;
if (shell_state == GNOME_Evolution_FORCED_OFFLINE || shell_state == GNOME_Evolution_USER_OFFLINE) {
status = FALSE;
if (shell_state == GNOME_Evolution_FORCED_OFFLINE)
forced = TRUE;
} else
status = TRUE;
if ((status && priv->line_status == E_SHELL_LINE_STATUS_ONLINE)
|| (!status && priv->line_status == E_SHELL_LINE_STATUS_OFFLINE && !forced))
return;
/* we use 'going offline' to mean 'changing status' now */
priv->line_status = E_SHELL_LINE_STATUS_GOING_OFFLINE;
g_signal_emit (shell, signals[LINE_STATUS_CHANGED], 0, priv->line_status);
client = gconf_client_get_default ();
gconf_client_set_bool (client, "/apps/evolution/shell/start_offline", !status, NULL);
g_object_unref (client);
priv->line_status_working = status?E_SHELL_LINE_STATUS_ONLINE: forced?E_SHELL_LINE_STATUS_FORCED_OFFLINE:E_SHELL_LINE_STATUS_OFFLINE;
/* we start at 2: setLineStatus could recursively call back, we therefore
`need to not complete till we're really complete */
priv->line_status_pending += 2;
component_infos = e_component_registry_peek_list (priv->component_registry);
for (p = component_infos; p != NULL; p = p->next) {
EComponentInfo *info = p->data;
CORBA_exception_init (&ev);
GNOME_Evolution_Component_setLineStatus(info->iface, shell_state, bonobo_object_corba_objref((BonoboObject *)priv->line_status_listener), &ev);
if (ev._major == CORBA_NO_EXCEPTION)
priv->line_status_pending++;
CORBA_exception_free (&ev);
}
priv->line_status_pending -= 2;
if (priv->line_status_pending == 0)
set_line_status_finished(shell);
}
/**
* e_shell_go_offline:
* @shell:
* @action_window: Obsolete/unused.
*
* Make the shell go into off-line mode.
**/
void
e_shell_go_offline (EShell *shell,
EShellWindow *action_window, GNOME_Evolution_ShellState shell_state)
{
g_return_if_fail (shell != NULL);
g_return_if_fail (E_IS_SHELL (shell));
g_return_if_fail (action_window != NULL);
g_return_if_fail (action_window == NULL || E_IS_SHELL_WINDOW (action_window));
set_line_status(shell, shell_state);
}
/**
* e_shell_go_online:
* @shell:
* @action_window: Obsolete/unused.
*
* Make the shell go into on-line mode.
**/
void
e_shell_go_online (EShell *shell,
EShellWindow *action_window, GNOME_Evolution_ShellState shell_state)
{
g_return_if_fail (shell != NULL);
g_return_if_fail (E_IS_SHELL (shell));
g_return_if_fail (action_window == NULL || E_IS_SHELL_WINDOW (action_window));
set_line_status(shell, shell_state);
}
void
e_shell_send_receive (EShell *shell)
{
GSList *component_list;
GSList *p;
g_return_if_fail (E_IS_SHELL (shell));
component_list = e_component_registry_peek_list (shell->priv->component_registry);
for (p = component_list; p != NULL; p = p->next) {
EComponentInfo *info = p->data;
CORBA_Environment ev;
CORBA_exception_init (&ev);
GNOME_Evolution_Component_sendAndReceive (info->iface, &ev);
/* Ignore errors, the components can decide to not implement
this interface. */
CORBA_exception_free (&ev);
}
}
void
e_shell_show_settings (EShell *shell,
const char *type,
EShellWindow *shell_window)
{
EShellPrivate *priv;
g_return_if_fail (shell != NULL);
g_return_if_fail (E_IS_SHELL (shell));
priv = shell->priv;
if (priv->settings_dialog.widget != NULL) {
gdk_window_show (priv->settings_dialog.widget->window);
gtk_widget_grab_focus (priv->settings_dialog.widget);
return;
}
priv->settings_dialog.widget = e_shell_settings_dialog_new ();
if (type != NULL)
e_shell_settings_dialog_show_type (E_SHELL_SETTINGS_DIALOG (priv->settings_dialog.widget), type);
g_object_add_weak_pointer (G_OBJECT (priv->settings_dialog.widget), &priv->settings_dialog.pointer);
gtk_window_set_transient_for (GTK_WINDOW (priv->settings_dialog.widget), GTK_WINDOW (shell_window));
gtk_widget_show (priv->settings_dialog.widget);
}
const char *
e_shell_construct_result_to_string (EShellConstructResult result)
{
switch (result) {
case E_SHELL_CONSTRUCT_RESULT_OK:
return _("OK");
case E_SHELL_CONSTRUCT_RESULT_INVALIDARG:
return _("Invalid arguments");
case E_SHELL_CONSTRUCT_RESULT_CANNOTREGISTER:
return _("Cannot register on OAF");
case E_SHELL_CONSTRUCT_RESULT_NOCONFIGDB:
return _("Configuration Database not found");
case E_SHELL_CONSTRUCT_RESULT_GENERICERROR:
return _("Generic error");
default:
return _("Unknown error");
}
}
/* timeout handler, so returns TRUE if we can't quit yet */
static gboolean
es_run_quit(EShell *shell)
{
EShellPrivate *priv;
GSList *component_infos;
GSList *sp;
CORBA_boolean done_quit;
g_return_val_if_fail (E_IS_SHELL (shell), FALSE);
priv = shell->priv;
priv->preparing_to_quit = TRUE;
component_infos = e_component_registry_peek_list (priv->component_registry);
done_quit = TRUE;
for (sp = component_infos; sp != NULL; sp = sp->next) {
EComponentInfo *info = sp->data;
CORBA_Environment ev;
CORBA_exception_init (&ev);
done_quit = GNOME_Evolution_Component_quit(info->iface, &ev);
if (BONOBO_EX (&ev)) {
/* The component might not implement the interface, in which case we assume we can quit. */
done_quit = TRUE;
}
CORBA_exception_free (&ev);
if (!done_quit)
break;
}
if (done_quit) {
if (priv->quit_timeout) {
g_source_remove(priv->quit_timeout);
priv->quit_timeout = 0;
}
e_shell_close_all_windows(shell);
} else if (priv->quit_timeout == 0) {
priv->quit_timeout = g_timeout_add(500, (GSourceFunc)es_run_quit, shell);
}
return !done_quit;
}
gboolean
e_shell_can_quit (EShell *shell)
{
EShellPrivate *priv;
GSList *component_infos;
GSList *sp;
CORBA_boolean can_quit;
g_return_val_if_fail (E_IS_SHELL (shell), FALSE);
priv = shell->priv;
if (priv->preparing_to_quit)
return FALSE;
component_infos = e_component_registry_peek_list (priv->component_registry);
can_quit = TRUE;
for (sp = component_infos; sp != NULL; sp = sp->next) {
EComponentInfo *info = sp->data;
CORBA_Environment ev;
CORBA_exception_init (&ev);
can_quit = GNOME_Evolution_Component_requestQuit (info->iface, &ev);
if (BONOBO_EX (&ev)) {
/* The component might not implement the interface, in which case we assume we can quit. */
can_quit = TRUE;
}
CORBA_exception_free (&ev);
if (! can_quit)
break;
}
return can_quit;
}
gboolean
e_shell_do_quit (EShell *shell)
{
EShellPrivate *priv;
GList *p;
gboolean can_quit;
g_return_val_if_fail (E_IS_SHELL (shell), FALSE);
priv = shell->priv;
if (priv->preparing_to_quit)
return FALSE;
for (p = shell->priv->windows; p != NULL; p = p->next) {
gtk_widget_set_sensitive (GTK_WIDGET (p->data), FALSE);
if (p == shell->priv->windows)
e_shell_window_save_defaults (p->data);
}
can_quit = !es_run_quit (shell);
/* Mark a safe quit by destroying the lock. */
e_file_lock_destroy ();
return can_quit;
}
gboolean
e_shell_quit (EShell *shell)
{
return e_shell_can_quit (shell) && e_shell_do_quit (shell);
}
/**
* gboolean (*EMainShellFunc) (EShell *shell, EShellWindow *window, gpointer user_data);
* Function used in @ref e_shell_foreach_shell_window.
* @param shell Pointer to EShell.
* @param window Pointer to EShellWindow.
* @param user_data User's data passed to @ref main_shell_foreach_shell_window.
* @return TRUE if need to go to next window, FALSE when stop looking for next window.
**/
/**
* e_shell_foreach_shell_window
* This will call function callback for all known EShellWindow of main shell.
* When there is no shell active, then this will do nothing.
* @param shell EShell instance.
* @param func Function to be called.
* @param user_data User data to pass to func.
**/
void
e_shell_foreach_shell_window (EShell *shell, EMainShellFunc func, gpointer user_data)
{
EShellPrivate *priv;
GList *p;
if (!shell)
return;
priv = shell->priv;
for (p = priv->windows; p != NULL; p = p->next) {
EShellWindow *window;
window = E_SHELL_WINDOW (p->data);
if (window && !func (shell, window, user_data))
break;
}
}
BONOBO_TYPE_FUNC_FULL (EShell, GNOME_Evolution_Shell, PARENT_TYPE, e_shell)
|