annotate src/gtkmain.c @ 13833:571aebbe5ec6

[gaim-migrate @ 16282] SF Patch #1502594 from Yosef Radchenko "Patches three instances of memory leaks with gaim_accounts_get_all_active" committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Mon, 19 Jun 2006 05:39:30 +0000
parents 0cc7773b1d87
children dabbcb9b013d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1 /*
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
2 * gaim
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
3 *
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
4 * Gaim is the legal property of its developers, whose names are too numerous
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
5 * to list here. Please refer to the COPYRIGHT file distributed with this
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
6 * source distribution.
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
7 *
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or modify
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
11 * (at your option) any later version.
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
12 *
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful,
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
16 * GNU General Public License for more details.
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
17 *
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
19 * along with this program; if not, write to the Free Software
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
21 *
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
22 */
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
23
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
24 #include "internal.h"
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
25 #include "gtkgaim.h"
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
26
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
27 #include "account.h"
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
28 #include "conversation.h"
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
29 #include "core.h"
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
30 #include "debug.h"
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
31 #include "eventloop.h"
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
32 #include "ft.h"
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
33 #include "log.h"
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
34 #include "notify.h"
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
35 #include "prefs.h"
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
36 #include "prpl.h"
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
37 #include "pounce.h"
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
38 #include "sound.h"
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
39 #include "status.h"
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
40 #include "util.h"
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents: 11403
diff changeset
41 #include "whiteboard.h"
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
42
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
43 #include "gtkaccount.h"
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
44 #include "gtkblist.h"
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
45 #include "gtkconn.h"
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
46 #include "gtkconv.h"
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
47 #include "gtkdebug.h"
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
48 #include "gtkdialogs.h"
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
49 #include "gtkeventloop.h"
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
50 #include "gtkft.h"
11907
d2db6426c88a [gaim-migrate @ 14198]
Mark Doliner <mark@kingant.net>
parents: 11906
diff changeset
51 #include "gtkidle.h"
12838
cb36bc2db7c5 [gaim-migrate @ 15186]
Richard Laager <rlaager@wiktel.com>
parents: 12670
diff changeset
52 #include "gtklog.h"
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
53 #include "gtknotify.h"
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
54 #include "gtkplugin.h"
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
55 #include "gtkpounce.h"
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
56 #include "gtkprefs.h"
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
57 #include "gtkprivacy.h"
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
58 #include "gtkrequest.h"
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
59 #include "gtkroomlist.h"
10574
77ef3f2f0df8 [gaim-migrate @ 11966]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10448
diff changeset
60 #include "gtksavedstatuses.h"
12246
b7a51e68d0b8 [gaim-migrate @ 14548]
Mark Doliner <mark@kingant.net>
parents: 12202
diff changeset
61 #include "gtksession.h"
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
62 #include "gtksound.h"
11525
b47708f46a38 [gaim-migrate @ 13773]
Tim Ringenbach <marv@pidgin.im>
parents: 11520
diff changeset
63 #include "gtkthemes.h"
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
64 #include "gtkutils.h"
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
65 #include "gtkstock.h"
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents: 11403
diff changeset
66 #include "gtkwhiteboard.h"
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
67
13427
e3717f0d24ad [gaim-migrate @ 15802]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13321
diff changeset
68 #ifdef HAVE_SIGNAL_H
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
69 # include <signal.h>
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
70 #endif
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
71
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
72 #include <getopt.h>
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
73
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
74 #ifdef HAVE_STARTUP_NOTIFICATION
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
75 # define SN_API_NOT_YET_FROZEN
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
76 # include <libsn/sn-launchee.h>
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
77 # include <gdk/gdkx.h>
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
78 #endif
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
79
12572
bf01b160ab0d [gaim-migrate @ 14891]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12562
diff changeset
80 #ifdef _WIN32
bf01b160ab0d [gaim-migrate @ 14891]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12562
diff changeset
81 # include "wspell.h"
bf01b160ab0d [gaim-migrate @ 14891]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12562
diff changeset
82 #endif
bf01b160ab0d [gaim-migrate @ 14891]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12562
diff changeset
83
11055
df0241eb602c [gaim-migrate @ 12996]
Piotr Zielinski <zielaj>
parents: 11033
diff changeset
84
df0241eb602c [gaim-migrate @ 12996]
Piotr Zielinski <zielaj>
parents: 11033
diff changeset
85
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
86 #ifdef HAVE_STARTUP_NOTIFICATION
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
87 static SnLauncheeContext *sn_context = NULL;
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
88 static SnDisplay *sn_display = NULL;
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
89 #endif
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
90
13427
e3717f0d24ad [gaim-migrate @ 15802]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13321
diff changeset
91 #ifdef HAVE_SIGNAL_H
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
92 /*
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
93 * Lists of signals we wish to catch and those we wish to ignore.
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
94 * Each list terminated with -1
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
95 */
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
96 static int catch_sig_list[] = {
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
97 SIGSEGV,
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
98 SIGHUP,
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
99 SIGINT,
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
100 SIGTERM,
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
101 SIGQUIT,
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
102 SIGCHLD,
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
103 -1
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
104 };
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
105
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
106 static int ignore_sig_list[] = {
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
107 SIGPIPE,
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
108 -1
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
109 };
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
110 #endif
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
111
10323
bb2514e075db [gaim-migrate @ 11530]
Mark Doliner <mark@kingant.net>
parents: 10322
diff changeset
112 static int
bb2514e075db [gaim-migrate @ 11530]
Mark Doliner <mark@kingant.net>
parents: 10322
diff changeset
113 dologin_named(const char *name)
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
114 {
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
115 GaimAccount *account;
10323
bb2514e075db [gaim-migrate @ 11530]
Mark Doliner <mark@kingant.net>
parents: 10322
diff changeset
116 char **names;
bb2514e075db [gaim-migrate @ 11530]
Mark Doliner <mark@kingant.net>
parents: 10322
diff changeset
117 int i;
bb2514e075db [gaim-migrate @ 11530]
Mark Doliner <mark@kingant.net>
parents: 10322
diff changeset
118 int ret = -1;
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
119
10323
bb2514e075db [gaim-migrate @ 11530]
Mark Doliner <mark@kingant.net>
parents: 10322
diff changeset
120 if (name != NULL) { /* list of names given */
bb2514e075db [gaim-migrate @ 11530]
Mark Doliner <mark@kingant.net>
parents: 10322
diff changeset
121 names = g_strsplit(name, ",", 64);
bb2514e075db [gaim-migrate @ 11530]
Mark Doliner <mark@kingant.net>
parents: 10322
diff changeset
122 for (i = 0; names[i] != NULL; i++) {
bb2514e075db [gaim-migrate @ 11530]
Mark Doliner <mark@kingant.net>
parents: 10322
diff changeset
123 account = gaim_accounts_find(names[i], NULL);
bb2514e075db [gaim-migrate @ 11530]
Mark Doliner <mark@kingant.net>
parents: 10322
diff changeset
124 if (account != NULL) { /* found a user */
bb2514e075db [gaim-migrate @ 11530]
Mark Doliner <mark@kingant.net>
parents: 10322
diff changeset
125 ret = 0;
10738
55af3fa46329 [gaim-migrate @ 12340]
Mark Doliner <mark@kingant.net>
parents: 10638
diff changeset
126 gaim_account_connect(account);
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
127 }
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
128 }
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
129 g_strfreev(names);
10323
bb2514e075db [gaim-migrate @ 11530]
Mark Doliner <mark@kingant.net>
parents: 10322
diff changeset
130 } else { /* no name given, use the first account */
11520
2fdd2bd7755a [gaim-migrate @ 13765]
Mark Doliner <mark@kingant.net>
parents: 11475
diff changeset
131 GList *accounts;
2fdd2bd7755a [gaim-migrate @ 13765]
Mark Doliner <mark@kingant.net>
parents: 11475
diff changeset
132
2fdd2bd7755a [gaim-migrate @ 13765]
Mark Doliner <mark@kingant.net>
parents: 11475
diff changeset
133 accounts = gaim_accounts_get_all();
2fdd2bd7755a [gaim-migrate @ 13765]
Mark Doliner <mark@kingant.net>
parents: 11475
diff changeset
134 if (accounts != NULL)
2fdd2bd7755a [gaim-migrate @ 13765]
Mark Doliner <mark@kingant.net>
parents: 11475
diff changeset
135 {
2fdd2bd7755a [gaim-migrate @ 13765]
Mark Doliner <mark@kingant.net>
parents: 11475
diff changeset
136 account = (GaimAccount *)accounts->data;
2fdd2bd7755a [gaim-migrate @ 13765]
Mark Doliner <mark@kingant.net>
parents: 11475
diff changeset
137 ret = 0;
2fdd2bd7755a [gaim-migrate @ 13765]
Mark Doliner <mark@kingant.net>
parents: 11475
diff changeset
138 gaim_account_connect(account);
2fdd2bd7755a [gaim-migrate @ 13765]
Mark Doliner <mark@kingant.net>
parents: 11475
diff changeset
139 }
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
140 }
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
141
10323
bb2514e075db [gaim-migrate @ 11530]
Mark Doliner <mark@kingant.net>
parents: 10322
diff changeset
142 return ret;
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
143 }
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
144
13427
e3717f0d24ad [gaim-migrate @ 15802]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13321
diff changeset
145 #ifdef HAVE_SIGNAL_H
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
146 static void
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
147 clean_pid(void)
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
148 {
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
149 int status;
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
150 pid_t pid;
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
151
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
152 do {
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
153 pid = waitpid(-1, &status, WNOHANG);
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
154 } while (pid != 0 && pid != (pid_t)-1);
10334
5aa8ed1ec91e [gaim-migrate @ 11541]
Mark Doliner <mark@kingant.net>
parents: 10333
diff changeset
155
5aa8ed1ec91e [gaim-migrate @ 11541]
Mark Doliner <mark@kingant.net>
parents: 10333
diff changeset
156 if ((pid == (pid_t) - 1) && (errno != ECHILD)) {
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
157 char errmsg[BUFSIZ];
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
158 snprintf(errmsg, BUFSIZ, "Warning: waitpid() returned %d", pid);
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
159 perror(errmsg);
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
160 }
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
161 }
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
162
12556
14e094d7568f [gaim-migrate @ 14875]
Richard Laager <rlaager@wiktel.com>
parents: 12409
diff changeset
163 char *segfault_message;
14e094d7568f [gaim-migrate @ 14875]
Richard Laager <rlaager@wiktel.com>
parents: 12409
diff changeset
164
10871
6240d7fd5b2c [gaim-migrate @ 12558]
Mark Doliner <mark@kingant.net>
parents: 10819
diff changeset
165 static void
10323
bb2514e075db [gaim-migrate @ 11530]
Mark Doliner <mark@kingant.net>
parents: 10322
diff changeset
166 sighandler(int sig)
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
167 {
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
168 switch (sig) {
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
169 case SIGHUP:
10323
bb2514e075db [gaim-migrate @ 11530]
Mark Doliner <mark@kingant.net>
parents: 10322
diff changeset
170 gaim_debug_warning("sighandler", "Caught signal %d\n", sig);
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
171 gaim_connections_disconnect_all();
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
172 break;
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
173 case SIGSEGV:
13214
812e2de69c90 [gaim-migrate @ 15578]
Richard Laager <rlaager@wiktel.com>
parents: 13110
diff changeset
174 fprintf(stderr, "%s", segfault_message);
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
175 abort();
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
176 break;
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
177 case SIGCHLD:
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
178 clean_pid();
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
179 signal(SIGCHLD, sighandler); /* restore signal catching on this one! */
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
180 break;
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
181 default:
10323
bb2514e075db [gaim-migrate @ 11530]
Mark Doliner <mark@kingant.net>
parents: 10322
diff changeset
182 gaim_debug_warning("sighandler", "Caught signal %d\n", sig);
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
183 gaim_connections_disconnect_all();
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
184
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
185 gaim_plugins_unload_all();
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
186
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
187 if (gtk_main_level())
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
188 gtk_main_quit();
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
189 exit(0);
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
190 }
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
191 }
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
192 #endif
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
193
10323
bb2514e075db [gaim-migrate @ 11530]
Mark Doliner <mark@kingant.net>
parents: 10322
diff changeset
194 static int
bb2514e075db [gaim-migrate @ 11530]
Mark Doliner <mark@kingant.net>
parents: 10322
diff changeset
195 ui_main()
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
196 {
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
197 #ifndef _WIN32
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
198 GList *icons = NULL;
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
199 GdkPixbuf *icon = NULL;
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
200 char *icon_path;
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
201 #endif
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
202
11525
b47708f46a38 [gaim-migrate @ 13773]
Tim Ringenbach <marv@pidgin.im>
parents: 11520
diff changeset
203 gaim_gtkthemes_init();
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
204
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
205 gaim_gtk_blist_setup_sort_methods();
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
206
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
207 #ifndef _WIN32
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
208 /* use the nice PNG icon for all the windows */
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
209 icon_path = g_build_filename(DATADIR, "pixmaps", "gaim", "icons", "online.png", NULL);
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
210 icon = gdk_pixbuf_new_from_file(icon_path, NULL);
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
211 g_free(icon_path);
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
212 if (icon) {
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
213 icons = g_list_append(icons,icon);
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
214 gtk_window_set_default_icon_list(icons);
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
215 g_object_unref(G_OBJECT(icon));
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
216 g_list_free(icons);
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
217 } else {
10323
bb2514e075db [gaim-migrate @ 11530]
Mark Doliner <mark@kingant.net>
parents: 10322
diff changeset
218 gaim_debug_error("ui_main",
bb2514e075db [gaim-migrate @ 11530]
Mark Doliner <mark@kingant.net>
parents: 10322
diff changeset
219 "Failed to load the default window icon!\n");
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
220 }
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
221 #endif
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
222
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
223 return 0;
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
224 }
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
225
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
226 static void
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
227 debug_init(void)
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
228 {
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
229 gaim_debug_set_ui_ops(gaim_gtk_debug_get_ui_ops());
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
230 gaim_gtk_debug_init();
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
231 }
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
232
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
233 static void
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
234 gaim_gtk_ui_init(void)
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
235 {
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
236 /* Set the UI operation structures. */
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
237 gaim_accounts_set_ui_ops(gaim_gtk_accounts_get_ui_ops());
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
238 gaim_xfers_set_ui_ops(gaim_gtk_xfers_get_ui_ops());
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
239 gaim_blist_set_ui_ops(gaim_gtk_blist_get_ui_ops());
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
240 gaim_notify_set_ui_ops(gaim_gtk_notify_get_ui_ops());
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
241 gaim_privacy_set_ui_ops(gaim_gtk_privacy_get_ui_ops());
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
242 gaim_request_set_ui_ops(gaim_gtk_request_get_ui_ops());
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
243 gaim_sound_set_ui_ops(gaim_gtk_sound_get_ui_ops());
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
244 gaim_connections_set_ui_ops(gaim_gtk_connections_get_ui_ops());
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents: 11403
diff changeset
245 gaim_whiteboard_set_ui_ops(gaim_gtk_whiteboard_get_ui_ops());
12272
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents: 12246
diff changeset
246 #ifdef USE_SCREENSAVER
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents: 12246
diff changeset
247 gaim_idle_set_ui_ops(gaim_gtk_idle_get_ui_ops());
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents: 12246
diff changeset
248 #endif
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
249
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
250 gaim_gtk_stock_init();
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
251 gaim_gtk_account_init();
13014
5efbb0162f86 [gaim-migrate @ 15367]
Mark Doliner <mark@kingant.net>
parents: 12857
diff changeset
252 gaim_gtk_connection_init();
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
253 gaim_gtk_blist_init();
10574
77ef3f2f0df8 [gaim-migrate @ 11966]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10448
diff changeset
254 gaim_gtk_status_init();
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
255 gaim_gtk_conversations_init();
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
256 gaim_gtk_pounces_init();
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
257 gaim_gtk_privacy_init();
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
258 gaim_gtk_xfers_init();
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
259 gaim_gtk_roomlist_init();
12838
cb36bc2db7c5 [gaim-migrate @ 15186]
Richard Laager <rlaager@wiktel.com>
parents: 12670
diff changeset
260 gaim_gtk_log_init();
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
261 }
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
262
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
263 static void
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
264 gaim_gtk_quit(void)
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
265 {
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
266 #ifdef USE_SM
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
267 /* unplug */
12246
b7a51e68d0b8 [gaim-migrate @ 14548]
Mark Doliner <mark@kingant.net>
parents: 12202
diff changeset
268 gaim_gtk_session_end();
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
269 #endif
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
270
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
271 /* Save the plugins we have loaded for next time. */
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
272 gaim_gtk_plugins_save();
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
273
10574
77ef3f2f0df8 [gaim-migrate @ 11966]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10448
diff changeset
274 /* Uninit */
77ef3f2f0df8 [gaim-migrate @ 11966]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10448
diff changeset
275 gaim_gtk_conversations_uninit();
77ef3f2f0df8 [gaim-migrate @ 11966]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10448
diff changeset
276 gaim_gtk_status_uninit();
77ef3f2f0df8 [gaim-migrate @ 11966]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10448
diff changeset
277 gaim_gtk_blist_uninit();
13014
5efbb0162f86 [gaim-migrate @ 15367]
Mark Doliner <mark@kingant.net>
parents: 12857
diff changeset
278 gaim_gtk_connection_uninit();
10574
77ef3f2f0df8 [gaim-migrate @ 11966]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10448
diff changeset
279 gaim_gtk_account_uninit();
11010
9fe9c7e00666 [gaim-migrate @ 12871]
Mark Doliner <mark@kingant.net>
parents: 10871
diff changeset
280 gaim_gtk_xfers_uninit();
11033
50224ac8184d [gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11010
diff changeset
281 gaim_gtk_debug_uninit();
10574
77ef3f2f0df8 [gaim-migrate @ 11966]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10448
diff changeset
282
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
283 /* and end it all... */
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
284 gtk_main_quit();
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
285 }
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
286
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
287 static GaimCoreUiOps core_ops =
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
288 {
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
289 gaim_gtk_prefs_init,
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
290 debug_init,
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
291 gaim_gtk_ui_init,
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
292 gaim_gtk_quit
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
293 };
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
294
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
295 static GaimCoreUiOps *
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
296 gaim_gtk_core_get_ui_ops(void)
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
297 {
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
298 return &core_ops;
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
299 }
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
300
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
301 static void
10320
61852117568f [gaim-migrate @ 11527]
Mark Doliner <mark@kingant.net>
parents: 10317
diff changeset
302 show_usage(const char *name, gboolean terse)
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
303 {
10320
61852117568f [gaim-migrate @ 11527]
Mark Doliner <mark@kingant.net>
parents: 10317
diff changeset
304 char *text;
12846
95d350f56998 [gaim-migrate @ 15194]
Mark Doliner <mark@kingant.net>
parents: 12838
diff changeset
305
10320
61852117568f [gaim-migrate @ 11527]
Mark Doliner <mark@kingant.net>
parents: 10317
diff changeset
306 if (terse) {
61852117568f [gaim-migrate @ 11527]
Mark Doliner <mark@kingant.net>
parents: 10317
diff changeset
307 text = g_strdup_printf(_("Gaim %s. Try `%s -h' for more information.\n"), VERSION, name);
61852117568f [gaim-migrate @ 11527]
Mark Doliner <mark@kingant.net>
parents: 10317
diff changeset
308 } else {
61852117568f [gaim-migrate @ 11527]
Mark Doliner <mark@kingant.net>
parents: 10317
diff changeset
309 text = g_strdup_printf(_("Gaim %s\n"
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
310 "Usage: %s [OPTION]...\n\n"
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
311 " -c, --config=DIR use DIR for config files\n"
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
312 " -d, --debug print debugging messages to stdout\n"
10320
61852117568f [gaim-migrate @ 11527]
Mark Doliner <mark@kingant.net>
parents: 10317
diff changeset
313 " -h, --help display this help and exit\n"
10323
bb2514e075db [gaim-migrate @ 11530]
Mark Doliner <mark@kingant.net>
parents: 10322
diff changeset
314 " -n, --nologin don't automatically login\n"
10320
61852117568f [gaim-migrate @ 11527]
Mark Doliner <mark@kingant.net>
parents: 10317
diff changeset
315 " -l, --login[=NAME] automatically login (optional argument NAME specifies\n"
11673
922d0483ca88 [gaim-migrate @ 13959]
Richard Laager <rlaager@wiktel.com>
parents: 11581
diff changeset
316 " account(s) to use, separated by commas)\n"
10323
bb2514e075db [gaim-migrate @ 11530]
Mark Doliner <mark@kingant.net>
parents: 10322
diff changeset
317 " -v, --version display the current version and exit\n"), VERSION, name);
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
318 }
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
319
13089
b553326bc468 [gaim-migrate @ 15451]
Mark Doliner <mark@kingant.net>
parents: 13024
diff changeset
320 gaim_print_utf8_to_console(stdout, text);
10320
61852117568f [gaim-migrate @ 11527]
Mark Doliner <mark@kingant.net>
parents: 10317
diff changeset
321 g_free(text);
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
322 }
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
323
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
324 #ifdef HAVE_STARTUP_NOTIFICATION
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
325 static void
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
326 sn_error_trap_push(SnDisplay *display, Display *xdisplay)
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
327 {
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
328 gdk_error_trap_push();
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
329 }
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
330
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
331 static void
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
332 sn_error_trap_pop(SnDisplay *display, Display *xdisplay)
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
333 {
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
334 gdk_error_trap_pop();
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
335 }
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
336
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
337 static void
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
338 startup_notification_complete(void)
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
339 {
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
340 Display *xdisplay;
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
341
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
342 xdisplay = GDK_DISPLAY();
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
343 sn_display = sn_display_new(xdisplay,
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
344 sn_error_trap_push,
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
345 sn_error_trap_pop);
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
346 sn_context =
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
347 sn_launchee_context_new_from_environment(sn_display,
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
348 DefaultScreen(xdisplay));
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
349
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
350 if (sn_context != NULL)
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
351 {
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
352 sn_launchee_context_complete(sn_context);
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
353 sn_launchee_context_unref(sn_context);
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
354
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
355 sn_display_unref(sn_display);
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
356 }
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
357 }
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
358 #endif /* HAVE_STARTUP_NOTIFICATION */
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
359
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
360 #ifndef _WIN32
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
361 static char *gaim_find_binary_location(void *symbol, void *data)
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
362 {
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
363 static char *fullname = NULL;
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
364 static gboolean first = TRUE;
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
365
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
366 char *argv0 = data;
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
367 struct stat st;
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
368 char *basebuf, *linkbuf, *fullbuf;
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
369
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
370 if (!first)
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
371 /* We've already been through this. */
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
372 return strdup(fullname);
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
373
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
374 first = FALSE;
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
375
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
376 if (!argv0)
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
377 return NULL;
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
378
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
379
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
380 basebuf = g_find_program_in_path(argv0);
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
381
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
382 /* But we still need to deal with symbolic links */
10589
0f7452b1f777 [gaim-migrate @ 11994]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10581
diff changeset
383 g_lstat(basebuf, &st);
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
384 while ((st.st_mode & S_IFLNK) == S_IFLNK) {
13105
e347b2217b1b [gaim-migrate @ 15467]
Richard Laager <rlaager@wiktel.com>
parents: 13093
diff changeset
385 int written;
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
386 linkbuf = g_malloc(1024);
13105
e347b2217b1b [gaim-migrate @ 15467]
Richard Laager <rlaager@wiktel.com>
parents: 13093
diff changeset
387 written = readlink(basebuf, linkbuf, 1024 - 1);
e347b2217b1b [gaim-migrate @ 15467]
Richard Laager <rlaager@wiktel.com>
parents: 13093
diff changeset
388 if (written == -1)
e347b2217b1b [gaim-migrate @ 15467]
Richard Laager <rlaager@wiktel.com>
parents: 13093
diff changeset
389 {
e347b2217b1b [gaim-migrate @ 15467]
Richard Laager <rlaager@wiktel.com>
parents: 13093
diff changeset
390 /* This really shouldn't happen, but do we
e347b2217b1b [gaim-migrate @ 15467]
Richard Laager <rlaager@wiktel.com>
parents: 13093
diff changeset
391 * need something better here? */
e347b2217b1b [gaim-migrate @ 15467]
Richard Laager <rlaager@wiktel.com>
parents: 13093
diff changeset
392 g_free(linkbuf);
e347b2217b1b [gaim-migrate @ 15467]
Richard Laager <rlaager@wiktel.com>
parents: 13093
diff changeset
393 continue;
e347b2217b1b [gaim-migrate @ 15467]
Richard Laager <rlaager@wiktel.com>
parents: 13093
diff changeset
394 }
e347b2217b1b [gaim-migrate @ 15467]
Richard Laager <rlaager@wiktel.com>
parents: 13093
diff changeset
395 linkbuf[written] = '\0';
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
396 if (linkbuf[0] == G_DIR_SEPARATOR) {
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
397 /* an absolute path */
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
398 fullbuf = g_strdup(linkbuf);
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
399 } else {
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
400 char *dirbuf = g_path_get_dirname(basebuf);
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
401 /* a relative path */
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
402 fullbuf = g_strdup_printf("%s%s%s",
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
403 dirbuf, G_DIR_SEPARATOR_S,
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
404 linkbuf);
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
405 g_free(dirbuf);
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
406 }
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
407 /* There's no memory leak here. Really! */
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
408 g_free(linkbuf);
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
409 g_free(basebuf);
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
410 basebuf = fullbuf;
10589
0f7452b1f777 [gaim-migrate @ 11994]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10581
diff changeset
411 g_lstat(basebuf, &st);
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
412 }
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
413
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
414 fullname = basebuf;
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
415 return strdup(fullname);
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
416 }
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
417 #endif /* #ifndef _WIN32 */
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
418
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
419 /* FUCKING GET ME A TOWEL! */
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
420 #ifdef _WIN32
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
421 int gaim_main(HINSTANCE hint, int argc, char *argv[])
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
422 #else
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
423 int main(int argc, char *argv[])
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
424 #endif
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
425 {
10323
bb2514e075db [gaim-migrate @ 11530]
Mark Doliner <mark@kingant.net>
parents: 10322
diff changeset
426 gboolean opt_help = FALSE;
bb2514e075db [gaim-migrate @ 11530]
Mark Doliner <mark@kingant.net>
parents: 10322
diff changeset
427 gboolean opt_login = FALSE;
bb2514e075db [gaim-migrate @ 11530]
Mark Doliner <mark@kingant.net>
parents: 10322
diff changeset
428 gboolean opt_nologin = FALSE;
bb2514e075db [gaim-migrate @ 11530]
Mark Doliner <mark@kingant.net>
parents: 10322
diff changeset
429 gboolean opt_version = FALSE;
bb2514e075db [gaim-migrate @ 11530]
Mark Doliner <mark@kingant.net>
parents: 10322
diff changeset
430 char *opt_config_dir_arg = NULL;
bb2514e075db [gaim-migrate @ 11530]
Mark Doliner <mark@kingant.net>
parents: 10322
diff changeset
431 char *opt_login_arg = NULL;
bb2514e075db [gaim-migrate @ 11530]
Mark Doliner <mark@kingant.net>
parents: 10322
diff changeset
432 char *opt_session_arg = NULL;
bb2514e075db [gaim-migrate @ 11530]
Mark Doliner <mark@kingant.net>
parents: 10322
diff changeset
433 int dologin_ret = -1;
10447
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10433
diff changeset
434 char *search_path;
13833
571aebbe5ec6 [gaim-migrate @ 16282]
Richard Laager <rlaager@wiktel.com>
parents: 13586
diff changeset
435 GList *accounts;
13427
e3717f0d24ad [gaim-migrate @ 15802]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13321
diff changeset
436 #ifdef HAVE_SIGNAL_H
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
437 int sig_indx; /* for setting up signal catching */
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
438 sigset_t sigset;
12409
d51cf8896f5c [gaim-migrate @ 14716]
Richard Laager <rlaager@wiktel.com>
parents: 12342
diff changeset
439 RETSIGTYPE (*prev_sig_disp)(int);
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
440 #endif
10323
bb2514e075db [gaim-migrate @ 11530]
Mark Doliner <mark@kingant.net>
parents: 10322
diff changeset
441 int opt;
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
442 gboolean gui_check;
10307
2ac21bf20e04 [gaim-migrate @ 11497]
Mark Doliner <mark@kingant.net>
parents: 10306
diff changeset
443 gboolean debug_enabled;
13427
e3717f0d24ad [gaim-migrate @ 15802]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13321
diff changeset
444 #ifdef HAVE_SIGNAL_H
10323
bb2514e075db [gaim-migrate @ 11530]
Mark Doliner <mark@kingant.net>
parents: 10322
diff changeset
445 char errmsg[BUFSIZ];
13214
812e2de69c90 [gaim-migrate @ 15578]
Richard Laager <rlaager@wiktel.com>
parents: 13110
diff changeset
446 #ifndef DEBUG
812e2de69c90 [gaim-migrate @ 15578]
Richard Laager <rlaager@wiktel.com>
parents: 13110
diff changeset
447 char *segfault_message_tmp;
812e2de69c90 [gaim-migrate @ 15578]
Richard Laager <rlaager@wiktel.com>
parents: 13110
diff changeset
448 GError *error = NULL;
812e2de69c90 [gaim-migrate @ 15578]
Richard Laager <rlaager@wiktel.com>
parents: 13110
diff changeset
449 #endif
10334
5aa8ed1ec91e [gaim-migrate @ 11541]
Mark Doliner <mark@kingant.net>
parents: 10333
diff changeset
450 #endif
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
451
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
452 struct option long_options[] = {
10323
bb2514e075db [gaim-migrate @ 11530]
Mark Doliner <mark@kingant.net>
parents: 10322
diff changeset
453 {"config", required_argument, NULL, 'c'},
bb2514e075db [gaim-migrate @ 11530]
Mark Doliner <mark@kingant.net>
parents: 10322
diff changeset
454 {"debug", no_argument, NULL, 'd'},
bb2514e075db [gaim-migrate @ 11530]
Mark Doliner <mark@kingant.net>
parents: 10322
diff changeset
455 {"help", no_argument, NULL, 'h'},
bb2514e075db [gaim-migrate @ 11530]
Mark Doliner <mark@kingant.net>
parents: 10322
diff changeset
456 {"login", optional_argument, NULL, 'l'},
bb2514e075db [gaim-migrate @ 11530]
Mark Doliner <mark@kingant.net>
parents: 10322
diff changeset
457 {"nologin", no_argument, NULL, 'n'},
bb2514e075db [gaim-migrate @ 11530]
Mark Doliner <mark@kingant.net>
parents: 10322
diff changeset
458 {"session", required_argument, NULL, 's'},
bb2514e075db [gaim-migrate @ 11530]
Mark Doliner <mark@kingant.net>
parents: 10322
diff changeset
459 {"version", no_argument, NULL, 'v'},
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
460 {0, 0, 0, 0}
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
461 };
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
462
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
463 #ifdef DEBUG
10307
2ac21bf20e04 [gaim-migrate @ 11497]
Mark Doliner <mark@kingant.net>
parents: 10306
diff changeset
464 debug_enabled = TRUE;
2ac21bf20e04 [gaim-migrate @ 11497]
Mark Doliner <mark@kingant.net>
parents: 10306
diff changeset
465 #else
2ac21bf20e04 [gaim-migrate @ 11497]
Mark Doliner <mark@kingant.net>
parents: 10306
diff changeset
466 debug_enabled = FALSE;
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
467 #endif
10307
2ac21bf20e04 [gaim-migrate @ 11497]
Mark Doliner <mark@kingant.net>
parents: 10306
diff changeset
468
12600
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12572
diff changeset
469 #ifdef GAIM_FATAL_ASSERTS
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12572
diff changeset
470 /* Make g_return_... functions fatal. */
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12572
diff changeset
471 g_log_set_always_fatal(G_LOG_LEVEL_CRITICAL);
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12572
diff changeset
472 #endif
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12572
diff changeset
473
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
474 #ifndef _WIN32
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
475 br_set_locate_fallback_func(gaim_find_binary_location, argv[0]);
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
476 #endif
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
477 #ifdef ENABLE_NLS
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
478 bindtextdomain(PACKAGE, LOCALEDIR);
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
479 bind_textdomain_codeset(PACKAGE, "UTF-8");
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
480 textdomain(PACKAGE);
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
481 #endif
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
482
13089
b553326bc468 [gaim-migrate @ 15451]
Mark Doliner <mark@kingant.net>
parents: 13024
diff changeset
483 #ifdef HAVE_SETLOCALE
b553326bc468 [gaim-migrate @ 15451]
Mark Doliner <mark@kingant.net>
parents: 13024
diff changeset
484 /* Locale initialization is not complete here. See gtk_init_check() */
b553326bc468 [gaim-migrate @ 15451]
Mark Doliner <mark@kingant.net>
parents: 13024
diff changeset
485 setlocale(LC_ALL, "");
b553326bc468 [gaim-migrate @ 15451]
Mark Doliner <mark@kingant.net>
parents: 13024
diff changeset
486 #endif
11080
f54740547c95 [gaim-migrate @ 13092]
Piotr Zielinski <zielaj>
parents: 11067
diff changeset
487
13427
e3717f0d24ad [gaim-migrate @ 15802]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13321
diff changeset
488 #ifdef HAVE_SIGNAL_H
12556
14e094d7568f [gaim-migrate @ 14875]
Richard Laager <rlaager@wiktel.com>
parents: 12409
diff changeset
489
14e094d7568f [gaim-migrate @ 14875]
Richard Laager <rlaager@wiktel.com>
parents: 12409
diff changeset
490 #ifndef DEBUG
14e094d7568f [gaim-migrate @ 14875]
Richard Laager <rlaager@wiktel.com>
parents: 12409
diff changeset
491 /* We translate this here in case the crash breaks gettext. */
13214
812e2de69c90 [gaim-migrate @ 15578]
Richard Laager <rlaager@wiktel.com>
parents: 13110
diff changeset
492 segfault_message_tmp = g_strdup_printf(_(
12556
14e094d7568f [gaim-migrate @ 14875]
Richard Laager <rlaager@wiktel.com>
parents: 12409
diff changeset
493 "Gaim has segfaulted and attempted to dump a core file.\n"
14e094d7568f [gaim-migrate @ 14875]
Richard Laager <rlaager@wiktel.com>
parents: 12409
diff changeset
494 "This is a bug in the software and has happened through\n"
14e094d7568f [gaim-migrate @ 14875]
Richard Laager <rlaager@wiktel.com>
parents: 12409
diff changeset
495 "no fault of your own.\n\n"
14e094d7568f [gaim-migrate @ 14875]
Richard Laager <rlaager@wiktel.com>
parents: 12409
diff changeset
496 "If you can reproduce the crash, please notify the gaim\n"
14e094d7568f [gaim-migrate @ 14875]
Richard Laager <rlaager@wiktel.com>
parents: 12409
diff changeset
497 "developers by reporting a bug at\n"
13089
b553326bc468 [gaim-migrate @ 15451]
Mark Doliner <mark@kingant.net>
parents: 13024
diff changeset
498 "%sbug.php\n\n"
12556
14e094d7568f [gaim-migrate @ 14875]
Richard Laager <rlaager@wiktel.com>
parents: 12409
diff changeset
499 "Please make sure to specify what you were doing at the time\n"
14e094d7568f [gaim-migrate @ 14875]
Richard Laager <rlaager@wiktel.com>
parents: 12409
diff changeset
500 "and post the backtrace from the core file. If you do not know\n"
14e094d7568f [gaim-migrate @ 14875]
Richard Laager <rlaager@wiktel.com>
parents: 12409
diff changeset
501 "how to get the backtrace, please read the instructions at\n"
13214
812e2de69c90 [gaim-migrate @ 15578]
Richard Laager <rlaager@wiktel.com>
parents: 13110
diff changeset
502 "%sgdb.php\n\n"
812e2de69c90 [gaim-migrate @ 15578]
Richard Laager <rlaager@wiktel.com>
parents: 13110
diff changeset
503 "If you need further assistance, please IM either SeanEgn or \n"
812e2de69c90 [gaim-migrate @ 15578]
Richard Laager <rlaager@wiktel.com>
parents: 13110
diff changeset
504 "LSchiere (via AIM). Contact information for Sean and Luke \n"
812e2de69c90 [gaim-migrate @ 15578]
Richard Laager <rlaager@wiktel.com>
parents: 13110
diff changeset
505 "on other protocols is at\n"
812e2de69c90 [gaim-migrate @ 15578]
Richard Laager <rlaager@wiktel.com>
parents: 13110
diff changeset
506 "%scontactinfo.php\n"),
13089
b553326bc468 [gaim-migrate @ 15451]
Mark Doliner <mark@kingant.net>
parents: 13024
diff changeset
507 GAIM_WEBSITE, GAIM_WEBSITE, GAIM_WEBSITE
b553326bc468 [gaim-migrate @ 15451]
Mark Doliner <mark@kingant.net>
parents: 13024
diff changeset
508 );
13586
0cc7773b1d87 [gaim-migrate @ 15971]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13428
diff changeset
509
13214
812e2de69c90 [gaim-migrate @ 15578]
Richard Laager <rlaager@wiktel.com>
parents: 13110
diff changeset
510 /* we have to convert the message (UTF-8 to console
812e2de69c90 [gaim-migrate @ 15578]
Richard Laager <rlaager@wiktel.com>
parents: 13110
diff changeset
511 charset) early because after a segmentation fault
812e2de69c90 [gaim-migrate @ 15578]
Richard Laager <rlaager@wiktel.com>
parents: 13110
diff changeset
512 it's not a good practice to allocate memory */
13586
0cc7773b1d87 [gaim-migrate @ 15971]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13428
diff changeset
513 segfault_message = g_locale_from_utf8(segfault_message_tmp,
13214
812e2de69c90 [gaim-migrate @ 15578]
Richard Laager <rlaager@wiktel.com>
parents: 13110
diff changeset
514 -1, NULL, NULL, &error);
812e2de69c90 [gaim-migrate @ 15578]
Richard Laager <rlaager@wiktel.com>
parents: 13110
diff changeset
515 if (segfault_message != NULL) {
812e2de69c90 [gaim-migrate @ 15578]
Richard Laager <rlaager@wiktel.com>
parents: 13110
diff changeset
516 g_free(segfault_message_tmp);
812e2de69c90 [gaim-migrate @ 15578]
Richard Laager <rlaager@wiktel.com>
parents: 13110
diff changeset
517 }
812e2de69c90 [gaim-migrate @ 15578]
Richard Laager <rlaager@wiktel.com>
parents: 13110
diff changeset
518 else {
812e2de69c90 [gaim-migrate @ 15578]
Richard Laager <rlaager@wiktel.com>
parents: 13110
diff changeset
519 /* use 'segfault_message_tmp' (UTF-8) as a fallback */
812e2de69c90 [gaim-migrate @ 15578]
Richard Laager <rlaager@wiktel.com>
parents: 13110
diff changeset
520 g_warning("%s\n", error->message);
812e2de69c90 [gaim-migrate @ 15578]
Richard Laager <rlaager@wiktel.com>
parents: 13110
diff changeset
521 g_error_free(error);
812e2de69c90 [gaim-migrate @ 15578]
Richard Laager <rlaager@wiktel.com>
parents: 13110
diff changeset
522 segfault_message = segfault_message_tmp;
812e2de69c90 [gaim-migrate @ 15578]
Richard Laager <rlaager@wiktel.com>
parents: 13110
diff changeset
523 }
12556
14e094d7568f [gaim-migrate @ 14875]
Richard Laager <rlaager@wiktel.com>
parents: 12409
diff changeset
524 #else
14e094d7568f [gaim-migrate @ 14875]
Richard Laager <rlaager@wiktel.com>
parents: 12409
diff changeset
525 /* Don't mark this for translation. */
14e094d7568f [gaim-migrate @ 14875]
Richard Laager <rlaager@wiktel.com>
parents: 12409
diff changeset
526 segfault_message = g_strdup(
14e094d7568f [gaim-migrate @ 14875]
Richard Laager <rlaager@wiktel.com>
parents: 12409
diff changeset
527 "Hi, user. We need to talk.\n"
14e094d7568f [gaim-migrate @ 14875]
Richard Laager <rlaager@wiktel.com>
parents: 12409
diff changeset
528 "I think something's gone wrong here. It's probably my fault.\n"
14e094d7568f [gaim-migrate @ 14875]
Richard Laager <rlaager@wiktel.com>
parents: 12409
diff changeset
529 "No, really, it's not you... it's me... no no no, I think we get along well\n"
12670
f57ff720957f [gaim-migrate @ 15013]
Richard Laager <rlaager@wiktel.com>
parents: 12600
diff changeset
530 "it's just that.... well, I want to see other people. I... what?!? NO! I \n"
f57ff720957f [gaim-migrate @ 15013]
Richard Laager <rlaager@wiktel.com>
parents: 12600
diff changeset
531 "haven't been cheating on you!! How many times do you want me to tell you?! And\n"
f57ff720957f [gaim-migrate @ 15013]
Richard Laager <rlaager@wiktel.com>
parents: 12600
diff changeset
532 "for the last time, it's just a rash!\n"
12556
14e094d7568f [gaim-migrate @ 14875]
Richard Laager <rlaager@wiktel.com>
parents: 12409
diff changeset
533 );
14e094d7568f [gaim-migrate @ 14875]
Richard Laager <rlaager@wiktel.com>
parents: 12409
diff changeset
534 #endif
14e094d7568f [gaim-migrate @ 14875]
Richard Laager <rlaager@wiktel.com>
parents: 12409
diff changeset
535
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
536 /* Let's not violate any PLA's!!!! */
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
537 /* jseymour: whatever the fsck that means */
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
538 /* Robot101: for some reason things like gdm like to block *
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
539 * useful signals like SIGCHLD, so we unblock all the ones we *
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
540 * declare a handler for. thanks JSeymour and Vann. */
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
541 if (sigemptyset(&sigset)) {
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
542 snprintf(errmsg, BUFSIZ, "Warning: couldn't initialise empty signal set");
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
543 perror(errmsg);
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
544 }
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
545 for(sig_indx = 0; catch_sig_list[sig_indx] != -1; ++sig_indx) {
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
546 if((prev_sig_disp = signal(catch_sig_list[sig_indx], sighandler)) == SIG_ERR) {
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
547 snprintf(errmsg, BUFSIZ, "Warning: couldn't set signal %d for catching",
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
548 catch_sig_list[sig_indx]);
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
549 perror(errmsg);
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
550 }
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
551 if(sigaddset(&sigset, catch_sig_list[sig_indx])) {
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
552 snprintf(errmsg, BUFSIZ, "Warning: couldn't include signal %d for unblocking",
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
553 catch_sig_list[sig_indx]);
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
554 perror(errmsg);
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
555 }
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
556 }
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
557 for(sig_indx = 0; ignore_sig_list[sig_indx] != -1; ++sig_indx) {
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
558 if((prev_sig_disp = signal(ignore_sig_list[sig_indx], SIG_IGN)) == SIG_ERR) {
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
559 snprintf(errmsg, BUFSIZ, "Warning: couldn't set signal %d to ignore",
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
560 ignore_sig_list[sig_indx]);
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
561 perror(errmsg);
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
562 }
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
563 }
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
564
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
565 if (sigprocmask(SIG_UNBLOCK, &sigset, NULL)) {
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
566 snprintf(errmsg, BUFSIZ, "Warning: couldn't unblock signals");
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
567 perror(errmsg);
10307
2ac21bf20e04 [gaim-migrate @ 11497]
Mark Doliner <mark@kingant.net>
parents: 10306
diff changeset
568 }
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
569 #endif
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
570
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
571 /* scan command-line options */
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
572 opterr = 1;
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
573 while ((opt = getopt_long(argc, argv,
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
574 #ifndef _WIN32
11795
f48e2acaa5d2 [gaim-migrate @ 14086]
Richard Laager <rlaager@wiktel.com>
parents: 11785
diff changeset
575 "c:dhnl::s:v",
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
576 #else
11795
f48e2acaa5d2 [gaim-migrate @ 14086]
Richard Laager <rlaager@wiktel.com>
parents: 11785
diff changeset
577 "c:dhnl::v",
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
578 #endif
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
579 long_options, NULL)) != -1) {
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
580 switch (opt) {
10323
bb2514e075db [gaim-migrate @ 11530]
Mark Doliner <mark@kingant.net>
parents: 10322
diff changeset
581 case 'c': /* config dir */
bb2514e075db [gaim-migrate @ 11530]
Mark Doliner <mark@kingant.net>
parents: 10322
diff changeset
582 g_free(opt_config_dir_arg);
bb2514e075db [gaim-migrate @ 11530]
Mark Doliner <mark@kingant.net>
parents: 10322
diff changeset
583 opt_config_dir_arg = g_strdup(optarg);
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
584 break;
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
585 case 'd': /* debug */
10307
2ac21bf20e04 [gaim-migrate @ 11497]
Mark Doliner <mark@kingant.net>
parents: 10306
diff changeset
586 debug_enabled = TRUE;
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
587 break;
10323
bb2514e075db [gaim-migrate @ 11530]
Mark Doliner <mark@kingant.net>
parents: 10322
diff changeset
588 case 'h': /* help */
bb2514e075db [gaim-migrate @ 11530]
Mark Doliner <mark@kingant.net>
parents: 10322
diff changeset
589 opt_help = TRUE;
bb2514e075db [gaim-migrate @ 11530]
Mark Doliner <mark@kingant.net>
parents: 10322
diff changeset
590 break;
bb2514e075db [gaim-migrate @ 11530]
Mark Doliner <mark@kingant.net>
parents: 10322
diff changeset
591 case 'n': /* no autologin */
bb2514e075db [gaim-migrate @ 11530]
Mark Doliner <mark@kingant.net>
parents: 10322
diff changeset
592 opt_nologin = TRUE;
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
593 break;
10323
bb2514e075db [gaim-migrate @ 11530]
Mark Doliner <mark@kingant.net>
parents: 10322
diff changeset
594 case 'l': /* login, option username */
bb2514e075db [gaim-migrate @ 11530]
Mark Doliner <mark@kingant.net>
parents: 10322
diff changeset
595 opt_login = TRUE;
bb2514e075db [gaim-migrate @ 11530]
Mark Doliner <mark@kingant.net>
parents: 10322
diff changeset
596 g_free(opt_login_arg);
bb2514e075db [gaim-migrate @ 11530]
Mark Doliner <mark@kingant.net>
parents: 10322
diff changeset
597 if (optarg != NULL)
bb2514e075db [gaim-migrate @ 11530]
Mark Doliner <mark@kingant.net>
parents: 10322
diff changeset
598 opt_login_arg = g_strdup(optarg);
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
599 break;
10320
61852117568f [gaim-migrate @ 11527]
Mark Doliner <mark@kingant.net>
parents: 10317
diff changeset
600 case 's': /* use existing session ID */
10323
bb2514e075db [gaim-migrate @ 11530]
Mark Doliner <mark@kingant.net>
parents: 10322
diff changeset
601 g_free(opt_session_arg);
10320
61852117568f [gaim-migrate @ 11527]
Mark Doliner <mark@kingant.net>
parents: 10317
diff changeset
602 opt_session_arg = g_strdup(optarg);
61852117568f [gaim-migrate @ 11527]
Mark Doliner <mark@kingant.net>
parents: 10317
diff changeset
603 break;
10323
bb2514e075db [gaim-migrate @ 11530]
Mark Doliner <mark@kingant.net>
parents: 10322
diff changeset
604 case 'v': /* version */
bb2514e075db [gaim-migrate @ 11530]
Mark Doliner <mark@kingant.net>
parents: 10322
diff changeset
605 opt_version = TRUE;
10320
61852117568f [gaim-migrate @ 11527]
Mark Doliner <mark@kingant.net>
parents: 10317
diff changeset
606 break;
10323
bb2514e075db [gaim-migrate @ 11530]
Mark Doliner <mark@kingant.net>
parents: 10322
diff changeset
607 case '?': /* show terse help */
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
608 default:
10320
61852117568f [gaim-migrate @ 11527]
Mark Doliner <mark@kingant.net>
parents: 10317
diff changeset
609 show_usage(argv[0], TRUE);
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
610 return 0;
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
611 break;
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
612 }
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
613 }
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
614
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
615 /* show help message */
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
616 if (opt_help) {
10320
61852117568f [gaim-migrate @ 11527]
Mark Doliner <mark@kingant.net>
parents: 10317
diff changeset
617 show_usage(argv[0], FALSE);
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
618 return 0;
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
619 }
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
620 /* show version message */
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
621 if (opt_version) {
10323
bb2514e075db [gaim-migrate @ 11530]
Mark Doliner <mark@kingant.net>
parents: 10322
diff changeset
622 printf("Gaim %s\n", VERSION);
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
623 return 0;
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
624 }
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
625
10323
bb2514e075db [gaim-migrate @ 11530]
Mark Doliner <mark@kingant.net>
parents: 10322
diff changeset
626 /* set a user-specified config directory */
bb2514e075db [gaim-migrate @ 11530]
Mark Doliner <mark@kingant.net>
parents: 10322
diff changeset
627 if (opt_config_dir_arg != NULL) {
10871
6240d7fd5b2c [gaim-migrate @ 12558]
Mark Doliner <mark@kingant.net>
parents: 10819
diff changeset
628 gaim_util_set_user_dir(opt_config_dir_arg);
10323
bb2514e075db [gaim-migrate @ 11530]
Mark Doliner <mark@kingant.net>
parents: 10322
diff changeset
629 }
bb2514e075db [gaim-migrate @ 11530]
Mark Doliner <mark@kingant.net>
parents: 10322
diff changeset
630
10448
6a20307ef8dc [gaim-migrate @ 11713]
Mark Doliner <mark@kingant.net>
parents: 10447
diff changeset
631 /*
6a20307ef8dc [gaim-migrate @ 11713]
Mark Doliner <mark@kingant.net>
parents: 10447
diff changeset
632 * We're done piddling around with command line arguments.
6a20307ef8dc [gaim-migrate @ 11713]
Mark Doliner <mark@kingant.net>
parents: 10447
diff changeset
633 * Fire up this baby.
6a20307ef8dc [gaim-migrate @ 11713]
Mark Doliner <mark@kingant.net>
parents: 10447
diff changeset
634 */
6a20307ef8dc [gaim-migrate @ 11713]
Mark Doliner <mark@kingant.net>
parents: 10447
diff changeset
635
6a20307ef8dc [gaim-migrate @ 11713]
Mark Doliner <mark@kingant.net>
parents: 10447
diff changeset
636 gaim_debug_set_enabled(debug_enabled);
6a20307ef8dc [gaim-migrate @ 11713]
Mark Doliner <mark@kingant.net>
parents: 10447
diff changeset
637
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
638 #ifdef _WIN32
10323
bb2514e075db [gaim-migrate @ 11530]
Mark Doliner <mark@kingant.net>
parents: 10322
diff changeset
639 wgaim_init(hint);
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
640 #endif
11067
2eca9ed49469 [gaim-migrate @ 13048]
Piotr Zielinski <zielaj>
parents: 11055
diff changeset
641
12572
bf01b160ab0d [gaim-migrate @ 14891]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12562
diff changeset
642 search_path = g_build_filename(gaim_user_dir(), "gtkrc-2.0", NULL);
bf01b160ab0d [gaim-migrate @ 14891]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12562
diff changeset
643 gtk_rc_add_default_file(search_path);
bf01b160ab0d [gaim-migrate @ 14891]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12562
diff changeset
644 g_free(search_path);
bf01b160ab0d [gaim-migrate @ 14891]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12562
diff changeset
645
bf01b160ab0d [gaim-migrate @ 14891]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12562
diff changeset
646
bf01b160ab0d [gaim-migrate @ 14891]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12562
diff changeset
647 gui_check = gtk_init_check(&argc, &argv);
bf01b160ab0d [gaim-migrate @ 14891]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12562
diff changeset
648 if (!gui_check) {
bf01b160ab0d [gaim-migrate @ 14891]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12562
diff changeset
649 char *display = gdk_get_display();
bf01b160ab0d [gaim-migrate @ 14891]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12562
diff changeset
650
bf01b160ab0d [gaim-migrate @ 14891]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12562
diff changeset
651 printf("Gaim %s\n", VERSION);
bf01b160ab0d [gaim-migrate @ 14891]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12562
diff changeset
652
bf01b160ab0d [gaim-migrate @ 14891]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12562
diff changeset
653 g_warning("cannot open display: %s", display ? display : "unset");
bf01b160ab0d [gaim-migrate @ 14891]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12562
diff changeset
654 g_free(display);
bf01b160ab0d [gaim-migrate @ 14891]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12562
diff changeset
655
bf01b160ab0d [gaim-migrate @ 14891]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12562
diff changeset
656 return 1;
bf01b160ab0d [gaim-migrate @ 14891]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12562
diff changeset
657 }
bf01b160ab0d [gaim-migrate @ 14891]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12562
diff changeset
658
bf01b160ab0d [gaim-migrate @ 14891]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12562
diff changeset
659 #ifdef _WIN32
bf01b160ab0d [gaim-migrate @ 14891]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12562
diff changeset
660 /** TODO: Move this to a wgaim_gtk_init() if we need such a thing */
bf01b160ab0d [gaim-migrate @ 14891]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12562
diff changeset
661 wgaim_gtkspell_init();
13321
c61c0a4ba6de [gaim-migrate @ 15690]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13293
diff changeset
662 gaim_debug_info("wgaim", "GTK+ :%u.%u.%u\n",
c61c0a4ba6de [gaim-migrate @ 15690]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13293
diff changeset
663 gtk_major_version, gtk_minor_version, gtk_micro_version);
c61c0a4ba6de [gaim-migrate @ 15690]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13293
diff changeset
664
12572
bf01b160ab0d [gaim-migrate @ 14891]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12562
diff changeset
665 #endif
bf01b160ab0d [gaim-migrate @ 14891]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12562
diff changeset
666
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
667 gaim_core_set_ui_ops(gaim_gtk_core_get_ui_ops());
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
668 gaim_eventloop_set_ui_ops(gaim_gtk_eventloop_get_ui_ops());
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
669
12342
0692d20d9d81 [gaim-migrate @ 14646]
Mark Doliner <mark@kingant.net>
parents: 12272
diff changeset
670 /*
0692d20d9d81 [gaim-migrate @ 14646]
Mark Doliner <mark@kingant.net>
parents: 12272
diff changeset
671 * Set plugin search directories. Give priority to the plugins
0692d20d9d81 [gaim-migrate @ 14646]
Mark Doliner <mark@kingant.net>
parents: 12272
diff changeset
672 * in user's home directory.
0692d20d9d81 [gaim-migrate @ 14646]
Mark Doliner <mark@kingant.net>
parents: 12272
diff changeset
673 */
10447
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10433
diff changeset
674 search_path = g_build_filename(gaim_user_dir(), "plugins", NULL);
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10433
diff changeset
675 gaim_plugins_add_search_path(search_path);
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10433
diff changeset
676 g_free(search_path);
12342
0692d20d9d81 [gaim-migrate @ 14646]
Mark Doliner <mark@kingant.net>
parents: 12272
diff changeset
677 gaim_plugins_add_search_path(LIBDIR);
10447
6feef0a9098a [gaim-migrate @ 11712]
Mark Doliner <mark@kingant.net>
parents: 10433
diff changeset
678
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
679 if (!gaim_core_init(GAIM_GTK_UI)) {
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
680 fprintf(stderr,
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
681 "Initialization of the Gaim core failed. Dumping core.\n"
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
682 "Please report this!\n");
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
683 abort();
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
684 }
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
685
10428
04c663ccbcb1 [gaim-migrate @ 11680]
Mark Doliner <mark@kingant.net>
parents: 10425
diff changeset
686 /* TODO: Move blist loading into gaim_blist_init() */
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
687 gaim_set_blist(gaim_blist_new());
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
688 gaim_blist_load();
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
689
10433
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10428
diff changeset
690 /* TODO: Move prefs loading into gaim_prefs_init() */
13428
c6de7d8869c9 [gaim-migrate @ 15803]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13427
diff changeset
691 gaim_prefs_load();
c6de7d8869c9 [gaim-migrate @ 15803]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13427
diff changeset
692 gaim_prefs_update_old();
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
693 gaim_gtk_prefs_update_old();
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
694
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
695 /* load plugins we had when we quit */
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
696 gaim_plugins_load_saved("/gaim/gtk/plugins/loaded");
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
697
10433
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10428
diff changeset
698 /* TODO: Move pounces loading into gaim_pounces_init() */
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
699 gaim_pounces_load();
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
700
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
701 ui_main();
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
702
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
703 #ifdef USE_SM
12246
b7a51e68d0b8 [gaim-migrate @ 14548]
Mark Doliner <mark@kingant.net>
parents: 12202
diff changeset
704 gaim_gtk_session_init(argv[0], opt_session_arg, opt_config_dir_arg);
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
705 #endif
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
706 if (opt_session_arg != NULL) {
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
707 g_free(opt_session_arg);
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
708 opt_session_arg = NULL;
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
709 }
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
710 if (opt_config_dir_arg != NULL) {
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
711 g_free(opt_config_dir_arg);
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
712 opt_config_dir_arg = NULL;
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
713 }
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
714
12011
b4d7d6dbc95c [gaim-migrate @ 14304]
Mark Doliner <mark@kingant.net>
parents: 11928
diff changeset
715 /*
b4d7d6dbc95c [gaim-migrate @ 14304]
Mark Doliner <mark@kingant.net>
parents: 11928
diff changeset
716 * We want to show the blist early in the init process so the
b4d7d6dbc95c [gaim-migrate @ 14304]
Mark Doliner <mark@kingant.net>
parents: 11928
diff changeset
717 * user feels warm and fuzzy (not cold and prickley).
b4d7d6dbc95c [gaim-migrate @ 14304]
Mark Doliner <mark@kingant.net>
parents: 11928
diff changeset
718 */
b4d7d6dbc95c [gaim-migrate @ 14304]
Mark Doliner <mark@kingant.net>
parents: 11928
diff changeset
719 gaim_blist_show();
b4d7d6dbc95c [gaim-migrate @ 14304]
Mark Doliner <mark@kingant.net>
parents: 11928
diff changeset
720
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
721 if (gaim_prefs_get_bool("/gaim/gtk/debug/enabled"))
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
722 gaim_gtk_debug_window_show();
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
723
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
724 if (opt_login) {
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
725 dologin_ret = dologin_named(opt_login_arg);
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
726 if (opt_login_arg != NULL) {
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
727 g_free(opt_login_arg);
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
728 opt_login_arg = NULL;
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
729 }
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
730 }
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
731
11806
7584d802f0ac [gaim-migrate @ 14097]
Mark Doliner <mark@kingant.net>
parents: 11795
diff changeset
732 if (opt_nologin)
7584d802f0ac [gaim-migrate @ 14097]
Mark Doliner <mark@kingant.net>
parents: 11795
diff changeset
733 {
7584d802f0ac [gaim-migrate @ 14097]
Mark Doliner <mark@kingant.net>
parents: 11795
diff changeset
734 /* Set all accounts to "offline" */
7584d802f0ac [gaim-migrate @ 14097]
Mark Doliner <mark@kingant.net>
parents: 11795
diff changeset
735 GaimSavedStatus *saved_status;
13110
0e7f19583825 [gaim-migrate @ 15472]
Mark Doliner <mark@kingant.net>
parents: 13105
diff changeset
736
0e7f19583825 [gaim-migrate @ 15472]
Mark Doliner <mark@kingant.net>
parents: 13105
diff changeset
737 /* If we've used this type+message before, lookup the transient status */
13244
c97c76d9d347 [gaim-migrate @ 15610]
Mark Doliner <mark@kingant.net>
parents: 13214
diff changeset
738 saved_status = gaim_savedstatus_find_transient_by_type_and_message(
13110
0e7f19583825 [gaim-migrate @ 15472]
Mark Doliner <mark@kingant.net>
parents: 13105
diff changeset
739 GAIM_STATUS_OFFLINE, NULL);
0e7f19583825 [gaim-migrate @ 15472]
Mark Doliner <mark@kingant.net>
parents: 13105
diff changeset
740
0e7f19583825 [gaim-migrate @ 15472]
Mark Doliner <mark@kingant.net>
parents: 13105
diff changeset
741 /* If this type+message is unique then create a new transient saved status */
0e7f19583825 [gaim-migrate @ 15472]
Mark Doliner <mark@kingant.net>
parents: 13105
diff changeset
742 if (saved_status == NULL)
0e7f19583825 [gaim-migrate @ 15472]
Mark Doliner <mark@kingant.net>
parents: 13105
diff changeset
743 saved_status = gaim_savedstatus_new(NULL, GAIM_STATUS_OFFLINE);
0e7f19583825 [gaim-migrate @ 15472]
Mark Doliner <mark@kingant.net>
parents: 13105
diff changeset
744
0e7f19583825 [gaim-migrate @ 15472]
Mark Doliner <mark@kingant.net>
parents: 13105
diff changeset
745 /* Set the status for each account */
11806
7584d802f0ac [gaim-migrate @ 14097]
Mark Doliner <mark@kingant.net>
parents: 11795
diff changeset
746 gaim_savedstatus_activate(saved_status);
7584d802f0ac [gaim-migrate @ 14097]
Mark Doliner <mark@kingant.net>
parents: 11795
diff changeset
747 }
7584d802f0ac [gaim-migrate @ 14097]
Mark Doliner <mark@kingant.net>
parents: 11795
diff changeset
748 else
10738
55af3fa46329 [gaim-migrate @ 12340]
Mark Doliner <mark@kingant.net>
parents: 10638
diff changeset
749 {
11348
efb358543b1d [gaim-migrate @ 13565]
Mark Doliner <mark@kingant.net>
parents: 11277
diff changeset
750 /* Everything is good to go--sign on already */
12857
e5f780a6137b [gaim-migrate @ 15208]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12846
diff changeset
751 if (!gaim_prefs_get_bool("/core/savedstatus/startup_current_status"))
e5f780a6137b [gaim-migrate @ 15208]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12846
diff changeset
752 gaim_savedstatus_activate(gaim_savedstatus_get_startup());
e5f780a6137b [gaim-migrate @ 15208]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12846
diff changeset
753 gaim_accounts_restore_current_statuses();
10738
55af3fa46329 [gaim-migrate @ 12340]
Mark Doliner <mark@kingant.net>
parents: 10638
diff changeset
754 }
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
755
13833
571aebbe5ec6 [gaim-migrate @ 16282]
Richard Laager <rlaager@wiktel.com>
parents: 13586
diff changeset
756 if ((accounts = gaim_accounts_get_all_active()) == NULL)
11403
f5b14ad58722 [gaim-migrate @ 13638]
Mark Doliner <mark@kingant.net>
parents: 11348
diff changeset
757 {
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
758 gaim_gtk_accounts_window_show();
10315
deec4b58d516 [gaim-migrate @ 11515]
Sean Egan <seanegan@gmail.com>
parents: 10307
diff changeset
759 }
13833
571aebbe5ec6 [gaim-migrate @ 16282]
Richard Laager <rlaager@wiktel.com>
parents: 13586
diff changeset
760 else
571aebbe5ec6 [gaim-migrate @ 16282]
Richard Laager <rlaager@wiktel.com>
parents: 13586
diff changeset
761 {
571aebbe5ec6 [gaim-migrate @ 16282]
Richard Laager <rlaager@wiktel.com>
parents: 13586
diff changeset
762 g_list_free(accounts);
571aebbe5ec6 [gaim-migrate @ 16282]
Richard Laager <rlaager@wiktel.com>
parents: 13586
diff changeset
763 }
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
764
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
765 #ifdef HAVE_STARTUP_NOTIFICATION
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
766 startup_notification_complete();
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
767 #endif
10320
61852117568f [gaim-migrate @ 11527]
Mark Doliner <mark@kingant.net>
parents: 10317
diff changeset
768
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
769 gtk_main();
10320
61852117568f [gaim-migrate @ 11527]
Mark Doliner <mark@kingant.net>
parents: 10317
diff changeset
770
13427
e3717f0d24ad [gaim-migrate @ 15802]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13321
diff changeset
771 #ifdef HAVE_SIGNAL_H
12556
14e094d7568f [gaim-migrate @ 14875]
Richard Laager <rlaager@wiktel.com>
parents: 12409
diff changeset
772 g_free(segfault_message);
12562
e3b4abe7e0f8 [gaim-migrate @ 14881]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12556
diff changeset
773 #endif
12556
14e094d7568f [gaim-migrate @ 14875]
Richard Laager <rlaager@wiktel.com>
parents: 12409
diff changeset
774
10302
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
775 #ifdef _WIN32
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
776 wgaim_cleanup();
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
777 #endif
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
778
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
779 return 0;
581de78cf809 [gaim-migrate @ 11487]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
780 }