Thu, 20 Sep 2007 17:30:59 +0000
purple_connection_error_reason-ify myspace
| 10302 | 1 | /* |
|
15931
716b5fac1895
Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@pidgin.im>
parents:
15884
diff
changeset
|
2 | * pidgin |
| 10302 | 3 | * |
|
15931
716b5fac1895
Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@pidgin.im>
parents:
15884
diff
changeset
|
4 | * Pidgin is the legal property of its developers, whose names are too numerous |
| 10302 | 5 | * to list here. Please refer to the COPYRIGHT file distributed with this |
| 6 | * source distribution. | |
| 7 | * | |
| 8 | * This program is free software; you can redistribute it and/or modify | |
| 9 | * it under the terms of the GNU General Public License as published by | |
| 10 | * the Free Software Foundation; either version 2 of the License, or | |
| 11 | * (at your option) any later version. | |
| 12 | * | |
| 13 | * This program is distributed in the hope that it will be useful, | |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 16 | * GNU General Public License for more details. | |
| 17 | * | |
| 18 | * You should have received a copy of the GNU General Public License | |
| 19 | * along with this program; if not, write to the Free Software | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19840
diff
changeset
|
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 10302 | 21 | * |
| 22 | */ | |
| 23 | ||
| 24 | #include "internal.h" | |
| 15577 | 25 | #include "pidgin.h" |
| 10302 | 26 | |
| 27 | #include "account.h" | |
| 28 | #include "conversation.h" | |
| 29 | #include "core.h" | |
| 30 | #include "debug.h" | |
| 31 | #include "eventloop.h" | |
| 32 | #include "ft.h" | |
| 33 | #include "log.h" | |
|
19048
432404a6b416
Fix stun to work on startup (this is is a temporary hack until purple_prefs_load() happens in the core). Fixes #2334
Daniel Atallah <datallah@pidgin.im>
parents:
18606
diff
changeset
|
34 | #include "network.h" |
| 10302 | 35 | #include "notify.h" |
| 36 | #include "prefs.h" | |
| 37 | #include "prpl.h" | |
| 38 | #include "pounce.h" | |
| 39 | #include "sound.h" | |
| 40 | #include "status.h" | |
| 41 | #include "util.h" | |
|
11475
1e222e6e52a0
[gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
11403
diff
changeset
|
42 | #include "whiteboard.h" |
| 10302 | 43 | |
| 44 | #include "gtkaccount.h" | |
| 45 | #include "gtkblist.h" | |
| 46 | #include "gtkconn.h" | |
| 47 | #include "gtkconv.h" | |
| 48 | #include "gtkdebug.h" | |
| 49 | #include "gtkdialogs.h" | |
| 14743 | 50 | #include "gtkdocklet.h" |
| 10302 | 51 | #include "gtkeventloop.h" |
| 52 | #include "gtkft.h" | |
|
11907
de3ea77afe3c
[gaim-migrate @ 14198]
Evan Schoenberg <evands@pidgin.im>
parents:
11906
diff
changeset
|
53 | #include "gtkidle.h" |
|
12838
5c6f36abeee8
[gaim-migrate @ 15186]
Richard Laager <rlaager@pidgin.im>
parents:
12670
diff
changeset
|
54 | #include "gtklog.h" |
| 10302 | 55 | #include "gtknotify.h" |
| 56 | #include "gtkplugin.h" | |
| 57 | #include "gtkpounce.h" | |
| 58 | #include "gtkprefs.h" | |
| 59 | #include "gtkprivacy.h" | |
| 60 | #include "gtkrequest.h" | |
| 61 | #include "gtkroomlist.h" | |
|
10574
5abb2931b6ff
[gaim-migrate @ 11966]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10448
diff
changeset
|
62 | #include "gtksavedstatuses.h" |
|
12246
7af1ef3b1cc4
[gaim-migrate @ 14548]
Mark Doliner <markdoliner@pidgin.im>
parents:
12202
diff
changeset
|
63 | #include "gtksession.h" |
| 10302 | 64 | #include "gtksound.h" |
|
11525
1d06283bdcc9
[gaim-migrate @ 13773]
Francesco Fracassi <ffracassi@users.sourceforge.net>
parents:
11520
diff
changeset
|
65 | #include "gtkthemes.h" |
| 10302 | 66 | #include "gtkutils.h" |
|
15883
969b74a3e27a
According to etags, pidgin/ should be completely clean of references to 'gaim' as a client
Sean Egan <seanegan@pidgin.im>
parents:
15808
diff
changeset
|
67 | #include "pidginstock.h" |
|
11475
1e222e6e52a0
[gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
11403
diff
changeset
|
68 | #include "gtkwhiteboard.h" |
| 10302 | 69 | |
|
13428
78687459c64b
[gaim-migrate @ 15802]
Daniel Atallah <datallah@pidgin.im>
parents:
13322
diff
changeset
|
70 | #ifdef HAVE_SIGNAL_H |
| 10302 | 71 | # include <signal.h> |
| 72 | #endif | |
| 73 | ||
| 74 | #include <getopt.h> | |
| 75 | ||
| 76 | #ifdef HAVE_STARTUP_NOTIFICATION | |
| 77 | # define SN_API_NOT_YET_FROZEN | |
| 78 | # include <libsn/sn-launchee.h> | |
| 79 | # include <gdk/gdkx.h> | |
| 80 | #endif | |
| 81 | ||
|
11055
e564996853bf
[gaim-migrate @ 12996]
Piotr Zielinski <zielaj@users.sourceforge.net>
parents:
11033
diff
changeset
|
82 | |
|
e564996853bf
[gaim-migrate @ 12996]
Piotr Zielinski <zielaj@users.sourceforge.net>
parents:
11033
diff
changeset
|
83 | |
| 10302 | 84 | #ifdef HAVE_STARTUP_NOTIFICATION |
| 85 | static SnLauncheeContext *sn_context = NULL; | |
| 86 | static SnDisplay *sn_display = NULL; | |
| 87 | #endif | |
| 88 | ||
|
13428
78687459c64b
[gaim-migrate @ 15802]
Daniel Atallah <datallah@pidgin.im>
parents:
13322
diff
changeset
|
89 | #ifdef HAVE_SIGNAL_H |
|
14542
7c1dd9601f1d
[gaim-migrate @ 17199]
Mark Doliner <markdoliner@pidgin.im>
parents:
14323
diff
changeset
|
90 | |
| 10302 | 91 | /* |
| 92 | * Lists of signals we wish to catch and those we wish to ignore. | |
| 93 | * Each list terminated with -1 | |
| 94 | */ | |
| 95 | static int catch_sig_list[] = { | |
| 96 | SIGSEGV, | |
| 97 | SIGHUP, | |
| 98 | SIGINT, | |
| 99 | SIGTERM, | |
| 100 | SIGQUIT, | |
| 101 | SIGCHLD, | |
| 14595 | 102 | SIGALRM, |
| 10302 | 103 | -1 |
| 104 | }; | |
| 105 | ||
| 106 | static int ignore_sig_list[] = { | |
| 107 | SIGPIPE, | |
| 108 | -1 | |
| 109 | }; | |
| 110 | #endif | |
| 111 | ||
|
17719
8070b1610abe
Make -l do something slightly more sane than it does now, even though it
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17105
diff
changeset
|
112 | static void |
|
10323
f4a013ac9e7c
[gaim-migrate @ 11530]
Mark Doliner <markdoliner@pidgin.im>
parents:
10322
diff
changeset
|
113 | dologin_named(const char *name) |
| 10302 | 114 | { |
| 15884 | 115 | PurpleAccount *account; |
|
10323
f4a013ac9e7c
[gaim-migrate @ 11530]
Mark Doliner <markdoliner@pidgin.im>
parents:
10322
diff
changeset
|
116 | char **names; |
|
f4a013ac9e7c
[gaim-migrate @ 11530]
Mark Doliner <markdoliner@pidgin.im>
parents:
10322
diff
changeset
|
117 | int i; |
| 10302 | 118 | |
|
10323
f4a013ac9e7c
[gaim-migrate @ 11530]
Mark Doliner <markdoliner@pidgin.im>
parents:
10322
diff
changeset
|
119 | if (name != NULL) { /* list of names given */ |
|
f4a013ac9e7c
[gaim-migrate @ 11530]
Mark Doliner <markdoliner@pidgin.im>
parents:
10322
diff
changeset
|
120 | names = g_strsplit(name, ",", 64); |
|
f4a013ac9e7c
[gaim-migrate @ 11530]
Mark Doliner <markdoliner@pidgin.im>
parents:
10322
diff
changeset
|
121 | for (i = 0; names[i] != NULL; i++) { |
| 15884 | 122 | account = purple_accounts_find(names[i], NULL); |
|
10323
f4a013ac9e7c
[gaim-migrate @ 11530]
Mark Doliner <markdoliner@pidgin.im>
parents:
10322
diff
changeset
|
123 | if (account != NULL) { /* found a user */ |
|
17719
8070b1610abe
Make -l do something slightly more sane than it does now, even though it
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17105
diff
changeset
|
124 | purple_account_set_enabled(account, PIDGIN_UI, TRUE); |
| 10302 | 125 | } |
| 126 | } | |
| 127 | g_strfreev(names); | |
|
10323
f4a013ac9e7c
[gaim-migrate @ 11530]
Mark Doliner <markdoliner@pidgin.im>
parents:
10322
diff
changeset
|
128 | } else { /* no name given, use the first account */ |
|
18122
9bf9970c1b6a
disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents:
18121
diff
changeset
|
129 | GList *accounts; |
|
11520
61d34ca357f2
[gaim-migrate @ 13765]
Mark Doliner <markdoliner@pidgin.im>
parents:
11475
diff
changeset
|
130 | |
| 15884 | 131 | accounts = purple_accounts_get_all(); |
|
11520
61d34ca357f2
[gaim-migrate @ 13765]
Mark Doliner <markdoliner@pidgin.im>
parents:
11475
diff
changeset
|
132 | if (accounts != NULL) |
|
61d34ca357f2
[gaim-migrate @ 13765]
Mark Doliner <markdoliner@pidgin.im>
parents:
11475
diff
changeset
|
133 | { |
| 15884 | 134 | account = (PurpleAccount *)accounts->data; |
|
17719
8070b1610abe
Make -l do something slightly more sane than it does now, even though it
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17105
diff
changeset
|
135 | purple_account_set_enabled(account, PIDGIN_UI, TRUE); |
|
11520
61d34ca357f2
[gaim-migrate @ 13765]
Mark Doliner <markdoliner@pidgin.im>
parents:
11475
diff
changeset
|
136 | } |
| 10302 | 137 | } |
| 138 | } | |
| 139 | ||
|
13428
78687459c64b
[gaim-migrate @ 15802]
Daniel Atallah <datallah@pidgin.im>
parents:
13322
diff
changeset
|
140 | #ifdef HAVE_SIGNAL_H |
|
14542
7c1dd9601f1d
[gaim-migrate @ 17199]
Mark Doliner <markdoliner@pidgin.im>
parents:
14323
diff
changeset
|
141 | static void sighandler(int sig); |
|
7c1dd9601f1d
[gaim-migrate @ 17199]
Mark Doliner <markdoliner@pidgin.im>
parents:
14323
diff
changeset
|
142 | |
|
7c1dd9601f1d
[gaim-migrate @ 17199]
Mark Doliner <markdoliner@pidgin.im>
parents:
14323
diff
changeset
|
143 | /** |
|
16437
7ff7c3405ea2
Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents:
16419
diff
changeset
|
144 | * Reap all our dead children. Sometimes libpurple forks off a separate |
|
14542
7c1dd9601f1d
[gaim-migrate @ 17199]
Mark Doliner <markdoliner@pidgin.im>
parents:
14323
diff
changeset
|
145 | * process to do some stuff. When that process exits we are |
|
7c1dd9601f1d
[gaim-migrate @ 17199]
Mark Doliner <markdoliner@pidgin.im>
parents:
14323
diff
changeset
|
146 | * informed about it so that we can call waitpid() and let it |
|
7c1dd9601f1d
[gaim-migrate @ 17199]
Mark Doliner <markdoliner@pidgin.im>
parents:
14323
diff
changeset
|
147 | * stop being a zombie. |
|
7c1dd9601f1d
[gaim-migrate @ 17199]
Mark Doliner <markdoliner@pidgin.im>
parents:
14323
diff
changeset
|
148 | * |
|
7c1dd9601f1d
[gaim-migrate @ 17199]
Mark Doliner <markdoliner@pidgin.im>
parents:
14323
diff
changeset
|
149 | * We used to do this immediately when our signal handler was |
|
7c1dd9601f1d
[gaim-migrate @ 17199]
Mark Doliner <markdoliner@pidgin.im>
parents:
14323
diff
changeset
|
150 | * called, but because of GStreamer we now wait one second before |
|
7c1dd9601f1d
[gaim-migrate @ 17199]
Mark Doliner <markdoliner@pidgin.im>
parents:
14323
diff
changeset
|
151 | * reaping anything. Why? For some reason GStreamer fork()s |
|
7c1dd9601f1d
[gaim-migrate @ 17199]
Mark Doliner <markdoliner@pidgin.im>
parents:
14323
diff
changeset
|
152 | * during their initialization process. I don't understand why... |
|
7c1dd9601f1d
[gaim-migrate @ 17199]
Mark Doliner <markdoliner@pidgin.im>
parents:
14323
diff
changeset
|
153 | * but they do it, and there's nothing we can do about it. |
|
7c1dd9601f1d
[gaim-migrate @ 17199]
Mark Doliner <markdoliner@pidgin.im>
parents:
14323
diff
changeset
|
154 | * |
|
7c1dd9601f1d
[gaim-migrate @ 17199]
Mark Doliner <markdoliner@pidgin.im>
parents:
14323
diff
changeset
|
155 | * Anyway, so then GStreamer waits for its child to die and then |
|
7c1dd9601f1d
[gaim-migrate @ 17199]
Mark Doliner <markdoliner@pidgin.im>
parents:
14323
diff
changeset
|
156 | * it continues with the initialization process. This means that |
|
7c1dd9601f1d
[gaim-migrate @ 17199]
Mark Doliner <markdoliner@pidgin.im>
parents:
14323
diff
changeset
|
157 | * we have a race condition where GStreamer is waitpid()ing for its |
|
7c1dd9601f1d
[gaim-migrate @ 17199]
Mark Doliner <markdoliner@pidgin.im>
parents:
14323
diff
changeset
|
158 | * child to die and we're catching the SIGCHLD signal. If GStreamer |
|
16437
7ff7c3405ea2
Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents:
16419
diff
changeset
|
159 | * is awarded the zombied process then everything is ok. But if libpurple |
|
14542
7c1dd9601f1d
[gaim-migrate @ 17199]
Mark Doliner <markdoliner@pidgin.im>
parents:
14323
diff
changeset
|
160 | * reaps the zombie process then the GStreamer initialization sequence |
|
7c1dd9601f1d
[gaim-migrate @ 17199]
Mark Doliner <markdoliner@pidgin.im>
parents:
14323
diff
changeset
|
161 | * fails. |
|
7c1dd9601f1d
[gaim-migrate @ 17199]
Mark Doliner <markdoliner@pidgin.im>
parents:
14323
diff
changeset
|
162 | * |
|
7c1dd9601f1d
[gaim-migrate @ 17199]
Mark Doliner <markdoliner@pidgin.im>
parents:
14323
diff
changeset
|
163 | * So the ugly solution is to wait a second to give GStreamer time to |
|
7c1dd9601f1d
[gaim-migrate @ 17199]
Mark Doliner <markdoliner@pidgin.im>
parents:
14323
diff
changeset
|
164 | * reap that bad boy. |
|
7c1dd9601f1d
[gaim-migrate @ 17199]
Mark Doliner <markdoliner@pidgin.im>
parents:
14323
diff
changeset
|
165 | * |
|
7c1dd9601f1d
[gaim-migrate @ 17199]
Mark Doliner <markdoliner@pidgin.im>
parents:
14323
diff
changeset
|
166 | * GStreamer 0.10.10 and newer have a gst_register_fork_set_enabled() |
|
7c1dd9601f1d
[gaim-migrate @ 17199]
Mark Doliner <markdoliner@pidgin.im>
parents:
14323
diff
changeset
|
167 | * function that can be called by applications to disable forking |
|
7c1dd9601f1d
[gaim-migrate @ 17199]
Mark Doliner <markdoliner@pidgin.im>
parents:
14323
diff
changeset
|
168 | * during initialization. But it's not in 0.10.0, so we shouldn't |
|
7c1dd9601f1d
[gaim-migrate @ 17199]
Mark Doliner <markdoliner@pidgin.im>
parents:
14323
diff
changeset
|
169 | * use it. |
| 15808 | 170 | * |
| 171 | * All of this child process reaping stuff is currently only used for | |
| 172 | * processes that were forked to play sounds. It's not needed for | |
| 173 | * forked DNS child, which have their own waitpid() call. It might | |
| 174 | * be wise to move this code into gtksound.c. | |
|
14542
7c1dd9601f1d
[gaim-migrate @ 17199]
Mark Doliner <markdoliner@pidgin.im>
parents:
14323
diff
changeset
|
175 | */ |
| 14595 | 176 | static void |
| 177 | clean_pid() | |
| 10302 | 178 | { |
| 179 | int status; | |
| 180 | pid_t pid; | |
| 181 | ||
| 182 | do { | |
| 183 | pid = waitpid(-1, &status, WNOHANG); | |
| 184 | } while (pid != 0 && pid != (pid_t)-1); | |
|
10334
11feb68437a8
[gaim-migrate @ 11541]
Mark Doliner <markdoliner@pidgin.im>
parents:
10333
diff
changeset
|
185 | |
|
11feb68437a8
[gaim-migrate @ 11541]
Mark Doliner <markdoliner@pidgin.im>
parents:
10333
diff
changeset
|
186 | if ((pid == (pid_t) - 1) && (errno != ECHILD)) { |
| 10302 | 187 | char errmsg[BUFSIZ]; |
| 188 | snprintf(errmsg, BUFSIZ, "Warning: waitpid() returned %d", pid); | |
| 189 | perror(errmsg); | |
| 190 | } | |
|
14542
7c1dd9601f1d
[gaim-migrate @ 17199]
Mark Doliner <markdoliner@pidgin.im>
parents:
14323
diff
changeset
|
191 | |
|
7c1dd9601f1d
[gaim-migrate @ 17199]
Mark Doliner <markdoliner@pidgin.im>
parents:
14323
diff
changeset
|
192 | /* Restore signal catching */ |
| 14595 | 193 | signal(SIGALRM, sighandler); |
| 10302 | 194 | } |
| 195 | ||
|
12556
f4d4e4e3a825
[gaim-migrate @ 14875]
Richard Laager <rlaager@pidgin.im>
parents:
12409
diff
changeset
|
196 | char *segfault_message; |
|
f4d4e4e3a825
[gaim-migrate @ 14875]
Richard Laager <rlaager@pidgin.im>
parents:
12409
diff
changeset
|
197 | |
|
10871
c0282a4f2250
[gaim-migrate @ 12558]
Mark Doliner <markdoliner@pidgin.im>
parents:
10819
diff
changeset
|
198 | static void |
|
10323
f4a013ac9e7c
[gaim-migrate @ 11530]
Mark Doliner <markdoliner@pidgin.im>
parents:
10322
diff
changeset
|
199 | sighandler(int sig) |
| 10302 | 200 | { |
| 201 | switch (sig) { | |
| 202 | case SIGHUP: | |
| 15884 | 203 | purple_debug_warning("sighandler", "Caught signal %d\n", sig); |
| 204 | purple_connections_disconnect_all(); | |
| 10302 | 205 | break; |
| 206 | case SIGSEGV: | |
|
13215
c3e72e316531
[gaim-migrate @ 15578]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13111
diff
changeset
|
207 | fprintf(stderr, "%s", segfault_message); |
| 10302 | 208 | abort(); |
| 209 | break; | |
| 210 | case SIGCHLD: | |
| 14595 | 211 | /* Restore signal catching */ |
| 212 | signal(SIGCHLD, sighandler); | |
| 213 | alarm(1); | |
| 214 | break; | |
| 215 | case SIGALRM: | |
| 216 | clean_pid(); | |
| 10302 | 217 | break; |
| 218 | default: | |
| 15884 | 219 | purple_debug_warning("sighandler", "Caught signal %d\n", sig); |
| 220 | purple_connections_disconnect_all(); | |
| 10302 | 221 | |
| 15884 | 222 | purple_plugins_unload_all(); |
| 10302 | 223 | |
| 224 | if (gtk_main_level()) | |
| 225 | gtk_main_quit(); | |
| 226 | exit(0); | |
| 227 | } | |
| 228 | } | |
| 229 | #endif | |
| 230 | ||
|
10323
f4a013ac9e7c
[gaim-migrate @ 11530]
Mark Doliner <markdoliner@pidgin.im>
parents:
10322
diff
changeset
|
231 | static int |
|
f4a013ac9e7c
[gaim-migrate @ 11530]
Mark Doliner <markdoliner@pidgin.im>
parents:
10322
diff
changeset
|
232 | ui_main() |
| 10302 | 233 | { |
| 234 | #ifndef _WIN32 | |
| 235 | GList *icons = NULL; | |
| 236 | GdkPixbuf *icon = NULL; | |
| 237 | char *icon_path; | |
|
16052
d53fc4f13ff3
new icon goodness (i may have screwed this up, someone check)
Nathan Walp <nwalp@pidgin.im>
parents:
15931
diff
changeset
|
238 | int i; |
|
16504
ae9a01ab4db3
Add the SVG to the default window icon list for really big window icons
Sean Egan <seanegan@pidgin.im>
parents:
16499
diff
changeset
|
239 | struct { |
|
ae9a01ab4db3
Add the SVG to the default window icon list for really big window icons
Sean Egan <seanegan@pidgin.im>
parents:
16499
diff
changeset
|
240 | const char *dir; |
|
ae9a01ab4db3
Add the SVG to the default window icon list for really big window icons
Sean Egan <seanegan@pidgin.im>
parents:
16499
diff
changeset
|
241 | const char *filename; |
|
ae9a01ab4db3
Add the SVG to the default window icon list for really big window icons
Sean Egan <seanegan@pidgin.im>
parents:
16499
diff
changeset
|
242 | } icon_sizes[] = { |
|
ae9a01ab4db3
Add the SVG to the default window icon list for really big window icons
Sean Egan <seanegan@pidgin.im>
parents:
16499
diff
changeset
|
243 | {"16x16", "pidgin.png"}, |
|
ae9a01ab4db3
Add the SVG to the default window icon list for really big window icons
Sean Egan <seanegan@pidgin.im>
parents:
16499
diff
changeset
|
244 | {"24x24", "pidgin.png"}, |
|
ae9a01ab4db3
Add the SVG to the default window icon list for really big window icons
Sean Egan <seanegan@pidgin.im>
parents:
16499
diff
changeset
|
245 | {"32x32", "pidgin.png"}, |
|
ae9a01ab4db3
Add the SVG to the default window icon list for really big window icons
Sean Egan <seanegan@pidgin.im>
parents:
16499
diff
changeset
|
246 | {"48x48", "pidgin.png"}, |
|
ae9a01ab4db3
Add the SVG to the default window icon list for really big window icons
Sean Egan <seanegan@pidgin.im>
parents:
16499
diff
changeset
|
247 | {"scalable", "pidgin.svg"} |
|
16052
d53fc4f13ff3
new icon goodness (i may have screwed this up, someone check)
Nathan Walp <nwalp@pidgin.im>
parents:
15931
diff
changeset
|
248 | }; |
|
d53fc4f13ff3
new icon goodness (i may have screwed this up, someone check)
Nathan Walp <nwalp@pidgin.im>
parents:
15931
diff
changeset
|
249 | |
| 10302 | 250 | #endif |
| 251 | ||
|
16263
27e0ef0f38e6
Word on the street is that we don't want things named pidginfoo_bar(), but
Richard Laager <rlaager@pidgin.im>
parents:
16193
diff
changeset
|
252 | pidgin_themes_init(); |
| 10302 | 253 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15498
diff
changeset
|
254 | pidgin_blist_setup_sort_methods(); |
| 10302 | 255 | |
| 256 | #ifndef _WIN32 | |
| 257 | /* use the nice PNG icon for all the windows */ | |
|
16052
d53fc4f13ff3
new icon goodness (i may have screwed this up, someone check)
Nathan Walp <nwalp@pidgin.im>
parents:
15931
diff
changeset
|
258 | for(i=0; i<G_N_ELEMENTS(icon_sizes); i++) { |
|
16504
ae9a01ab4db3
Add the SVG to the default window icon list for really big window icons
Sean Egan <seanegan@pidgin.im>
parents:
16499
diff
changeset
|
259 | icon_path = g_build_filename(DATADIR, "icons", "hicolor", icon_sizes[i].dir, "apps", icon_sizes[i].filename, NULL); |
|
16052
d53fc4f13ff3
new icon goodness (i may have screwed this up, someone check)
Nathan Walp <nwalp@pidgin.im>
parents:
15931
diff
changeset
|
260 | icon = gdk_pixbuf_new_from_file(icon_path, NULL); |
|
d53fc4f13ff3
new icon goodness (i may have screwed this up, someone check)
Nathan Walp <nwalp@pidgin.im>
parents:
15931
diff
changeset
|
261 | g_free(icon_path); |
|
d53fc4f13ff3
new icon goodness (i may have screwed this up, someone check)
Nathan Walp <nwalp@pidgin.im>
parents:
15931
diff
changeset
|
262 | if (icon) { |
|
d53fc4f13ff3
new icon goodness (i may have screwed this up, someone check)
Nathan Walp <nwalp@pidgin.im>
parents:
15931
diff
changeset
|
263 | icons = g_list_append(icons,icon); |
|
d53fc4f13ff3
new icon goodness (i may have screwed this up, someone check)
Nathan Walp <nwalp@pidgin.im>
parents:
15931
diff
changeset
|
264 | } else { |
|
d53fc4f13ff3
new icon goodness (i may have screwed this up, someone check)
Nathan Walp <nwalp@pidgin.im>
parents:
15931
diff
changeset
|
265 | purple_debug_error("ui_main", |
|
d53fc4f13ff3
new icon goodness (i may have screwed this up, someone check)
Nathan Walp <nwalp@pidgin.im>
parents:
15931
diff
changeset
|
266 | "Failed to load the default window icon (%spx version)!\n", icon_sizes[i]); |
|
d53fc4f13ff3
new icon goodness (i may have screwed this up, someone check)
Nathan Walp <nwalp@pidgin.im>
parents:
15931
diff
changeset
|
267 | } |
|
d53fc4f13ff3
new icon goodness (i may have screwed this up, someone check)
Nathan Walp <nwalp@pidgin.im>
parents:
15931
diff
changeset
|
268 | } |
|
d53fc4f13ff3
new icon goodness (i may have screwed this up, someone check)
Nathan Walp <nwalp@pidgin.im>
parents:
15931
diff
changeset
|
269 | if(NULL == icons) { |
|
d53fc4f13ff3
new icon goodness (i may have screwed this up, someone check)
Nathan Walp <nwalp@pidgin.im>
parents:
15931
diff
changeset
|
270 | purple_debug_error("ui_main", "Unable to load any size of default window icon!\n"); |
|
d53fc4f13ff3
new icon goodness (i may have screwed this up, someone check)
Nathan Walp <nwalp@pidgin.im>
parents:
15931
diff
changeset
|
271 | } else { |
| 10302 | 272 | gtk_window_set_default_icon_list(icons); |
|
16052
d53fc4f13ff3
new icon goodness (i may have screwed this up, someone check)
Nathan Walp <nwalp@pidgin.im>
parents:
15931
diff
changeset
|
273 | |
|
d53fc4f13ff3
new icon goodness (i may have screwed this up, someone check)
Nathan Walp <nwalp@pidgin.im>
parents:
15931
diff
changeset
|
274 | g_list_foreach(icons, (GFunc)g_object_unref, NULL); |
| 10302 | 275 | g_list_free(icons); |
| 276 | } | |
| 277 | #endif | |
| 278 | ||
| 279 | return 0; | |
| 280 | } | |
| 281 | ||
| 282 | static void | |
| 283 | debug_init(void) | |
| 284 | { | |
| 15884 | 285 | purple_debug_set_ui_ops(pidgin_debug_get_ui_ops()); |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15498
diff
changeset
|
286 | pidgin_debug_init(); |
| 10302 | 287 | } |
| 288 | ||
| 289 | static void | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15498
diff
changeset
|
290 | pidgin_ui_init(void) |
| 10302 | 291 | { |
| 292 | /* Set the UI operation structures. */ | |
| 15884 | 293 | purple_accounts_set_ui_ops(pidgin_accounts_get_ui_ops()); |
| 294 | purple_xfers_set_ui_ops(pidgin_xfers_get_ui_ops()); | |
| 295 | purple_blist_set_ui_ops(pidgin_blist_get_ui_ops()); | |
| 296 | purple_notify_set_ui_ops(pidgin_notify_get_ui_ops()); | |
| 297 | purple_privacy_set_ui_ops(pidgin_privacy_get_ui_ops()); | |
| 298 | purple_request_set_ui_ops(pidgin_request_get_ui_ops()); | |
| 299 | purple_sound_set_ui_ops(pidgin_sound_get_ui_ops()); | |
| 300 | purple_connections_set_ui_ops(pidgin_connections_get_ui_ops()); | |
| 301 | purple_whiteboard_set_ui_ops(pidgin_whiteboard_get_ui_ops()); | |
|
12272
4eee92ead973
[gaim-migrate @ 14574]
Mark Doliner <markdoliner@pidgin.im>
parents:
12246
diff
changeset
|
302 | #ifdef USE_SCREENSAVER |
| 15884 | 303 | purple_idle_set_ui_ops(pidgin_idle_get_ui_ops()); |
|
12272
4eee92ead973
[gaim-migrate @ 14574]
Mark Doliner <markdoliner@pidgin.im>
parents:
12246
diff
changeset
|
304 | #endif |
| 10302 | 305 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15498
diff
changeset
|
306 | pidgin_stock_init(); |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15498
diff
changeset
|
307 | pidgin_account_init(); |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15498
diff
changeset
|
308 | pidgin_connection_init(); |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15498
diff
changeset
|
309 | pidgin_blist_init(); |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15498
diff
changeset
|
310 | pidgin_status_init(); |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15498
diff
changeset
|
311 | pidgin_conversations_init(); |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15498
diff
changeset
|
312 | pidgin_pounces_init(); |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15498
diff
changeset
|
313 | pidgin_privacy_init(); |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15498
diff
changeset
|
314 | pidgin_xfers_init(); |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15498
diff
changeset
|
315 | pidgin_roomlist_init(); |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15498
diff
changeset
|
316 | pidgin_log_init(); |
|
16796
1397249dcde1
Initialize docklet from pidgin_ui_init. This ensures docklet prefs are
Casey Harkins <charkins@pidgin.im>
parents:
16763
diff
changeset
|
317 | pidgin_docklet_init(); |
| 10302 | 318 | } |
| 319 | ||
|
18442
99c6a0271b1d
UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents:
18256
diff
changeset
|
320 | static GHashTable *ui_info = NULL; |
|
99c6a0271b1d
UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents:
18256
diff
changeset
|
321 | |
| 10302 | 322 | static void |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15498
diff
changeset
|
323 | pidgin_quit(void) |
| 10302 | 324 | { |
| 325 | #ifdef USE_SM | |
| 326 | /* unplug */ | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15498
diff
changeset
|
327 | pidgin_session_end(); |
| 10302 | 328 | #endif |
| 329 | ||
| 330 | /* Save the plugins we have loaded for next time. */ | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15498
diff
changeset
|
331 | pidgin_plugins_save(); |
| 10302 | 332 | |
|
10574
5abb2931b6ff
[gaim-migrate @ 11966]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10448
diff
changeset
|
333 | /* Uninit */ |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15498
diff
changeset
|
334 | pidgin_conversations_uninit(); |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15498
diff
changeset
|
335 | pidgin_status_uninit(); |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15498
diff
changeset
|
336 | pidgin_docklet_uninit(); |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15498
diff
changeset
|
337 | pidgin_blist_uninit(); |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15498
diff
changeset
|
338 | pidgin_connection_uninit(); |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15498
diff
changeset
|
339 | pidgin_account_uninit(); |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15498
diff
changeset
|
340 | pidgin_xfers_uninit(); |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15498
diff
changeset
|
341 | pidgin_debug_uninit(); |
|
10574
5abb2931b6ff
[gaim-migrate @ 11966]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10448
diff
changeset
|
342 | |
|
18442
99c6a0271b1d
UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents:
18256
diff
changeset
|
343 | if(NULL != ui_info) |
|
99c6a0271b1d
UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents:
18256
diff
changeset
|
344 | g_hash_table_destroy(ui_info); |
|
99c6a0271b1d
UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents:
18256
diff
changeset
|
345 | |
| 10302 | 346 | /* and end it all... */ |
| 347 | gtk_main_quit(); | |
| 348 | } | |
| 349 | ||
|
18442
99c6a0271b1d
UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents:
18256
diff
changeset
|
350 | static GHashTable *pidgin_ui_get_info() |
|
99c6a0271b1d
UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents:
18256
diff
changeset
|
351 | { |
|
99c6a0271b1d
UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents:
18256
diff
changeset
|
352 | if(NULL == ui_info) { |
|
99c6a0271b1d
UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents:
18256
diff
changeset
|
353 | ui_info = g_hash_table_new(g_str_hash, g_str_equal); |
|
99c6a0271b1d
UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents:
18256
diff
changeset
|
354 | |
|
99c6a0271b1d
UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents:
18256
diff
changeset
|
355 | g_hash_table_insert(ui_info, "name", (char*)PIDGIN_NAME); |
|
99c6a0271b1d
UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents:
18256
diff
changeset
|
356 | g_hash_table_insert(ui_info, "version", VERSION); |
|
99c6a0271b1d
UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents:
18256
diff
changeset
|
357 | } |
|
99c6a0271b1d
UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents:
18256
diff
changeset
|
358 | |
|
99c6a0271b1d
UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents:
18256
diff
changeset
|
359 | return ui_info; |
|
99c6a0271b1d
UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents:
18256
diff
changeset
|
360 | } |
|
99c6a0271b1d
UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents:
18256
diff
changeset
|
361 | |
| 15884 | 362 | static PurpleCoreUiOps core_ops = |
| 10302 | 363 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15498
diff
changeset
|
364 | pidgin_prefs_init, |
| 10302 | 365 | debug_init, |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15498
diff
changeset
|
366 | pidgin_ui_init, |
|
16752
e6bcb1628c57
Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
16545
diff
changeset
|
367 | pidgin_quit, |
|
18442
99c6a0271b1d
UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents:
18256
diff
changeset
|
368 | pidgin_ui_get_info, |
|
16752
e6bcb1628c57
Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
16545
diff
changeset
|
369 | NULL, |
|
e6bcb1628c57
Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
16545
diff
changeset
|
370 | NULL, |
|
e6bcb1628c57
Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
16545
diff
changeset
|
371 | NULL |
| 10302 | 372 | }; |
| 373 | ||
| 15884 | 374 | static PurpleCoreUiOps * |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15498
diff
changeset
|
375 | pidgin_core_get_ui_ops(void) |
| 10302 | 376 | { |
| 377 | return &core_ops; | |
| 378 | } | |
| 379 | ||
| 380 | static void | |
|
10320
f5b0f5cf8562
[gaim-migrate @ 11527]
Mark Doliner <markdoliner@pidgin.im>
parents:
10317
diff
changeset
|
381 | show_usage(const char *name, gboolean terse) |
| 10302 | 382 | { |
|
10320
f5b0f5cf8562
[gaim-migrate @ 11527]
Mark Doliner <markdoliner@pidgin.im>
parents:
10317
diff
changeset
|
383 | char *text; |
|
12846
93ff2d8dd1e7
[gaim-migrate @ 15194]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
12838
diff
changeset
|
384 | |
|
10320
f5b0f5cf8562
[gaim-migrate @ 11527]
Mark Doliner <markdoliner@pidgin.im>
parents:
10317
diff
changeset
|
385 | if (terse) { |
|
16071
044392e01c96
make things cleaner for translators
Nathan Walp <nwalp@pidgin.im>
parents:
16052
diff
changeset
|
386 | text = g_strdup_printf(_("%s %s. Try `%s -h' for more information.\n"), PIDGIN_NAME, VERSION, name); |
|
10320
f5b0f5cf8562
[gaim-migrate @ 11527]
Mark Doliner <markdoliner@pidgin.im>
parents:
10317
diff
changeset
|
387 | } else { |
|
16071
044392e01c96
make things cleaner for translators
Nathan Walp <nwalp@pidgin.im>
parents:
16052
diff
changeset
|
388 | text = g_strdup_printf(_("%s %s\n" |
| 10302 | 389 | "Usage: %s [OPTION]...\n\n" |
| 390 | " -c, --config=DIR use DIR for config files\n" | |
| 391 | " -d, --debug print debugging messages to stdout\n" | |
|
10320
f5b0f5cf8562
[gaim-migrate @ 11527]
Mark Doliner <markdoliner@pidgin.im>
parents:
10317
diff
changeset
|
392 | " -h, --help display this help and exit\n" |
|
18208
a27936adb5ca
1. Show the usage of -m in the help message.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18207
diff
changeset
|
393 | " -m, --multiple do not ensure single instance\n" |
|
10323
f4a013ac9e7c
[gaim-migrate @ 11530]
Mark Doliner <markdoliner@pidgin.im>
parents:
10322
diff
changeset
|
394 | " -n, --nologin don't automatically login\n" |
|
10320
f5b0f5cf8562
[gaim-migrate @ 11527]
Mark Doliner <markdoliner@pidgin.im>
parents:
10317
diff
changeset
|
395 | " -l, --login[=NAME] automatically login (optional argument NAME specifies\n" |
|
11673
6171cf0386a5
[gaim-migrate @ 13959]
Michael Carlson <corfe83@users.sourceforge.net>
parents:
11581
diff
changeset
|
396 | " account(s) to use, separated by commas)\n" |
|
20346
06c3e9cfdc27
Accept --display as an argument, to be passed to Gtk+.
Ethan Blanton <elb@pidgin.im>
parents:
19859
diff
changeset
|
397 | #ifndef WIN32 |
|
06c3e9cfdc27
Accept --display as an argument, to be passed to Gtk+.
Ethan Blanton <elb@pidgin.im>
parents:
19859
diff
changeset
|
398 | " --display=DISPLAY X display to use\n" |
|
06c3e9cfdc27
Accept --display as an argument, to be passed to Gtk+.
Ethan Blanton <elb@pidgin.im>
parents:
19859
diff
changeset
|
399 | #endif |
|
16071
044392e01c96
make things cleaner for translators
Nathan Walp <nwalp@pidgin.im>
parents:
16052
diff
changeset
|
400 | " -v, --version display the current version and exit\n"), PIDGIN_NAME, VERSION, name); |
| 10302 | 401 | } |
| 402 | ||
| 15884 | 403 | purple_print_utf8_to_console(stdout, text); |
|
10320
f5b0f5cf8562
[gaim-migrate @ 11527]
Mark Doliner <markdoliner@pidgin.im>
parents:
10317
diff
changeset
|
404 | g_free(text); |
| 10302 | 405 | } |
| 406 | ||
| 407 | #ifdef HAVE_STARTUP_NOTIFICATION | |
| 408 | static void | |
| 409 | sn_error_trap_push(SnDisplay *display, Display *xdisplay) | |
| 410 | { | |
| 411 | gdk_error_trap_push(); | |
| 412 | } | |
| 413 | ||
| 414 | static void | |
| 415 | sn_error_trap_pop(SnDisplay *display, Display *xdisplay) | |
| 416 | { | |
| 417 | gdk_error_trap_pop(); | |
| 418 | } | |
| 419 | ||
| 420 | static void | |
| 421 | startup_notification_complete(void) | |
| 422 | { | |
| 423 | Display *xdisplay; | |
| 424 | ||
| 425 | xdisplay = GDK_DISPLAY(); | |
| 426 | sn_display = sn_display_new(xdisplay, | |
| 427 | sn_error_trap_push, | |
| 428 | sn_error_trap_pop); | |
| 429 | sn_context = | |
| 430 | sn_launchee_context_new_from_environment(sn_display, | |
| 431 | DefaultScreen(xdisplay)); | |
| 432 | ||
| 433 | if (sn_context != NULL) | |
| 434 | { | |
| 435 | sn_launchee_context_complete(sn_context); | |
| 436 | sn_launchee_context_unref(sn_context); | |
| 437 | ||
| 438 | sn_display_unref(sn_display); | |
| 439 | } | |
| 440 | } | |
| 441 | #endif /* HAVE_STARTUP_NOTIFICATION */ | |
| 442 | ||
| 443 | /* FUCKING GET ME A TOWEL! */ | |
| 444 | #ifdef _WIN32 | |
|
15697
78ddac185d80
winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents:
15578
diff
changeset
|
445 | /* suppress gcc "no previous prototype" warning */ |
|
78ddac185d80
winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents:
15578
diff
changeset
|
446 | int pidgin_main(HINSTANCE hint, int argc, char *argv[]); |
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15567
diff
changeset
|
447 | int pidgin_main(HINSTANCE hint, int argc, char *argv[]) |
| 10302 | 448 | #else |
| 449 | int main(int argc, char *argv[]) | |
| 450 | #endif | |
| 451 | { | |
|
10323
f4a013ac9e7c
[gaim-migrate @ 11530]
Mark Doliner <markdoliner@pidgin.im>
parents:
10322
diff
changeset
|
452 | gboolean opt_help = FALSE; |
|
f4a013ac9e7c
[gaim-migrate @ 11530]
Mark Doliner <markdoliner@pidgin.im>
parents:
10322
diff
changeset
|
453 | gboolean opt_login = FALSE; |
|
f4a013ac9e7c
[gaim-migrate @ 11530]
Mark Doliner <markdoliner@pidgin.im>
parents:
10322
diff
changeset
|
454 | gboolean opt_nologin = FALSE; |
|
f4a013ac9e7c
[gaim-migrate @ 11530]
Mark Doliner <markdoliner@pidgin.im>
parents:
10322
diff
changeset
|
455 | gboolean opt_version = FALSE; |
|
18207
e89bf4430ea6
Allow disabling check for single instance.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18191
diff
changeset
|
456 | gboolean opt_si = TRUE; /* Check for single instance? */ |
|
10323
f4a013ac9e7c
[gaim-migrate @ 11530]
Mark Doliner <markdoliner@pidgin.im>
parents:
10322
diff
changeset
|
457 | char *opt_config_dir_arg = NULL; |
|
f4a013ac9e7c
[gaim-migrate @ 11530]
Mark Doliner <markdoliner@pidgin.im>
parents:
10322
diff
changeset
|
458 | char *opt_login_arg = NULL; |
|
f4a013ac9e7c
[gaim-migrate @ 11530]
Mark Doliner <markdoliner@pidgin.im>
parents:
10322
diff
changeset
|
459 | char *opt_session_arg = NULL; |
|
10447
887380ec66f5
[gaim-migrate @ 11712]
Mark Doliner <markdoliner@pidgin.im>
parents:
10433
diff
changeset
|
460 | char *search_path; |
|
18122
9bf9970c1b6a
disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents:
18121
diff
changeset
|
461 | GList *accounts; |
|
13428
78687459c64b
[gaim-migrate @ 15802]
Daniel Atallah <datallah@pidgin.im>
parents:
13322
diff
changeset
|
462 | #ifdef HAVE_SIGNAL_H |
| 10302 | 463 | int sig_indx; /* for setting up signal catching */ |
| 464 | sigset_t sigset; | |
|
12409
d89ccce310aa
[gaim-migrate @ 14716]
Richard Laager <rlaager@pidgin.im>
parents:
12342
diff
changeset
|
465 | RETSIGTYPE (*prev_sig_disp)(int); |
|
10323
f4a013ac9e7c
[gaim-migrate @ 11530]
Mark Doliner <markdoliner@pidgin.im>
parents:
10322
diff
changeset
|
466 | char errmsg[BUFSIZ]; |
|
13215
c3e72e316531
[gaim-migrate @ 15578]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13111
diff
changeset
|
467 | #ifndef DEBUG |
|
c3e72e316531
[gaim-migrate @ 15578]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13111
diff
changeset
|
468 | char *segfault_message_tmp; |
|
c3e72e316531
[gaim-migrate @ 15578]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13111
diff
changeset
|
469 | GError *error = NULL; |
|
c3e72e316531
[gaim-migrate @ 15578]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13111
diff
changeset
|
470 | #endif |
|
10334
11feb68437a8
[gaim-migrate @ 11541]
Mark Doliner <markdoliner@pidgin.im>
parents:
10333
diff
changeset
|
471 | #endif |
|
14636
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14623
diff
changeset
|
472 | int opt; |
|
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14623
diff
changeset
|
473 | gboolean gui_check; |
|
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14623
diff
changeset
|
474 | gboolean debug_enabled; |
|
16419
8a5a3e2cd3a7
Call the core migrate code.
Richard Laager <rlaager@pidgin.im>
parents:
16263
diff
changeset
|
475 | gboolean migration_failed = FALSE; |
|
18121
2d8ea56b9097
Mark the return type const for the following functions. I noticed this
Richard Laager <rlaager@pidgin.im>
parents:
18093
diff
changeset
|
476 | GList *active_accounts; |
| 10302 | 477 | |
| 478 | struct option long_options[] = { | |
|
10323
f4a013ac9e7c
[gaim-migrate @ 11530]
Mark Doliner <markdoliner@pidgin.im>
parents:
10322
diff
changeset
|
479 | {"config", required_argument, NULL, 'c'}, |
|
f4a013ac9e7c
[gaim-migrate @ 11530]
Mark Doliner <markdoliner@pidgin.im>
parents:
10322
diff
changeset
|
480 | {"debug", no_argument, NULL, 'd'}, |
|
f4a013ac9e7c
[gaim-migrate @ 11530]
Mark Doliner <markdoliner@pidgin.im>
parents:
10322
diff
changeset
|
481 | {"help", no_argument, NULL, 'h'}, |
|
f4a013ac9e7c
[gaim-migrate @ 11530]
Mark Doliner <markdoliner@pidgin.im>
parents:
10322
diff
changeset
|
482 | {"login", optional_argument, NULL, 'l'}, |
|
18208
a27936adb5ca
1. Show the usage of -m in the help message.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18207
diff
changeset
|
483 | {"multiple", no_argument, NULL, 'm'}, |
|
10323
f4a013ac9e7c
[gaim-migrate @ 11530]
Mark Doliner <markdoliner@pidgin.im>
parents:
10322
diff
changeset
|
484 | {"nologin", no_argument, NULL, 'n'}, |
|
f4a013ac9e7c
[gaim-migrate @ 11530]
Mark Doliner <markdoliner@pidgin.im>
parents:
10322
diff
changeset
|
485 | {"session", required_argument, NULL, 's'}, |
|
f4a013ac9e7c
[gaim-migrate @ 11530]
Mark Doliner <markdoliner@pidgin.im>
parents:
10322
diff
changeset
|
486 | {"version", no_argument, NULL, 'v'}, |
|
20346
06c3e9cfdc27
Accept --display as an argument, to be passed to Gtk+.
Ethan Blanton <elb@pidgin.im>
parents:
19859
diff
changeset
|
487 | {"display", required_argument, NULL, 'D'}, |
| 10302 | 488 | {0, 0, 0, 0} |
| 489 | }; | |
| 490 | ||
| 491 | #ifdef DEBUG | |
|
10307
f3ba80364053
[gaim-migrate @ 11497]
Mark Doliner <markdoliner@pidgin.im>
parents:
10306
diff
changeset
|
492 | debug_enabled = TRUE; |
|
f3ba80364053
[gaim-migrate @ 11497]
Mark Doliner <markdoliner@pidgin.im>
parents:
10306
diff
changeset
|
493 | #else |
|
f3ba80364053
[gaim-migrate @ 11497]
Mark Doliner <markdoliner@pidgin.im>
parents:
10306
diff
changeset
|
494 | debug_enabled = FALSE; |
| 10302 | 495 | #endif |
|
17105
c0a8e07ee507
disapproval of revision 'd3231850edf096c5afacfab40b53717b34098355'
Sean Egan <seanegan@pidgin.im>
parents:
17104
diff
changeset
|
496 | |
|
c0a8e07ee507
disapproval of revision 'd3231850edf096c5afacfab40b53717b34098355'
Sean Egan <seanegan@pidgin.im>
parents:
17104
diff
changeset
|
497 | /* This is the first Glib function call. Make sure to initialize GThread bfeore then */ |
|
c0a8e07ee507
disapproval of revision 'd3231850edf096c5afacfab40b53717b34098355'
Sean Egan <seanegan@pidgin.im>
parents:
17104
diff
changeset
|
498 | g_thread_init(NULL); |
|
18232
2b0a1d552f56
Use g_set_application_name() so unnamed dialogs get given a name, my
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
18208
diff
changeset
|
499 | |
| 10302 | 500 | #ifdef ENABLE_NLS |
| 501 | bindtextdomain(PACKAGE, LOCALEDIR); | |
| 502 | bind_textdomain_codeset(PACKAGE, "UTF-8"); | |
| 503 | textdomain(PACKAGE); | |
| 504 | #endif | |
| 505 | ||
|
13090
aee4ed853ff3
[gaim-migrate @ 15451]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13024
diff
changeset
|
506 | #ifdef HAVE_SETLOCALE |
|
aee4ed853ff3
[gaim-migrate @ 15451]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13024
diff
changeset
|
507 | /* Locale initialization is not complete here. See gtk_init_check() */ |
|
aee4ed853ff3
[gaim-migrate @ 15451]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13024
diff
changeset
|
508 | setlocale(LC_ALL, ""); |
|
aee4ed853ff3
[gaim-migrate @ 15451]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13024
diff
changeset
|
509 | #endif |
|
11080
0578003800d0
[gaim-migrate @ 13092]
Piotr Zielinski <zielaj@users.sourceforge.net>
parents:
11067
diff
changeset
|
510 | |
|
13428
78687459c64b
[gaim-migrate @ 15802]
Daniel Atallah <datallah@pidgin.im>
parents:
13322
diff
changeset
|
511 | #ifdef HAVE_SIGNAL_H |
|
12556
f4d4e4e3a825
[gaim-migrate @ 14875]
Richard Laager <rlaager@pidgin.im>
parents:
12409
diff
changeset
|
512 | |
|
f4d4e4e3a825
[gaim-migrate @ 14875]
Richard Laager <rlaager@pidgin.im>
parents:
12409
diff
changeset
|
513 | #ifndef DEBUG |
|
f4d4e4e3a825
[gaim-migrate @ 14875]
Richard Laager <rlaager@pidgin.im>
parents:
12409
diff
changeset
|
514 | /* We translate this here in case the crash breaks gettext. */ |
|
13215
c3e72e316531
[gaim-migrate @ 15578]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13111
diff
changeset
|
515 | segfault_message_tmp = g_strdup_printf(_( |
|
16071
044392e01c96
make things cleaner for translators
Nathan Walp <nwalp@pidgin.im>
parents:
16052
diff
changeset
|
516 | "%s has segfaulted and attempted to dump a core file.\n" |
|
12556
f4d4e4e3a825
[gaim-migrate @ 14875]
Richard Laager <rlaager@pidgin.im>
parents:
12409
diff
changeset
|
517 | "This is a bug in the software and has happened through\n" |
|
f4d4e4e3a825
[gaim-migrate @ 14875]
Richard Laager <rlaager@pidgin.im>
parents:
12409
diff
changeset
|
518 | "no fault of your own.\n\n" |
|
16977
c9cb49bea66d
Change the PIDGIN_NAME stuff to allow translators to transliterate the
Richard Laager <rlaager@pidgin.im>
parents:
16967
diff
changeset
|
519 | "If you can reproduce the crash, please notify the developers\n" |
|
c9cb49bea66d
Change the PIDGIN_NAME stuff to allow translators to transliterate the
Richard Laager <rlaager@pidgin.im>
parents:
16967
diff
changeset
|
520 | "by reporting a bug at:\n" |
|
18256
63c91e6c806e
I believe the great unwashed should be using simpleticket for submitting
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
18232
diff
changeset
|
521 | "%ssimpleticket/\n\n" |
|
12556
f4d4e4e3a825
[gaim-migrate @ 14875]
Richard Laager <rlaager@pidgin.im>
parents:
12409
diff
changeset
|
522 | "Please make sure to specify what you were doing at the time\n" |
|
f4d4e4e3a825
[gaim-migrate @ 14875]
Richard Laager <rlaager@pidgin.im>
parents:
12409
diff
changeset
|
523 | "and post the backtrace from the core file. If you do not know\n" |
|
f4d4e4e3a825
[gaim-migrate @ 14875]
Richard Laager <rlaager@pidgin.im>
parents:
12409
diff
changeset
|
524 | "how to get the backtrace, please read the instructions at\n" |
| 16967 | 525 | "%swiki/GetABacktrace\n\n" |
|
13215
c3e72e316531
[gaim-migrate @ 15578]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13111
diff
changeset
|
526 | "If you need further assistance, please IM either SeanEgn or \n" |
|
c3e72e316531
[gaim-migrate @ 15578]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13111
diff
changeset
|
527 | "LSchiere (via AIM). Contact information for Sean and Luke \n" |
|
c3e72e316531
[gaim-migrate @ 15578]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13111
diff
changeset
|
528 | "on other protocols is at\n" |
| 16967 | 529 | "%swiki/DeveloperPages\n"), |
| 530 | PIDGIN_NAME, PURPLE_DEVEL_WEBSITE, PURPLE_DEVEL_WEBSITE, PURPLE_DEVEL_WEBSITE | |
|
13090
aee4ed853ff3
[gaim-migrate @ 15451]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13024
diff
changeset
|
531 | ); |
|
13587
fb0245a7ccab
[gaim-migrate @ 15971]
Daniel Atallah <datallah@pidgin.im>
parents:
13429
diff
changeset
|
532 | |
|
13215
c3e72e316531
[gaim-migrate @ 15578]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13111
diff
changeset
|
533 | /* we have to convert the message (UTF-8 to console |
|
c3e72e316531
[gaim-migrate @ 15578]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13111
diff
changeset
|
534 | charset) early because after a segmentation fault |
|
c3e72e316531
[gaim-migrate @ 15578]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13111
diff
changeset
|
535 | it's not a good practice to allocate memory */ |
|
13587
fb0245a7ccab
[gaim-migrate @ 15971]
Daniel Atallah <datallah@pidgin.im>
parents:
13429
diff
changeset
|
536 | segfault_message = g_locale_from_utf8(segfault_message_tmp, |
|
13215
c3e72e316531
[gaim-migrate @ 15578]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13111
diff
changeset
|
537 | -1, NULL, NULL, &error); |
|
c3e72e316531
[gaim-migrate @ 15578]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13111
diff
changeset
|
538 | if (segfault_message != NULL) { |
|
c3e72e316531
[gaim-migrate @ 15578]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13111
diff
changeset
|
539 | g_free(segfault_message_tmp); |
|
c3e72e316531
[gaim-migrate @ 15578]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13111
diff
changeset
|
540 | } |
|
c3e72e316531
[gaim-migrate @ 15578]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13111
diff
changeset
|
541 | else { |
|
c3e72e316531
[gaim-migrate @ 15578]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13111
diff
changeset
|
542 | /* use 'segfault_message_tmp' (UTF-8) as a fallback */ |
|
c3e72e316531
[gaim-migrate @ 15578]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13111
diff
changeset
|
543 | g_warning("%s\n", error->message); |
|
c3e72e316531
[gaim-migrate @ 15578]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13111
diff
changeset
|
544 | g_error_free(error); |
|
c3e72e316531
[gaim-migrate @ 15578]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13111
diff
changeset
|
545 | segfault_message = segfault_message_tmp; |
|
c3e72e316531
[gaim-migrate @ 15578]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13111
diff
changeset
|
546 | } |
|
12556
f4d4e4e3a825
[gaim-migrate @ 14875]
Richard Laager <rlaager@pidgin.im>
parents:
12409
diff
changeset
|
547 | #else |
|
f4d4e4e3a825
[gaim-migrate @ 14875]
Richard Laager <rlaager@pidgin.im>
parents:
12409
diff
changeset
|
548 | /* Don't mark this for translation. */ |
|
f4d4e4e3a825
[gaim-migrate @ 14875]
Richard Laager <rlaager@pidgin.im>
parents:
12409
diff
changeset
|
549 | segfault_message = g_strdup( |
|
f4d4e4e3a825
[gaim-migrate @ 14875]
Richard Laager <rlaager@pidgin.im>
parents:
12409
diff
changeset
|
550 | "Hi, user. We need to talk.\n" |
|
f4d4e4e3a825
[gaim-migrate @ 14875]
Richard Laager <rlaager@pidgin.im>
parents:
12409
diff
changeset
|
551 | "I think something's gone wrong here. It's probably my fault.\n" |
|
f4d4e4e3a825
[gaim-migrate @ 14875]
Richard Laager <rlaager@pidgin.im>
parents:
12409
diff
changeset
|
552 | "No, really, it's not you... it's me... no no no, I think we get along well\n" |
| 12670 | 553 | "it's just that.... well, I want to see other people. I... what?!? NO! I \n" |
| 554 | "haven't been cheating on you!! How many times do you want me to tell you?! And\n" | |
| 555 | "for the last time, it's just a rash!\n" | |
|
12556
f4d4e4e3a825
[gaim-migrate @ 14875]
Richard Laager <rlaager@pidgin.im>
parents:
12409
diff
changeset
|
556 | ); |
|
f4d4e4e3a825
[gaim-migrate @ 14875]
Richard Laager <rlaager@pidgin.im>
parents:
12409
diff
changeset
|
557 | #endif |
|
f4d4e4e3a825
[gaim-migrate @ 14875]
Richard Laager <rlaager@pidgin.im>
parents:
12409
diff
changeset
|
558 | |
| 10302 | 559 | /* Let's not violate any PLA's!!!! */ |
| 560 | /* jseymour: whatever the fsck that means */ | |
| 561 | /* Robot101: for some reason things like gdm like to block * | |
| 562 | * useful signals like SIGCHLD, so we unblock all the ones we * | |
| 563 | * declare a handler for. thanks JSeymour and Vann. */ | |
| 564 | if (sigemptyset(&sigset)) { | |
| 565 | snprintf(errmsg, BUFSIZ, "Warning: couldn't initialise empty signal set"); | |
| 566 | perror(errmsg); | |
| 567 | } | |
| 568 | for(sig_indx = 0; catch_sig_list[sig_indx] != -1; ++sig_indx) { | |
| 569 | if((prev_sig_disp = signal(catch_sig_list[sig_indx], sighandler)) == SIG_ERR) { | |
| 570 | snprintf(errmsg, BUFSIZ, "Warning: couldn't set signal %d for catching", | |
| 571 | catch_sig_list[sig_indx]); | |
| 572 | perror(errmsg); | |
| 573 | } | |
| 574 | if(sigaddset(&sigset, catch_sig_list[sig_indx])) { | |
| 575 | snprintf(errmsg, BUFSIZ, "Warning: couldn't include signal %d for unblocking", | |
| 576 | catch_sig_list[sig_indx]); | |
| 577 | perror(errmsg); | |
| 578 | } | |
| 579 | } | |
| 580 | for(sig_indx = 0; ignore_sig_list[sig_indx] != -1; ++sig_indx) { | |
| 581 | if((prev_sig_disp = signal(ignore_sig_list[sig_indx], SIG_IGN)) == SIG_ERR) { | |
| 582 | snprintf(errmsg, BUFSIZ, "Warning: couldn't set signal %d to ignore", | |
| 583 | ignore_sig_list[sig_indx]); | |
| 584 | perror(errmsg); | |
| 585 | } | |
| 586 | } | |
| 587 | ||
| 588 | if (sigprocmask(SIG_UNBLOCK, &sigset, NULL)) { | |
| 589 | snprintf(errmsg, BUFSIZ, "Warning: couldn't unblock signals"); | |
| 590 | perror(errmsg); | |
|
10307
f3ba80364053
[gaim-migrate @ 11497]
Mark Doliner <markdoliner@pidgin.im>
parents:
10306
diff
changeset
|
591 | } |
| 10302 | 592 | #endif |
| 593 | ||
| 594 | /* scan command-line options */ | |
| 595 | opterr = 1; | |
| 596 | while ((opt = getopt_long(argc, argv, | |
| 597 | #ifndef _WIN32 | |
|
18207
e89bf4430ea6
Allow disabling check for single instance.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18191
diff
changeset
|
598 | "c:dhmnl::s:v", |
| 10302 | 599 | #else |
|
11795
ab7b200b552e
[gaim-migrate @ 14086]
Richard Laager <rlaager@pidgin.im>
parents:
11785
diff
changeset
|
600 | "c:dhnl::v", |
| 10302 | 601 | #endif |
| 602 | long_options, NULL)) != -1) { | |
| 603 | switch (opt) { | |
|
10323
f4a013ac9e7c
[gaim-migrate @ 11530]
Mark Doliner <markdoliner@pidgin.im>
parents:
10322
diff
changeset
|
604 | case 'c': /* config dir */ |
|
f4a013ac9e7c
[gaim-migrate @ 11530]
Mark Doliner <markdoliner@pidgin.im>
parents:
10322
diff
changeset
|
605 | g_free(opt_config_dir_arg); |
|
f4a013ac9e7c
[gaim-migrate @ 11530]
Mark Doliner <markdoliner@pidgin.im>
parents:
10322
diff
changeset
|
606 | opt_config_dir_arg = g_strdup(optarg); |
| 10302 | 607 | break; |
| 608 | case 'd': /* debug */ | |
|
10307
f3ba80364053
[gaim-migrate @ 11497]
Mark Doliner <markdoliner@pidgin.im>
parents:
10306
diff
changeset
|
609 | debug_enabled = TRUE; |
| 10302 | 610 | break; |
|
10323
f4a013ac9e7c
[gaim-migrate @ 11530]
Mark Doliner <markdoliner@pidgin.im>
parents:
10322
diff
changeset
|
611 | case 'h': /* help */ |
|
f4a013ac9e7c
[gaim-migrate @ 11530]
Mark Doliner <markdoliner@pidgin.im>
parents:
10322
diff
changeset
|
612 | opt_help = TRUE; |
|
f4a013ac9e7c
[gaim-migrate @ 11530]
Mark Doliner <markdoliner@pidgin.im>
parents:
10322
diff
changeset
|
613 | break; |
|
f4a013ac9e7c
[gaim-migrate @ 11530]
Mark Doliner <markdoliner@pidgin.im>
parents:
10322
diff
changeset
|
614 | case 'n': /* no autologin */ |
|
f4a013ac9e7c
[gaim-migrate @ 11530]
Mark Doliner <markdoliner@pidgin.im>
parents:
10322
diff
changeset
|
615 | opt_nologin = TRUE; |
| 10302 | 616 | break; |
|
10323
f4a013ac9e7c
[gaim-migrate @ 11530]
Mark Doliner <markdoliner@pidgin.im>
parents:
10322
diff
changeset
|
617 | case 'l': /* login, option username */ |
|
f4a013ac9e7c
[gaim-migrate @ 11530]
Mark Doliner <markdoliner@pidgin.im>
parents:
10322
diff
changeset
|
618 | opt_login = TRUE; |
|
f4a013ac9e7c
[gaim-migrate @ 11530]
Mark Doliner <markdoliner@pidgin.im>
parents:
10322
diff
changeset
|
619 | g_free(opt_login_arg); |
|
f4a013ac9e7c
[gaim-migrate @ 11530]
Mark Doliner <markdoliner@pidgin.im>
parents:
10322
diff
changeset
|
620 | if (optarg != NULL) |
|
f4a013ac9e7c
[gaim-migrate @ 11530]
Mark Doliner <markdoliner@pidgin.im>
parents:
10322
diff
changeset
|
621 | opt_login_arg = g_strdup(optarg); |
| 10302 | 622 | break; |
|
10320
f5b0f5cf8562
[gaim-migrate @ 11527]
Mark Doliner <markdoliner@pidgin.im>
parents:
10317
diff
changeset
|
623 | case 's': /* use existing session ID */ |
|
10323
f4a013ac9e7c
[gaim-migrate @ 11530]
Mark Doliner <markdoliner@pidgin.im>
parents:
10322
diff
changeset
|
624 | g_free(opt_session_arg); |
|
10320
f5b0f5cf8562
[gaim-migrate @ 11527]
Mark Doliner <markdoliner@pidgin.im>
parents:
10317
diff
changeset
|
625 | opt_session_arg = g_strdup(optarg); |
|
f5b0f5cf8562
[gaim-migrate @ 11527]
Mark Doliner <markdoliner@pidgin.im>
parents:
10317
diff
changeset
|
626 | break; |
|
10323
f4a013ac9e7c
[gaim-migrate @ 11530]
Mark Doliner <markdoliner@pidgin.im>
parents:
10322
diff
changeset
|
627 | case 'v': /* version */ |
|
f4a013ac9e7c
[gaim-migrate @ 11530]
Mark Doliner <markdoliner@pidgin.im>
parents:
10322
diff
changeset
|
628 | opt_version = TRUE; |
|
10320
f5b0f5cf8562
[gaim-migrate @ 11527]
Mark Doliner <markdoliner@pidgin.im>
parents:
10317
diff
changeset
|
629 | break; |
|
18207
e89bf4430ea6
Allow disabling check for single instance.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18191
diff
changeset
|
630 | case 'm': /* do not ensure single instance. */ |
|
e89bf4430ea6
Allow disabling check for single instance.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18191
diff
changeset
|
631 | opt_si = FALSE; |
|
e89bf4430ea6
Allow disabling check for single instance.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18191
diff
changeset
|
632 | break; |
|
20346
06c3e9cfdc27
Accept --display as an argument, to be passed to Gtk+.
Ethan Blanton <elb@pidgin.im>
parents:
19859
diff
changeset
|
633 | case 'D': /* --display */ |
|
06c3e9cfdc27
Accept --display as an argument, to be passed to Gtk+.
Ethan Blanton <elb@pidgin.im>
parents:
19859
diff
changeset
|
634 | /* handled by gtk_init_check below */ |
|
06c3e9cfdc27
Accept --display as an argument, to be passed to Gtk+.
Ethan Blanton <elb@pidgin.im>
parents:
19859
diff
changeset
|
635 | break; |
|
10323
f4a013ac9e7c
[gaim-migrate @ 11530]
Mark Doliner <markdoliner@pidgin.im>
parents:
10322
diff
changeset
|
636 | case '?': /* show terse help */ |
| 10302 | 637 | default: |
|
10320
f5b0f5cf8562
[gaim-migrate @ 11527]
Mark Doliner <markdoliner@pidgin.im>
parents:
10317
diff
changeset
|
638 | show_usage(argv[0], TRUE); |
|
16193
e27165dcba9b
Free segfault_message when Pidgin exits abnormally
Mark Doliner <markdoliner@pidgin.im>
parents:
16158
diff
changeset
|
639 | #ifdef HAVE_SIGNAL_H |
|
e27165dcba9b
Free segfault_message when Pidgin exits abnormally
Mark Doliner <markdoliner@pidgin.im>
parents:
16158
diff
changeset
|
640 | g_free(segfault_message); |
|
e27165dcba9b
Free segfault_message when Pidgin exits abnormally
Mark Doliner <markdoliner@pidgin.im>
parents:
16158
diff
changeset
|
641 | #endif |
| 10302 | 642 | return 0; |
| 643 | break; | |
| 644 | } | |
| 645 | } | |
| 646 | ||
| 647 | /* show help message */ | |
| 648 | if (opt_help) { | |
|
10320
f5b0f5cf8562
[gaim-migrate @ 11527]
Mark Doliner <markdoliner@pidgin.im>
parents:
10317
diff
changeset
|
649 | show_usage(argv[0], FALSE); |
|
16193
e27165dcba9b
Free segfault_message when Pidgin exits abnormally
Mark Doliner <markdoliner@pidgin.im>
parents:
16158
diff
changeset
|
650 | #ifdef HAVE_SIGNAL_H |
|
e27165dcba9b
Free segfault_message when Pidgin exits abnormally
Mark Doliner <markdoliner@pidgin.im>
parents:
16158
diff
changeset
|
651 | g_free(segfault_message); |
|
e27165dcba9b
Free segfault_message when Pidgin exits abnormally
Mark Doliner <markdoliner@pidgin.im>
parents:
16158
diff
changeset
|
652 | #endif |
| 10302 | 653 | return 0; |
| 654 | } | |
| 655 | /* show version message */ | |
| 656 | if (opt_version) { | |
|
16977
c9cb49bea66d
Change the PIDGIN_NAME stuff to allow translators to transliterate the
Richard Laager <rlaager@pidgin.im>
parents:
16967
diff
changeset
|
657 | printf("%s %s\n", PIDGIN_NAME, VERSION); |
|
16193
e27165dcba9b
Free segfault_message when Pidgin exits abnormally
Mark Doliner <markdoliner@pidgin.im>
parents:
16158
diff
changeset
|
658 | #ifdef HAVE_SIGNAL_H |
|
e27165dcba9b
Free segfault_message when Pidgin exits abnormally
Mark Doliner <markdoliner@pidgin.im>
parents:
16158
diff
changeset
|
659 | g_free(segfault_message); |
|
e27165dcba9b
Free segfault_message when Pidgin exits abnormally
Mark Doliner <markdoliner@pidgin.im>
parents:
16158
diff
changeset
|
660 | #endif |
| 10302 | 661 | return 0; |
| 662 | } | |
| 663 | ||
|
10323
f4a013ac9e7c
[gaim-migrate @ 11530]
Mark Doliner <markdoliner@pidgin.im>
parents:
10322
diff
changeset
|
664 | /* set a user-specified config directory */ |
|
f4a013ac9e7c
[gaim-migrate @ 11530]
Mark Doliner <markdoliner@pidgin.im>
parents:
10322
diff
changeset
|
665 | if (opt_config_dir_arg != NULL) { |
| 15884 | 666 | purple_util_set_user_dir(opt_config_dir_arg); |
|
10323
f4a013ac9e7c
[gaim-migrate @ 11530]
Mark Doliner <markdoliner@pidgin.im>
parents:
10322
diff
changeset
|
667 | } |
|
f4a013ac9e7c
[gaim-migrate @ 11530]
Mark Doliner <markdoliner@pidgin.im>
parents:
10322
diff
changeset
|
668 | |
|
10448
4415ffba12e9
[gaim-migrate @ 11713]
Mark Doliner <markdoliner@pidgin.im>
parents:
10447
diff
changeset
|
669 | /* |
|
4415ffba12e9
[gaim-migrate @ 11713]
Mark Doliner <markdoliner@pidgin.im>
parents:
10447
diff
changeset
|
670 | * We're done piddling around with command line arguments. |
|
4415ffba12e9
[gaim-migrate @ 11713]
Mark Doliner <markdoliner@pidgin.im>
parents:
10447
diff
changeset
|
671 | * Fire up this baby. |
|
4415ffba12e9
[gaim-migrate @ 11713]
Mark Doliner <markdoliner@pidgin.im>
parents:
10447
diff
changeset
|
672 | */ |
|
4415ffba12e9
[gaim-migrate @ 11713]
Mark Doliner <markdoliner@pidgin.im>
parents:
10447
diff
changeset
|
673 | |
| 15884 | 674 | purple_debug_set_enabled(debug_enabled); |
|
10448
4415ffba12e9
[gaim-migrate @ 11713]
Mark Doliner <markdoliner@pidgin.im>
parents:
10447
diff
changeset
|
675 | |
|
16419
8a5a3e2cd3a7
Call the core migrate code.
Richard Laager <rlaager@pidgin.im>
parents:
16263
diff
changeset
|
676 | /* If we're using a custom configuration directory, we |
|
8a5a3e2cd3a7
Call the core migrate code.
Richard Laager <rlaager@pidgin.im>
parents:
16263
diff
changeset
|
677 | * do NOT want to migrate, or weird things will happen. */ |
|
8a5a3e2cd3a7
Call the core migrate code.
Richard Laager <rlaager@pidgin.im>
parents:
16263
diff
changeset
|
678 | if (opt_config_dir_arg == NULL) |
|
8a5a3e2cd3a7
Call the core migrate code.
Richard Laager <rlaager@pidgin.im>
parents:
16263
diff
changeset
|
679 | { |
|
8a5a3e2cd3a7
Call the core migrate code.
Richard Laager <rlaager@pidgin.im>
parents:
16263
diff
changeset
|
680 | if (!purple_core_migrate()) |
|
8a5a3e2cd3a7
Call the core migrate code.
Richard Laager <rlaager@pidgin.im>
parents:
16263
diff
changeset
|
681 | { |
|
8a5a3e2cd3a7
Call the core migrate code.
Richard Laager <rlaager@pidgin.im>
parents:
16263
diff
changeset
|
682 | migration_failed = TRUE; |
|
8a5a3e2cd3a7
Call the core migrate code.
Richard Laager <rlaager@pidgin.im>
parents:
16263
diff
changeset
|
683 | } |
|
8a5a3e2cd3a7
Call the core migrate code.
Richard Laager <rlaager@pidgin.im>
parents:
16263
diff
changeset
|
684 | } |
|
11067
b6353889a9ba
[gaim-migrate @ 13048]
Piotr Zielinski <zielaj@users.sourceforge.net>
parents:
11055
diff
changeset
|
685 | |
| 15884 | 686 | search_path = g_build_filename(purple_user_dir(), "gtkrc-2.0", NULL); |
|
12572
a71b6aef215b
[gaim-migrate @ 14891]
Daniel Atallah <datallah@pidgin.im>
parents:
12562
diff
changeset
|
687 | gtk_rc_add_default_file(search_path); |
|
a71b6aef215b
[gaim-migrate @ 14891]
Daniel Atallah <datallah@pidgin.im>
parents:
12562
diff
changeset
|
688 | g_free(search_path); |
|
a71b6aef215b
[gaim-migrate @ 14891]
Daniel Atallah <datallah@pidgin.im>
parents:
12562
diff
changeset
|
689 | |
|
a71b6aef215b
[gaim-migrate @ 14891]
Daniel Atallah <datallah@pidgin.im>
parents:
12562
diff
changeset
|
690 | gui_check = gtk_init_check(&argc, &argv); |
|
a71b6aef215b
[gaim-migrate @ 14891]
Daniel Atallah <datallah@pidgin.im>
parents:
12562
diff
changeset
|
691 | if (!gui_check) { |
|
a71b6aef215b
[gaim-migrate @ 14891]
Daniel Atallah <datallah@pidgin.im>
parents:
12562
diff
changeset
|
692 | char *display = gdk_get_display(); |
|
a71b6aef215b
[gaim-migrate @ 14891]
Daniel Atallah <datallah@pidgin.im>
parents:
12562
diff
changeset
|
693 | |
|
16977
c9cb49bea66d
Change the PIDGIN_NAME stuff to allow translators to transliterate the
Richard Laager <rlaager@pidgin.im>
parents:
16967
diff
changeset
|
694 | printf("%s %s\n", PIDGIN_NAME, VERSION); |
|
12572
a71b6aef215b
[gaim-migrate @ 14891]
Daniel Atallah <datallah@pidgin.im>
parents:
12562
diff
changeset
|
695 | |
|
a71b6aef215b
[gaim-migrate @ 14891]
Daniel Atallah <datallah@pidgin.im>
parents:
12562
diff
changeset
|
696 | g_warning("cannot open display: %s", display ? display : "unset"); |
|
a71b6aef215b
[gaim-migrate @ 14891]
Daniel Atallah <datallah@pidgin.im>
parents:
12562
diff
changeset
|
697 | g_free(display); |
|
16193
e27165dcba9b
Free segfault_message when Pidgin exits abnormally
Mark Doliner <markdoliner@pidgin.im>
parents:
16158
diff
changeset
|
698 | #ifdef HAVE_SIGNAL_H |
|
e27165dcba9b
Free segfault_message when Pidgin exits abnormally
Mark Doliner <markdoliner@pidgin.im>
parents:
16158
diff
changeset
|
699 | g_free(segfault_message); |
|
e27165dcba9b
Free segfault_message when Pidgin exits abnormally
Mark Doliner <markdoliner@pidgin.im>
parents:
16158
diff
changeset
|
700 | #endif |
|
12572
a71b6aef215b
[gaim-migrate @ 14891]
Daniel Atallah <datallah@pidgin.im>
parents:
12562
diff
changeset
|
701 | |
|
a71b6aef215b
[gaim-migrate @ 14891]
Daniel Atallah <datallah@pidgin.im>
parents:
12562
diff
changeset
|
702 | return 1; |
|
a71b6aef215b
[gaim-migrate @ 14891]
Daniel Atallah <datallah@pidgin.im>
parents:
12562
diff
changeset
|
703 | } |
|
a71b6aef215b
[gaim-migrate @ 14891]
Daniel Atallah <datallah@pidgin.im>
parents:
12562
diff
changeset
|
704 | |
|
19122
0c71768c2b4d
Patch from Gabriel Schulhof to only call g_set_application_name() if
Mark Doliner <markdoliner@pidgin.im>
parents:
19048
diff
changeset
|
705 | #if GLIB_CHECK_VERSION(2,2,0) |
|
18345
a51a9c1e4314
Move g_set_application_name to a point before the pidgin UI is created
Gabriel Schulhof <nix@go-nix.ca>
parents:
18256
diff
changeset
|
706 | g_set_application_name(_("Pidgin")); |
|
19122
0c71768c2b4d
Patch from Gabriel Schulhof to only call g_set_application_name() if
Mark Doliner <markdoliner@pidgin.im>
parents:
19048
diff
changeset
|
707 | #endif /* glib-2.0 >= 2.2.0 */ |
|
18345
a51a9c1e4314
Move g_set_application_name to a point before the pidgin UI is created
Gabriel Schulhof <nix@go-nix.ca>
parents:
18256
diff
changeset
|
708 | |
|
12572
a71b6aef215b
[gaim-migrate @ 14891]
Daniel Atallah <datallah@pidgin.im>
parents:
12562
diff
changeset
|
709 | #ifdef _WIN32 |
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15567
diff
changeset
|
710 | winpidgin_init(hint); |
|
12572
a71b6aef215b
[gaim-migrate @ 14891]
Daniel Atallah <datallah@pidgin.im>
parents:
12562
diff
changeset
|
711 | #endif |
|
a71b6aef215b
[gaim-migrate @ 14891]
Daniel Atallah <datallah@pidgin.im>
parents:
12562
diff
changeset
|
712 | |
|
16419
8a5a3e2cd3a7
Call the core migrate code.
Richard Laager <rlaager@pidgin.im>
parents:
16263
diff
changeset
|
713 | if (migration_failed) |
|
8a5a3e2cd3a7
Call the core migrate code.
Richard Laager <rlaager@pidgin.im>
parents:
16263
diff
changeset
|
714 | { |
|
8a5a3e2cd3a7
Call the core migrate code.
Richard Laager <rlaager@pidgin.im>
parents:
16263
diff
changeset
|
715 | char *old = g_strconcat(purple_home_dir(), |
|
8a5a3e2cd3a7
Call the core migrate code.
Richard Laager <rlaager@pidgin.im>
parents:
16263
diff
changeset
|
716 | G_DIR_SEPARATOR_S ".gaim", NULL); |
|
16437
7ff7c3405ea2
Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents:
16419
diff
changeset
|
717 | const char *text = _( |
|
16446
3a6ed6c3400e
Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@pidgin.im>
parents:
16437
diff
changeset
|
718 | "%s encountered errors migrating your settings " |
|
16419
8a5a3e2cd3a7
Call the core migrate code.
Richard Laager <rlaager@pidgin.im>
parents:
16263
diff
changeset
|
719 | "from %s to %s. Please investigate and complete the " |
| 16763 | 720 | "migration by hand. Please report this error at http://developer.pidgin.im"); |
|
16419
8a5a3e2cd3a7
Call the core migrate code.
Richard Laager <rlaager@pidgin.im>
parents:
16263
diff
changeset
|
721 | GtkWidget *dialog; |
|
8a5a3e2cd3a7
Call the core migrate code.
Richard Laager <rlaager@pidgin.im>
parents:
16263
diff
changeset
|
722 | |
|
8a5a3e2cd3a7
Call the core migrate code.
Richard Laager <rlaager@pidgin.im>
parents:
16263
diff
changeset
|
723 | dialog = gtk_message_dialog_new(NULL, |
|
8a5a3e2cd3a7
Call the core migrate code.
Richard Laager <rlaager@pidgin.im>
parents:
16263
diff
changeset
|
724 | 0, |
|
8a5a3e2cd3a7
Call the core migrate code.
Richard Laager <rlaager@pidgin.im>
parents:
16263
diff
changeset
|
725 | GTK_MESSAGE_ERROR, |
|
8a5a3e2cd3a7
Call the core migrate code.
Richard Laager <rlaager@pidgin.im>
parents:
16263
diff
changeset
|
726 | GTK_BUTTONS_CLOSE, |
|
16446
3a6ed6c3400e
Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@pidgin.im>
parents:
16437
diff
changeset
|
727 | text, PIDGIN_NAME, |
|
3a6ed6c3400e
Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@pidgin.im>
parents:
16437
diff
changeset
|
728 | old, purple_user_dir()); |
|
16419
8a5a3e2cd3a7
Call the core migrate code.
Richard Laager <rlaager@pidgin.im>
parents:
16263
diff
changeset
|
729 | g_free(old); |
|
8a5a3e2cd3a7
Call the core migrate code.
Richard Laager <rlaager@pidgin.im>
parents:
16263
diff
changeset
|
730 | |
|
8a5a3e2cd3a7
Call the core migrate code.
Richard Laager <rlaager@pidgin.im>
parents:
16263
diff
changeset
|
731 | g_signal_connect_swapped(dialog, "response", |
|
8a5a3e2cd3a7
Call the core migrate code.
Richard Laager <rlaager@pidgin.im>
parents:
16263
diff
changeset
|
732 | G_CALLBACK(gtk_main_quit), NULL); |
|
8a5a3e2cd3a7
Call the core migrate code.
Richard Laager <rlaager@pidgin.im>
parents:
16263
diff
changeset
|
733 | |
|
8a5a3e2cd3a7
Call the core migrate code.
Richard Laager <rlaager@pidgin.im>
parents:
16263
diff
changeset
|
734 | gtk_widget_show_all(dialog); |
|
8a5a3e2cd3a7
Call the core migrate code.
Richard Laager <rlaager@pidgin.im>
parents:
16263
diff
changeset
|
735 | |
|
8a5a3e2cd3a7
Call the core migrate code.
Richard Laager <rlaager@pidgin.im>
parents:
16263
diff
changeset
|
736 | gtk_main(); |
|
8a5a3e2cd3a7
Call the core migrate code.
Richard Laager <rlaager@pidgin.im>
parents:
16263
diff
changeset
|
737 | |
|
8a5a3e2cd3a7
Call the core migrate code.
Richard Laager <rlaager@pidgin.im>
parents:
16263
diff
changeset
|
738 | #ifdef HAVE_SIGNAL_H |
|
8a5a3e2cd3a7
Call the core migrate code.
Richard Laager <rlaager@pidgin.im>
parents:
16263
diff
changeset
|
739 | g_free(segfault_message); |
|
8a5a3e2cd3a7
Call the core migrate code.
Richard Laager <rlaager@pidgin.im>
parents:
16263
diff
changeset
|
740 | #endif |
|
8a5a3e2cd3a7
Call the core migrate code.
Richard Laager <rlaager@pidgin.im>
parents:
16263
diff
changeset
|
741 | return 0; |
|
8a5a3e2cd3a7
Call the core migrate code.
Richard Laager <rlaager@pidgin.im>
parents:
16263
diff
changeset
|
742 | } |
|
8a5a3e2cd3a7
Call the core migrate code.
Richard Laager <rlaager@pidgin.im>
parents:
16263
diff
changeset
|
743 | |
| 15884 | 744 | purple_core_set_ui_ops(pidgin_core_get_ui_ops()); |
| 745 | purple_eventloop_set_ui_ops(pidgin_eventloop_get_ui_ops()); | |
| 10302 | 746 | |
|
12342
da61b726d595
[gaim-migrate @ 14646]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12272
diff
changeset
|
747 | /* |
|
da61b726d595
[gaim-migrate @ 14646]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12272
diff
changeset
|
748 | * Set plugin search directories. Give priority to the plugins |
|
da61b726d595
[gaim-migrate @ 14646]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12272
diff
changeset
|
749 | * in user's home directory. |
|
da61b726d595
[gaim-migrate @ 14646]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12272
diff
changeset
|
750 | */ |
| 15884 | 751 | search_path = g_build_filename(purple_user_dir(), "plugins", NULL); |
| 752 | purple_plugins_add_search_path(search_path); | |
|
10447
887380ec66f5
[gaim-migrate @ 11712]
Mark Doliner <markdoliner@pidgin.im>
parents:
10433
diff
changeset
|
753 | g_free(search_path); |
| 15884 | 754 | purple_plugins_add_search_path(LIBDIR); |
|
10447
887380ec66f5
[gaim-migrate @ 11712]
Mark Doliner <markdoliner@pidgin.im>
parents:
10433
diff
changeset
|
755 | |
| 15884 | 756 | if (!purple_core_init(PIDGIN_UI)) { |
| 10302 | 757 | fprintf(stderr, |
|
16977
c9cb49bea66d
Change the PIDGIN_NAME stuff to allow translators to transliterate the
Richard Laager <rlaager@pidgin.im>
parents:
16967
diff
changeset
|
758 | "Initialization of the libpurple core failed. Dumping core.\n" |
| 10302 | 759 | "Please report this!\n"); |
|
16193
e27165dcba9b
Free segfault_message when Pidgin exits abnormally
Mark Doliner <markdoliner@pidgin.im>
parents:
16158
diff
changeset
|
760 | #ifdef HAVE_SIGNAL_H |
|
e27165dcba9b
Free segfault_message when Pidgin exits abnormally
Mark Doliner <markdoliner@pidgin.im>
parents:
16158
diff
changeset
|
761 | g_free(segfault_message); |
|
e27165dcba9b
Free segfault_message when Pidgin exits abnormally
Mark Doliner <markdoliner@pidgin.im>
parents:
16158
diff
changeset
|
762 | #endif |
| 10302 | 763 | abort(); |
| 764 | } | |
| 765 | ||
|
18207
e89bf4430ea6
Allow disabling check for single instance.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18191
diff
changeset
|
766 | if (opt_si && !purple_core_ensure_single_instance()) { |
|
17126
909c4e988d00
Added purple_core_quit to cleanup.
Gabriel Schulhof <nix@go-nix.ca>
parents:
17122
diff
changeset
|
767 | purple_core_quit(); |
|
17121
43d41f5ce17b
Alternative dbus_uniq implementation
Gabriel Schulhof <nix@go-nix.ca>
parents:
17104
diff
changeset
|
768 | #ifdef HAVE_SIGNAL_H |
|
43d41f5ce17b
Alternative dbus_uniq implementation
Gabriel Schulhof <nix@go-nix.ca>
parents:
17104
diff
changeset
|
769 | g_free(segfault_message); |
|
43d41f5ce17b
Alternative dbus_uniq implementation
Gabriel Schulhof <nix@go-nix.ca>
parents:
17104
diff
changeset
|
770 | #endif |
|
17124
f3952abcaad9
Whitespace fix in the dbus_uniq code.
Richard Laager <rlaager@pidgin.im>
parents:
17122
diff
changeset
|
771 | return 0; |
|
17122
5ba216aa4583
Style changes + removed unnecessary NULL checks.
Gabriel Schulhof <nix@go-nix.ca>
parents:
17121
diff
changeset
|
772 | } |
|
17121
43d41f5ce17b
Alternative dbus_uniq implementation
Gabriel Schulhof <nix@go-nix.ca>
parents:
17104
diff
changeset
|
773 | |
| 15884 | 774 | /* TODO: Move blist loading into purple_blist_init() */ |
| 775 | purple_set_blist(purple_blist_new()); | |
| 776 | purple_blist_load(); | |
| 10302 | 777 | |
| 778 | /* load plugins we had when we quit */ | |
|
16123
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16071
diff
changeset
|
779 | purple_plugins_load_saved(PIDGIN_PREFS_ROOT "/plugins/loaded"); |
| 10302 | 780 | |
| 15884 | 781 | /* TODO: Move pounces loading into purple_pounces_init() */ |
| 782 | purple_pounces_load(); | |
| 10302 | 783 | |
| 784 | ui_main(); | |
| 785 | ||
| 786 | #ifdef USE_SM | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15498
diff
changeset
|
787 | pidgin_session_init(argv[0], opt_session_arg, opt_config_dir_arg); |
| 10302 | 788 | #endif |
| 789 | if (opt_session_arg != NULL) { | |
| 790 | g_free(opt_session_arg); | |
| 791 | opt_session_arg = NULL; | |
| 792 | } | |
| 793 | if (opt_config_dir_arg != NULL) { | |
| 794 | g_free(opt_config_dir_arg); | |
| 795 | opt_config_dir_arg = NULL; | |
| 796 | } | |
| 797 | ||
|
12011
85a627679414
[gaim-migrate @ 14304]
Mark Doliner <markdoliner@pidgin.im>
parents:
11928
diff
changeset
|
798 | /* |
|
85a627679414
[gaim-migrate @ 14304]
Mark Doliner <markdoliner@pidgin.im>
parents:
11928
diff
changeset
|
799 | * We want to show the blist early in the init process so the |
|
85a627679414
[gaim-migrate @ 14304]
Mark Doliner <markdoliner@pidgin.im>
parents:
11928
diff
changeset
|
800 | * user feels warm and fuzzy (not cold and prickley). |
|
85a627679414
[gaim-migrate @ 14304]
Mark Doliner <markdoliner@pidgin.im>
parents:
11928
diff
changeset
|
801 | */ |
| 15884 | 802 | purple_blist_show(); |
|
12011
85a627679414
[gaim-migrate @ 14304]
Mark Doliner <markdoliner@pidgin.im>
parents:
11928
diff
changeset
|
803 | |
|
16123
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16071
diff
changeset
|
804 | if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/debug/enabled")) |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15498
diff
changeset
|
805 | pidgin_debug_window_show(); |
| 10302 | 806 | |
| 807 | if (opt_login) { | |
|
17719
8070b1610abe
Make -l do something slightly more sane than it does now, even though it
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17105
diff
changeset
|
808 | /* disable all accounts */ |
|
8070b1610abe
Make -l do something slightly more sane than it does now, even though it
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17105
diff
changeset
|
809 | for (accounts = purple_accounts_get_all(); accounts != NULL; accounts = accounts->next) { |
|
8070b1610abe
Make -l do something slightly more sane than it does now, even though it
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17105
diff
changeset
|
810 | PurpleAccount *account = accounts->data; |
|
8070b1610abe
Make -l do something slightly more sane than it does now, even though it
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17105
diff
changeset
|
811 | purple_account_set_enabled(account, PIDGIN_UI, FALSE); |
|
8070b1610abe
Make -l do something slightly more sane than it does now, even though it
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17105
diff
changeset
|
812 | } |
|
8070b1610abe
Make -l do something slightly more sane than it does now, even though it
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17105
diff
changeset
|
813 | /* honor the startup status preference */ |
|
8070b1610abe
Make -l do something slightly more sane than it does now, even though it
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17105
diff
changeset
|
814 | if (!purple_prefs_get_bool("/purple/savedstatus/startup_current_status")) |
|
8070b1610abe
Make -l do something slightly more sane than it does now, even though it
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17105
diff
changeset
|
815 | purple_savedstatus_activate(purple_savedstatus_get_startup()); |
|
8070b1610abe
Make -l do something slightly more sane than it does now, even though it
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17105
diff
changeset
|
816 | /* now enable the requested ones */ |
|
8070b1610abe
Make -l do something slightly more sane than it does now, even though it
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17105
diff
changeset
|
817 | dologin_named(opt_login_arg); |
| 10302 | 818 | if (opt_login_arg != NULL) { |
| 819 | g_free(opt_login_arg); | |
| 820 | opt_login_arg = NULL; | |
| 821 | } | |
|
19675
3c1669c529a1
Move purple_prefs_load() to purple_prefs_init() - there's been a TODO for this for a long time. I have no idea why this wasn't done sooner; it seems to work just fine and fixes some bugs where stuff isn't loaded before being used. Fixes #1848 (and I'm sure others). Yell at me if this breaks anything.
Daniel Atallah <datallah@pidgin.im>
parents:
19122
diff
changeset
|
822 | } else if (opt_nologin) { |
|
11806
269e9f78cf89
[gaim-migrate @ 14097]
Mark Doliner <markdoliner@pidgin.im>
parents:
11795
diff
changeset
|
823 | /* Set all accounts to "offline" */ |
| 15884 | 824 | PurpleSavedStatus *saved_status; |
|
13111
31caa48825f7
[gaim-migrate @ 15472]
Mark Doliner <markdoliner@pidgin.im>
parents:
13106
diff
changeset
|
825 | |
|
31caa48825f7
[gaim-migrate @ 15472]
Mark Doliner <markdoliner@pidgin.im>
parents:
13106
diff
changeset
|
826 | /* If we've used this type+message before, lookup the transient status */ |
| 15884 | 827 | saved_status = purple_savedstatus_find_transient_by_type_and_message( |
| 828 | PURPLE_STATUS_OFFLINE, NULL); | |
|
13111
31caa48825f7
[gaim-migrate @ 15472]
Mark Doliner <markdoliner@pidgin.im>
parents:
13106
diff
changeset
|
829 | |
|
31caa48825f7
[gaim-migrate @ 15472]
Mark Doliner <markdoliner@pidgin.im>
parents:
13106
diff
changeset
|
830 | /* If this type+message is unique then create a new transient saved status */ |
|
31caa48825f7
[gaim-migrate @ 15472]
Mark Doliner <markdoliner@pidgin.im>
parents:
13106
diff
changeset
|
831 | if (saved_status == NULL) |
| 15884 | 832 | saved_status = purple_savedstatus_new(NULL, PURPLE_STATUS_OFFLINE); |
|
13111
31caa48825f7
[gaim-migrate @ 15472]
Mark Doliner <markdoliner@pidgin.im>
parents:
13106
diff
changeset
|
833 | |
|
31caa48825f7
[gaim-migrate @ 15472]
Mark Doliner <markdoliner@pidgin.im>
parents:
13106
diff
changeset
|
834 | /* Set the status for each account */ |
| 15884 | 835 | purple_savedstatus_activate(saved_status); |
|
19675
3c1669c529a1
Move purple_prefs_load() to purple_prefs_init() - there's been a TODO for this for a long time. I have no idea why this wasn't done sooner; it seems to work just fine and fixes some bugs where stuff isn't loaded before being used. Fixes #1848 (and I'm sure others). Yell at me if this breaks anything.
Daniel Atallah <datallah@pidgin.im>
parents:
19122
diff
changeset
|
836 | } else { |
|
11348
b8938b189d61
[gaim-migrate @ 13565]
Mark Doliner <markdoliner@pidgin.im>
parents:
11277
diff
changeset
|
837 | /* Everything is good to go--sign on already */ |
|
16478
19107605c565
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@pidgin.im>
parents:
16263
diff
changeset
|
838 | if (!purple_prefs_get_bool("/purple/savedstatus/startup_current_status")) |
| 15884 | 839 | purple_savedstatus_activate(purple_savedstatus_get_startup()); |
| 840 | purple_accounts_restore_current_statuses(); | |
|
10738
63ca8277c234
[gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents:
10638
diff
changeset
|
841 | } |
| 10302 | 842 | |
|
18121
2d8ea56b9097
Mark the return type const for the following functions. I noticed this
Richard Laager <rlaager@pidgin.im>
parents:
18093
diff
changeset
|
843 | if ((active_accounts = purple_accounts_get_all_active()) == NULL) |
|
11403
e7e7ed37dc51
[gaim-migrate @ 13638]
Mark Doliner <markdoliner@pidgin.im>
parents:
11348
diff
changeset
|
844 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15498
diff
changeset
|
845 | pidgin_accounts_window_show(); |
| 10315 | 846 | } |
| 13835 | 847 | else |
| 848 | { | |
|
18121
2d8ea56b9097
Mark the return type const for the following functions. I noticed this
Richard Laager <rlaager@pidgin.im>
parents:
18093
diff
changeset
|
849 | g_list_free(active_accounts); |
| 13835 | 850 | } |
| 10302 | 851 | |
| 852 | #ifdef HAVE_STARTUP_NOTIFICATION | |
| 853 | startup_notification_complete(); | |
| 854 | #endif | |
|
14762
f494a5f12981
[gaim-migrate @ 17452]
Daniel Atallah <datallah@pidgin.im>
parents:
14743
diff
changeset
|
855 | |
|
f494a5f12981
[gaim-migrate @ 17452]
Daniel Atallah <datallah@pidgin.im>
parents:
14743
diff
changeset
|
856 | #ifdef _WIN32 |
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15567
diff
changeset
|
857 | winpidgin_post_init(); |
|
14762
f494a5f12981
[gaim-migrate @ 17452]
Daniel Atallah <datallah@pidgin.im>
parents:
14743
diff
changeset
|
858 | #endif |
|
f494a5f12981
[gaim-migrate @ 17452]
Daniel Atallah <datallah@pidgin.im>
parents:
14743
diff
changeset
|
859 | |
| 10302 | 860 | gtk_main(); |
|
10320
f5b0f5cf8562
[gaim-migrate @ 11527]
Mark Doliner <markdoliner@pidgin.im>
parents:
10317
diff
changeset
|
861 | |
|
13428
78687459c64b
[gaim-migrate @ 15802]
Daniel Atallah <datallah@pidgin.im>
parents:
13322
diff
changeset
|
862 | #ifdef HAVE_SIGNAL_H |
|
12556
f4d4e4e3a825
[gaim-migrate @ 14875]
Richard Laager <rlaager@pidgin.im>
parents:
12409
diff
changeset
|
863 | g_free(segfault_message); |
|
12562
adbcee61068b
[gaim-migrate @ 14881]
Daniel Atallah <datallah@pidgin.im>
parents:
12556
diff
changeset
|
864 | #endif |
|
12556
f4d4e4e3a825
[gaim-migrate @ 14875]
Richard Laager <rlaager@pidgin.im>
parents:
12409
diff
changeset
|
865 | |
| 10302 | 866 | #ifdef _WIN32 |
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15567
diff
changeset
|
867 | winpidgin_cleanup(); |
| 10302 | 868 | #endif |
| 869 | ||
| 870 | return 0; | |
| 871 | } |