pidgin/libpidgin.c

Thu, 05 Oct 2017 21:49:49 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Thu, 05 Oct 2017 21:49:49 -0500
changeset 38800
8a2ea9672bcb
parent 38647
4fe93b8bdcb4
child 38801
da7cb2e388ee
permissions
-rw-r--r--

Add the gplugin GOptionGroup to the GOptionContext of both Pidgin and Finch

10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
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
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
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
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
5 * to list here. Please refer to the COPYRIGHT file distributed with this
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
6 * source distribution.
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
7 *
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or modify
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
11 * (at your option) any later version.
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
12 *
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful,
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
16 * GNU General Public License for more details.
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
17 *
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
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
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
21 *
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
22 */
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
23
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
24 #include "internal.h"
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15567
diff changeset
25 #include "pidgin.h"
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
26
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
27 #include "account.h"
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
28 #include "conversation.h"
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
29 #include "core.h"
22888
f54d95628a9f Include dbus-maybe.h rather than conditionally including dbus-server.h
Will Thompson <resiak@pidgin.im>
parents: 22884
diff changeset
30 #include "dbus-maybe.h"
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
31 #include "debug.h"
35194
9a0203562da5 pidgin: Fix build and warnings with glib 2.24
Ankit Vani <a@nevitus.org>
parents: 35050
diff changeset
32 #include "glibcompat.h"
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
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
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
35 #include "notify.h"
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
36 #include "prefs.h"
36543
a8c3fecee2d3 Renamed prpl.[ch] to protocol.[ch]
Ankit Vani <a@nevitus.org>
parents: 36541
diff changeset
37 #include "protocol.h"
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
38 #include "pounce.h"
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
39 #include "sound.h"
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
40 #include "status.h"
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
41 #include "util.h"
11475
1e222e6e52a0 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents: 11403
diff changeset
42 #include "whiteboard.h"
35194
9a0203562da5 pidgin: Fix build and warnings with glib 2.24
Ankit Vani <a@nevitus.org>
parents: 35050
diff changeset
43 #include "xfer.h"
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
44
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
45 #include "gtkaccount.h"
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
46 #include "gtkblist.h"
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
47 #include "gtkconn.h"
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
48 #include "gtkconv.h"
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
49 #include "gtkdebug.h"
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
50 #include "gtkdialogs.h"
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents: 14636
diff changeset
51 #include "gtkdocklet.h"
34910
60502558e400 Replacements for the GObject Xfer API
Ankit Vani <a@nevitus.org>
parents: 34892
diff changeset
52 #include "gtkxfer.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"
26269
cacc598079e4 Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents: 24585
diff changeset
55 #include "gtkmedia.h"
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
56 #include "gtknotify.h"
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
57 #include "gtkplugin.h"
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
58 #include "gtkpounce.h"
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
59 #include "gtkprefs.h"
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
60 #include "gtkprivacy.h"
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
61 #include "gtkrequest.h"
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
62 #include "gtkroomlist.h"
10574
5abb2931b6ff [gaim-migrate @ 11966]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10448
diff changeset
63 #include "gtksavedstatuses.h"
35704
aa22dcef8913 Initial PidginSmileyTheme implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35605
diff changeset
64 #include "gtksmiley-theme.h"
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
65 #include "gtksound.h"
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
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
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
69
38064
7cb860a7bb2e libpidgin: Fix Win32 build due to lacking signalpair() and some enums
Mike Ruprecht <cmaiku@gmail.com>
parents: 38048
diff changeset
70 #ifndef _WIN32
38047
312be70f9de6 Remove AC_HEADER_STDC and related C89 tests.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37998
diff changeset
71 #include <signal.h>
38064
7cb860a7bb2e libpidgin: Fix Win32 build due to lacking signalpair() and some enums
Mike Ruprecht <cmaiku@gmail.com>
parents: 38048
diff changeset
72 #endif
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
73
38064
7cb860a7bb2e libpidgin: Fix Win32 build due to lacking signalpair() and some enums
Mike Ruprecht <cmaiku@gmail.com>
parents: 38048
diff changeset
74 #ifndef _WIN32
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
75
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
76 /*
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
77 * Lists of signals we wish to catch and those we wish to ignore.
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
78 * Each list terminated with -1
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
79 */
21091
07fe1a99c47b Patch from Andrew Gaul to constify a bunch of static variables to reduce
Ka-Hing Cheung <khc@pidgin.im>
parents: 20791
diff changeset
80 static const int catch_sig_list[] = {
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
81 SIGSEGV,
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
82 SIGINT,
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
83 SIGTERM,
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
84 SIGQUIT,
34293
c1da9082287f Fix a crash in case of Ctrl+C while booting (it's fork related)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33955
diff changeset
85 SIGCHLD,
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
86 -1
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
87 };
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
88
21091
07fe1a99c47b Patch from Andrew Gaul to constify a bunch of static variables to reduce
Ka-Hing Cheung <khc@pidgin.im>
parents: 20791
diff changeset
89 static const int ignore_sig_list[] = {
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
90 SIGPIPE,
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
91 -1
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
92 };
38064
7cb860a7bb2e libpidgin: Fix Win32 build due to lacking signalpair() and some enums
Mike Ruprecht <cmaiku@gmail.com>
parents: 38048
diff changeset
93 #endif /* !_WIN32 */
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
94
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
95 static void
10323
f4a013ac9e7c [gaim-migrate @ 11530]
Mark Doliner <markdoliner@pidgin.im>
parents: 10322
diff changeset
96 dologin_named(const char *name)
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
97 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
98 PurpleAccount *account;
10323
f4a013ac9e7c [gaim-migrate @ 11530]
Mark Doliner <markdoliner@pidgin.im>
parents: 10322
diff changeset
99 char **names;
f4a013ac9e7c [gaim-migrate @ 11530]
Mark Doliner <markdoliner@pidgin.im>
parents: 10322
diff changeset
100 int i;
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
101
10323
f4a013ac9e7c [gaim-migrate @ 11530]
Mark Doliner <markdoliner@pidgin.im>
parents: 10322
diff changeset
102 if (name != NULL) { /* list of names given */
f4a013ac9e7c [gaim-migrate @ 11530]
Mark Doliner <markdoliner@pidgin.im>
parents: 10322
diff changeset
103 names = g_strsplit(name, ",", 64);
f4a013ac9e7c [gaim-migrate @ 11530]
Mark Doliner <markdoliner@pidgin.im>
parents: 10322
diff changeset
104 for (i = 0; names[i] != NULL; i++) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
105 account = purple_accounts_find(names[i], NULL);
10323
f4a013ac9e7c [gaim-migrate @ 11530]
Mark Doliner <markdoliner@pidgin.im>
parents: 10322
diff changeset
106 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
107 purple_account_set_enabled(account, PIDGIN_UI, TRUE);
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
108 }
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
109 }
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
110 g_strfreev(names);
10323
f4a013ac9e7c [gaim-migrate @ 11530]
Mark Doliner <markdoliner@pidgin.im>
parents: 10322
diff changeset
111 } else { /* no name given, use the first account */
18122
9bf9970c1b6a disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents: 18121
diff changeset
112 GList *accounts;
11520
61d34ca357f2 [gaim-migrate @ 13765]
Mark Doliner <markdoliner@pidgin.im>
parents: 11475
diff changeset
113
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
114 accounts = purple_accounts_get_all();
11520
61d34ca357f2 [gaim-migrate @ 13765]
Mark Doliner <markdoliner@pidgin.im>
parents: 11475
diff changeset
115 if (accounts != NULL)
61d34ca357f2 [gaim-migrate @ 13765]
Mark Doliner <markdoliner@pidgin.im>
parents: 11475
diff changeset
116 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
117 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
118 purple_account_set_enabled(account, PIDGIN_UI, TRUE);
11520
61d34ca357f2 [gaim-migrate @ 13765]
Mark Doliner <markdoliner@pidgin.im>
parents: 11475
diff changeset
119 }
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
120 }
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
121 }
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
122
38064
7cb860a7bb2e libpidgin: Fix Win32 build due to lacking signalpair() and some enums
Mike Ruprecht <cmaiku@gmail.com>
parents: 38048
diff changeset
123 #ifndef _WIN32
28820
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
124 static char *segfault_message;
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
125
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
126 static int signal_sockets[2];
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
127
14542
7c1dd9601f1d [gaim-migrate @ 17199]
Mark Doliner <markdoliner@pidgin.im>
parents: 14323
diff changeset
128 static void sighandler(int sig);
7c1dd9601f1d [gaim-migrate @ 17199]
Mark Doliner <markdoliner@pidgin.im>
parents: 14323
diff changeset
129
28820
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
130 static void sighandler(int sig)
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
131 {
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
132 ssize_t written;
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
133
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
134 /*
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
135 * We won't do any of the heavy lifting for the signal handling here
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
136 * because we have no idea what was interrupted. Previously this signal
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
137 * handler could result in some calls to malloc/free, which can cause
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
138 * deadlock in libc when the signal handler was interrupting a previous
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
139 * malloc or free. So instead we'll do an ugly hack where we write the
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
140 * signal number to one end of a socket pair. The other half of the
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
141 * socket pair is watched by our main loop. When the main loop sees new
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
142 * data on the socket it reads in the signal and performs the appropriate
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
143 * action without fear of interrupting stuff.
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
144 */
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
145 if (sig == SIGSEGV) {
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
146 fprintf(stderr, "%s", segfault_message);
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
147 abort();
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
148 return;
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
149 }
12556
f4d4e4e3a825 [gaim-migrate @ 14875]
Richard Laager <rlaager@pidgin.im>
parents: 12409
diff changeset
150
28820
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
151 written = write(signal_sockets[0], &sig, sizeof(int));
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
152 if (written < 0 || written != sizeof(int)) {
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
153 /* This should never happen */
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
154 purple_debug_error("sighandler", "Received signal %d but only "
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
155 "wrote %" G_GSSIZE_FORMAT " bytes out of %"
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
156 G_GSIZE_FORMAT ": %s\n",
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
157 sig, written, sizeof(int), g_strerror(errno));
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
158 exit(1);
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
159 }
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
160 }
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
161
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
162 static gboolean
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
163 mainloop_sighandler(GIOChannel *source, GIOCondition cond, gpointer data)
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
164 {
28820
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
165 GIOStatus stat;
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
166 int sig;
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
167 gsize bytes_read;
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
168 GError *error = NULL;
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
169
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
170 /* read the signal number off of the io channel */
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
171 stat = g_io_channel_read_chars(source, (gchar *)&sig, sizeof(int),
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
172 &bytes_read, &error);
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
173 if (stat != G_IO_STATUS_NORMAL) {
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
174 purple_debug_error("sighandler", "Signal callback failed to read "
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
175 "from signal socket: %s", error->message);
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
176 purple_core_quit();
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
177 return FALSE;
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
178 }
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
179
34293
c1da9082287f Fix a crash in case of Ctrl+C while booting (it's fork related)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33955
diff changeset
180 switch (sig) {
c1da9082287f Fix a crash in case of Ctrl+C while booting (it's fork related)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33955
diff changeset
181 case SIGCHLD:
c1da9082287f Fix a crash in case of Ctrl+C while booting (it's fork related)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33955
diff changeset
182 /* Restore signal catching */
c1da9082287f Fix a crash in case of Ctrl+C while booting (it's fork related)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33955
diff changeset
183 signal(SIGCHLD, sighandler);
c1da9082287f Fix a crash in case of Ctrl+C while booting (it's fork related)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33955
diff changeset
184 break;
c1da9082287f Fix a crash in case of Ctrl+C while booting (it's fork related)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33955
diff changeset
185 default:
c1da9082287f Fix a crash in case of Ctrl+C while booting (it's fork related)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33955
diff changeset
186 purple_debug_warning("sighandler", "Caught signal %d\n", sig);
c1da9082287f Fix a crash in case of Ctrl+C while booting (it's fork related)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33955
diff changeset
187 purple_core_quit();
c1da9082287f Fix a crash in case of Ctrl+C while booting (it's fork related)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33955
diff changeset
188 }
28820
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
189
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
190 return TRUE;
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
191 }
38064
7cb860a7bb2e libpidgin: Fix Win32 build due to lacking signalpair() and some enums
Mike Ruprecht <cmaiku@gmail.com>
parents: 38048
diff changeset
192 #endif /* !_WIN32 */
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
193
10323
f4a013ac9e7c [gaim-migrate @ 11530]
Mark Doliner <markdoliner@pidgin.im>
parents: 10322
diff changeset
194 static int
22104
56970903b8e9 Probe for -Wstrict-prototypes to get some more warnings. I then cleaned up
Richard Laager <rlaager@pidgin.im>
parents: 21984
diff changeset
195 ui_main(void)
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
196 {
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
197 #ifndef _WIN32
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
198 GList *icons = NULL;
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
199 GdkPixbuf *icon = NULL;
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
200 char *icon_path;
34308
cdb187c27360 Fix the rest of Pidgin's warnings about -Wsign-compare; remove -Wno-sign-compare from cflags
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34296
diff changeset
201 gsize 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
202 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
203 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
204 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
205 } 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
206 {"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
207 {"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
208 {"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
209 {"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
210 {"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
211 };
d53fc4f13ff3 new icon goodness (i may have screwed this up, someone check)
Nathan Walp <nwalp@pidgin.im>
parents: 15931
diff changeset
212
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
213 #endif
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
214
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15498
diff changeset
215 pidgin_blist_setup_sort_methods();
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
216
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
217 #ifndef _WIN32
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
218 /* 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
219 for(i=0; i<G_N_ELEMENTS(icon_sizes); i++) {
35850
1abeda205d6c cross-win32: make dirs more flexible, add them to the config.h
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35794
diff changeset
220 icon_path = g_build_filename(PURPLE_DATADIR, "icons", "hicolor",
1abeda205d6c cross-win32: make dirs more flexible, add them to the config.h
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35794
diff changeset
221 icon_sizes[i].dir, "apps", icon_sizes[i].filename, NULL);
31889
96183796df0c Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents: 31881
diff changeset
222 icon = pidgin_pixbuf_new_from_file(icon_path);
16052
d53fc4f13ff3 new icon goodness (i may have screwed this up, someone check)
Nathan Walp <nwalp@pidgin.im>
parents: 15931
diff changeset
223 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
224 if (icon) {
d53fc4f13ff3 new icon goodness (i may have screwed this up, someone check)
Nathan Walp <nwalp@pidgin.im>
parents: 15931
diff changeset
225 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
226 } else {
d53fc4f13ff3 new icon goodness (i may have screwed this up, someone check)
Nathan Walp <nwalp@pidgin.im>
parents: 15931
diff changeset
227 purple_debug_error("ui_main",
22622
1ecb840b5101 Fix a bunch of compiler warnings caused by my addition of G_GNUC_PRINTF()
Mark Doliner <markdoliner@pidgin.im>
parents: 22565
diff changeset
228 "Failed to load the default window icon (%spx version)!\n", icon_sizes[i].dir);
16052
d53fc4f13ff3 new icon goodness (i may have screwed this up, someone check)
Nathan Walp <nwalp@pidgin.im>
parents: 15931
diff changeset
229 }
d53fc4f13ff3 new icon goodness (i may have screwed this up, someone check)
Nathan Walp <nwalp@pidgin.im>
parents: 15931
diff changeset
230 }
d53fc4f13ff3 new icon goodness (i may have screwed this up, someone check)
Nathan Walp <nwalp@pidgin.im>
parents: 15931
diff changeset
231 if(NULL == icons) {
d53fc4f13ff3 new icon goodness (i may have screwed this up, someone check)
Nathan Walp <nwalp@pidgin.im>
parents: 15931
diff changeset
232 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
233 } else {
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
234 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
235
d53fc4f13ff3 new icon goodness (i may have screwed this up, someone check)
Nathan Walp <nwalp@pidgin.im>
parents: 15931
diff changeset
236 g_list_foreach(icons, (GFunc)g_object_unref, NULL);
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
237 g_list_free(icons);
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
238 }
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
239 #endif
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
240
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
241 return 0;
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
242 }
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
243
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
244 static void
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
245 debug_init(void)
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
246 {
38645
bf3f91939dc5 Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 38578
diff changeset
247 PidginDebugUi *ui = pidgin_debug_ui_new();
bf3f91939dc5 Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 38578
diff changeset
248 purple_debug_set_ui(PURPLE_DEBUG_UI(ui));
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
249 }
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
250
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
251 static void
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15498
diff changeset
252 pidgin_ui_init(void)
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
253 {
22481
d8a9e927c90f Initialize the stock stuff before doing anything else so that stock items used in error messages are ready to be used. Fixes #4917.
Daniel Atallah <datallah@pidgin.im>
parents: 22187
diff changeset
254 pidgin_stock_init();
d8a9e927c90f Initialize the stock stuff before doing anything else so that stock items used in error messages are ready to be used. Fixes #4917.
Daniel Atallah <datallah@pidgin.im>
parents: 22187
diff changeset
255
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
256 /* Set the UI operation structures. */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
257 purple_accounts_set_ui_ops(pidgin_accounts_get_ui_ops());
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
258 purple_xfers_set_ui_ops(pidgin_xfers_get_ui_ops());
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
259 purple_blist_set_ui_ops(pidgin_blist_get_ui_ops());
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
260 purple_notify_set_ui_ops(pidgin_notify_get_ui_ops());
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
261 purple_request_set_ui_ops(pidgin_request_get_ui_ops());
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
262 purple_sound_set_ui_ops(pidgin_sound_get_ui_ops());
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
263 purple_connections_set_ui_ops(pidgin_connections_get_ui_ops());
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
264 purple_whiteboard_set_ui_ops(pidgin_whiteboard_get_ui_ops());
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
265 purple_idle_set_ui_ops(pidgin_idle_get_ui_ops());
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
266
34587
a3bc28bb4ef5 Refactored pidgin to use the GObject-based PurpleAccount API
Ankit Vani <a@nevitus.org>
parents: 33955
diff changeset
267 pidgin_accounts_init();
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15498
diff changeset
268 pidgin_connection_init();
34502
433382371e89 Request API: datasheet field
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34308
diff changeset
269 pidgin_request_init();
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15498
diff changeset
270 pidgin_blist_init();
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15498
diff changeset
271 pidgin_status_init();
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15498
diff changeset
272 pidgin_conversations_init();
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15498
diff changeset
273 pidgin_pounces_init();
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15498
diff changeset
274 pidgin_privacy_init();
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15498
diff changeset
275 pidgin_xfers_init();
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15498
diff changeset
276 pidgin_roomlist_init();
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15498
diff changeset
277 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
278 pidgin_docklet_init();
35781
8c621fbbee8e Comments: PidginSmileyTheme
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35756
diff changeset
279 _pidgin_smiley_theme_init();
24674
36bf974a7d78 Allow plugins to specify custom link types to the GtkIMHtml widget.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24585
diff changeset
280 pidgin_utils_init();
26269
cacc598079e4 Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents: 24585
diff changeset
281 pidgin_medias_init();
27476
d44640cb5686 Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents: 27361
diff changeset
282 pidgin_notify_init();
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
283 }
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
284
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
285 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
286
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
287 static void
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15498
diff changeset
288 pidgin_quit(void)
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
289 {
10574
5abb2931b6ff [gaim-migrate @ 11966]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10448
diff changeset
290 /* Uninit */
38645
bf3f91939dc5 Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 38578
diff changeset
291 PurpleDebugUi *ui;
bf3f91939dc5 Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 38578
diff changeset
292
24674
36bf974a7d78 Allow plugins to specify custom link types to the GtkIMHtml widget.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24585
diff changeset
293 pidgin_utils_uninit();
27476
d44640cb5686 Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents: 27361
diff changeset
294 pidgin_notify_uninit();
35781
8c621fbbee8e Comments: PidginSmileyTheme
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35756
diff changeset
295 _pidgin_smiley_theme_uninit();
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15498
diff changeset
296 pidgin_conversations_uninit();
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15498
diff changeset
297 pidgin_status_uninit();
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15498
diff changeset
298 pidgin_docklet_uninit();
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15498
diff changeset
299 pidgin_blist_uninit();
34502
433382371e89 Request API: datasheet field
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34308
diff changeset
300 pidgin_request_uninit();
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15498
diff changeset
301 pidgin_connection_uninit();
34587
a3bc28bb4ef5 Refactored pidgin to use the GObject-based PurpleAccount API
Ankit Vani <a@nevitus.org>
parents: 33955
diff changeset
302 pidgin_accounts_uninit();
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15498
diff changeset
303 pidgin_xfers_uninit();
38645
bf3f91939dc5 Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 38578
diff changeset
304 ui = purple_debug_get_ui();
bf3f91939dc5 Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 38578
diff changeset
305 purple_debug_set_ui(NULL);
bf3f91939dc5 Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 38578
diff changeset
306 g_object_unref(ui);
10574
5abb2931b6ff [gaim-migrate @ 11966]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10448
diff changeset
307
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
308 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
309 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
310
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
311 /* and end it all... */
38383
0ceb576f5617 libpidgin: Port to use GtkApplication
Mike Ruprecht <cmaiku@gmail.com>
parents: 38240
diff changeset
312 g_application_quit(g_application_get_default());
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
313 }
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
314
22104
56970903b8e9 Probe for -Wstrict-prototypes to get some more warnings. I then cleaned up
Richard Laager <rlaager@pidgin.im>
parents: 21984
diff changeset
315 static GHashTable *pidgin_ui_get_info(void)
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
316 {
99c6a0271b1d UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents: 18256
diff changeset
317 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
318 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
319
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 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
321 g_hash_table_insert(ui_info, "version", VERSION);
33955
55aa58076485 Use https URLs for pidgin.im and developer.pidgin.im.
Mark Doliner <mark@kingant.net>
parents: 33940
diff changeset
322 g_hash_table_insert(ui_info, "website", "https://pidgin.im");
55aa58076485 Use https URLs for pidgin.im and developer.pidgin.im.
Mark Doliner <mark@kingant.net>
parents: 33940
diff changeset
323 g_hash_table_insert(ui_info, "dev_website", "https://developer.pidgin.im");
25578
c0c1b73f4fb1 Changed "type" to "client_type" for the hash value specifying client type
Marcus Lundblad <malu@pidgin.im>
parents: 25577
diff changeset
324 g_hash_table_insert(ui_info, "client_type", "pc");
27685
6e8ce73aa4a4 Use a custom clientkey for AIM and ICQ for Pidgin and Finch
Mark Doliner <markdoliner@pidgin.im>
parents: 27476
diff changeset
325
6e8ce73aa4a4 Use a custom clientkey for AIM and ICQ for Pidgin and Finch
Mark Doliner <markdoliner@pidgin.im>
parents: 27476
diff changeset
326 /*
38205
bbd7e672b3af For AIM, use the DevID and the DistID supplied to us by an AOL representative via the devel mailing list in September 2016.
Robert Vehse <robertvehse@fastmail.fm>
parents: 36256
diff changeset
327 * prpl-aim-clientkey is a DevID (or "client key") for Pidgin, given to
38206
3118251ccdef Fix a typo. Thanks, Maiku.
Robert Vehse <robertvehse@fastmail.fm>
parents: 38205
diff changeset
328 * us by AOL in September 2016. prpl-icq-clientkey is also a client key
38205
bbd7e672b3af For AIM, use the DevID and the DistID supplied to us by an AOL representative via the devel mailing list in September 2016.
Robert Vehse <robertvehse@fastmail.fm>
parents: 36256
diff changeset
329 * for Pidgin, owned by the AIM account "markdoliner." Please don't use
bbd7e672b3af For AIM, use the DevID and the DistID supplied to us by an AOL representative via the devel mailing list in September 2016.
Robert Vehse <robertvehse@fastmail.fm>
parents: 36256
diff changeset
330 * either for other applications. Instead, you can either not specify a
bbd7e672b3af For AIM, use the DevID and the DistID supplied to us by an AOL representative via the devel mailing list in September 2016.
Robert Vehse <robertvehse@fastmail.fm>
parents: 36256
diff changeset
331 * client key, in which case the default "libpurple" key will be used,
bbd7e672b3af For AIM, use the DevID and the DistID supplied to us by an AOL representative via the devel mailing list in September 2016.
Robert Vehse <robertvehse@fastmail.fm>
parents: 36256
diff changeset
332 * or you can try to register your own at the AIM or ICQ web sites
bbd7e672b3af For AIM, use the DevID and the DistID supplied to us by an AOL representative via the devel mailing list in September 2016.
Robert Vehse <robertvehse@fastmail.fm>
parents: 36256
diff changeset
333 * (although this functionality was removed at some point, it's possible
bbd7e672b3af For AIM, use the DevID and the DistID supplied to us by an AOL representative via the devel mailing list in September 2016.
Robert Vehse <robertvehse@fastmail.fm>
parents: 36256
diff changeset
334 * it has been re-added).
27685
6e8ce73aa4a4 Use a custom clientkey for AIM and ICQ for Pidgin and Finch
Mark Doliner <markdoliner@pidgin.im>
parents: 27476
diff changeset
335 */
38205
bbd7e672b3af For AIM, use the DevID and the DistID supplied to us by an AOL representative via the devel mailing list in September 2016.
Robert Vehse <robertvehse@fastmail.fm>
parents: 36256
diff changeset
336 g_hash_table_insert(ui_info, "prpl-aim-clientkey", "do1UCeb5gNqxB1S1");
27685
6e8ce73aa4a4 Use a custom clientkey for AIM and ICQ for Pidgin and Finch
Mark Doliner <markdoliner@pidgin.im>
parents: 27476
diff changeset
337 g_hash_table_insert(ui_info, "prpl-icq-clientkey", "ma1cSASNCKFtrdv9");
27688
8c89470bfe9d Oh, we don't need a special ui_info field for the AIM clientstring
Mark Doliner <markdoliner@pidgin.im>
parents: 27685
diff changeset
338
8c89470bfe9d Oh, we don't need a special ui_info field for the AIM clientstring
Mark Doliner <markdoliner@pidgin.im>
parents: 27685
diff changeset
339 /*
38205
bbd7e672b3af For AIM, use the DevID and the DistID supplied to us by an AOL representative via the devel mailing list in September 2016.
Robert Vehse <robertvehse@fastmail.fm>
parents: 36256
diff changeset
340 * prpl-aim-distid is a distID for Pidgin, given to us by AOL in
bbd7e672b3af For AIM, use the DevID and the DistID supplied to us by an AOL representative via the devel mailing list in September 2016.
Robert Vehse <robertvehse@fastmail.fm>
parents: 36256
diff changeset
341 * September 2016. prpl-icq-distid is also a distID for Pidgin, given
bbd7e672b3af For AIM, use the DevID and the DistID supplied to us by an AOL representative via the devel mailing list in September 2016.
Robert Vehse <robertvehse@fastmail.fm>
parents: 36256
diff changeset
342 * to us by AOL. Please don't use either for other applications.
bbd7e672b3af For AIM, use the DevID and the DistID supplied to us by an AOL representative via the devel mailing list in September 2016.
Robert Vehse <robertvehse@fastmail.fm>
parents: 36256
diff changeset
343 * Instead, you can just not specify a distID and libpurple will use a
bbd7e672b3af For AIM, use the DevID and the DistID supplied to us by an AOL representative via the devel mailing list in September 2016.
Robert Vehse <robertvehse@fastmail.fm>
parents: 36256
diff changeset
344 * default.
27688
8c89470bfe9d Oh, we don't need a special ui_info field for the AIM clientstring
Mark Doliner <markdoliner@pidgin.im>
parents: 27685
diff changeset
345 */
38205
bbd7e672b3af For AIM, use the DevID and the DistID supplied to us by an AOL representative via the devel mailing list in September 2016.
Robert Vehse <robertvehse@fastmail.fm>
parents: 36256
diff changeset
346 g_hash_table_insert(ui_info, "prpl-aim-distid", GINT_TO_POINTER(1715));
27688
8c89470bfe9d Oh, we don't need a special ui_info field for the AIM clientstring
Mark Doliner <markdoliner@pidgin.im>
parents: 27685
diff changeset
347 g_hash_table_insert(ui_info, "prpl-icq-distid", GINT_TO_POINTER(1550));
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
348 }
99c6a0271b1d UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents: 18256
diff changeset
349
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 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
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
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
353 static PurpleCoreUiOps core_ops =
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
354 {
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15498
diff changeset
355 pidgin_prefs_init,
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
356 debug_init,
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15498
diff changeset
357 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
358 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
359 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
360 NULL,
e6bcb1628c57 Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents: 16545
diff changeset
361 NULL,
35024
eb3afb7643ce Added /*< private >*/ for padding members, clean them up and add missing ones
Ankit Vani <a@nevitus.org>
parents: 34910
diff changeset
362 NULL,
16752
e6bcb1628c57 Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents: 16545
diff changeset
363 NULL
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
364 };
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
365
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
366 static PurpleCoreUiOps *
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15498
diff changeset
367 pidgin_core_get_ui_ops(void)
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
368 {
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
369 return &core_ops;
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
370 }
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
371
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
372 static void
38383
0ceb576f5617 libpidgin: Port to use GtkApplication
Mike Ruprecht <cmaiku@gmail.com>
parents: 38240
diff changeset
373 pidgin_activate_cb(GApplication *application, gpointer user_data)
0ceb576f5617 libpidgin: Port to use GtkApplication
Mike Ruprecht <cmaiku@gmail.com>
parents: 38240
diff changeset
374 {
0ceb576f5617 libpidgin: Port to use GtkApplication
Mike Ruprecht <cmaiku@gmail.com>
parents: 38240
diff changeset
375 purple_blist_set_visible(TRUE);
0ceb576f5617 libpidgin: Port to use GtkApplication
Mike Ruprecht <cmaiku@gmail.com>
parents: 38240
diff changeset
376 }
0ceb576f5617 libpidgin: Port to use GtkApplication
Mike Ruprecht <cmaiku@gmail.com>
parents: 38240
diff changeset
377
38594
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
378 static gboolean debug_colored = FALSE;
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
379 static gboolean debug_enabled = FALSE;
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
380 static gboolean opt_login = FALSE;
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
381 static gchar *opt_login_arg = NULL;
12846
93ff2d8dd1e7 [gaim-migrate @ 15194]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents: 12838
diff changeset
382
38594
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
383 static gboolean
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
384 debug_opt_arg_func(const gchar *option_name, const gchar *value,
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
385 gpointer data, GError **error)
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
386 {
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
387 debug_enabled = TRUE;
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
388
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
389 if (purple_strequal(value, "colored")) {
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
390 debug_colored = TRUE;
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
391 }
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
392
38594
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
393 return TRUE;
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
394 }
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
395
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
396 static gboolean
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
397 login_opt_arg_func(const gchar *option_name, const gchar *value,
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
398 gpointer data, GError **error)
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
399 {
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
400 opt_login = TRUE;
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
401
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
402 g_free(opt_login_arg);
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
403 opt_login_arg = g_strdup(value);
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
404
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
405 return TRUE;
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
406 }
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
407
35387
c516874b0d14 Prepare files for gtk-doc conversion.
Ankit Vani <a@nevitus.org>
parents: 35194
diff changeset
408 int pidgin_start(int argc, char *argv[])
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
409 {
38383
0ceb576f5617 libpidgin: Port to use GtkApplication
Mike Ruprecht <cmaiku@gmail.com>
parents: 38240
diff changeset
410 GApplication *app;
24999
84d597b7e7c6 Add a -f/--force-online option to Pidgin which tells libpurple to claim the
Richard Laager <rlaager@pidgin.im>
parents: 24674
diff changeset
411 gboolean opt_force_online = FALSE;
10323
f4a013ac9e7c [gaim-migrate @ 11530]
Mark Doliner <markdoliner@pidgin.im>
parents: 10322
diff changeset
412 gboolean opt_nologin = FALSE;
f4a013ac9e7c [gaim-migrate @ 11530]
Mark Doliner <markdoliner@pidgin.im>
parents: 10322
diff changeset
413 gboolean opt_version = FALSE;
18207
e89bf4430ea6 Allow disabling check for single instance.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18191
diff changeset
414 gboolean opt_si = TRUE; /* Check for single instance? */
10323
f4a013ac9e7c [gaim-migrate @ 11530]
Mark Doliner <markdoliner@pidgin.im>
parents: 10322
diff changeset
415 char *opt_config_dir_arg = NULL;
10447
887380ec66f5 [gaim-migrate @ 11712]
Mark Doliner <markdoliner@pidgin.im>
parents: 10433
diff changeset
416 char *search_path;
33926
0c11d752fbe4 Load custom CSS for styling on GTK+3.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33890
diff changeset
417 GtkCssProvider *provider;
0c11d752fbe4 Load custom CSS for styling on GTK+3.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33890
diff changeset
418 GdkScreen *screen;
18122
9bf9970c1b6a disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents: 18121
diff changeset
419 GList *accounts;
38064
7cb860a7bb2e libpidgin: Fix Win32 build due to lacking signalpair() and some enums
Mike Ruprecht <cmaiku@gmail.com>
parents: 38048
diff changeset
420 #ifndef _WIN32
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
421 int sig_indx; /* for setting up signal catching */
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
422 sigset_t sigset;
10323
f4a013ac9e7c [gaim-migrate @ 11530]
Mark Doliner <markdoliner@pidgin.im>
parents: 10322
diff changeset
423 char errmsg[BUFSIZ];
28820
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
424 GIOChannel *signal_channel;
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
425 GIOStatus signal_status;
29991
37e306c31983 Try to be polite and free stuff associated with our signal watcher pipes
Mark Doliner <markdoliner@pidgin.im>
parents: 29662
diff changeset
426 guint signal_channel_watcher;
13215
c3e72e316531 [gaim-migrate @ 15578]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents: 13111
diff changeset
427 #ifndef DEBUG
c3e72e316531 [gaim-migrate @ 15578]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents: 13111
diff changeset
428 char *segfault_message_tmp;
37422
07dcc28b6039 Remove support for GTK+2
Jorge Villaseñor <salinasv@pidgin.im>
parents: 37158
diff changeset
429 #endif /* DEBUG */
38064
7cb860a7bb2e libpidgin: Fix Win32 build due to lacking signalpair() and some enums
Mike Ruprecht <cmaiku@gmail.com>
parents: 38048
diff changeset
430 #endif /* !_WIN32 */
38594
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
431 GOptionContext *context;
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
432 gchar *summary;
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
433 gchar **args;
14636
5306c329992c [gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents: 14623
diff changeset
434 gboolean gui_check;
18121
2d8ea56b9097 Mark the return type const for the following functions. I noticed this
Richard Laager <rlaager@pidgin.im>
parents: 18093
diff changeset
435 GList *active_accounts;
33940
b44d15793c83 Use GStatBuf instead of struct stat
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33929
diff changeset
436 GStatBuf st;
38607
51b50879b5c9 libpidgin: Fix Windows crash by initializing error to NULL
Mike Ruprecht <cmaiku@gmail.com>
parents: 38578
diff changeset
437 GError *error = NULL;
38383
0ceb576f5617 libpidgin: Port to use GtkApplication
Mike Ruprecht <cmaiku@gmail.com>
parents: 38240
diff changeset
438 int ret;
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
439
38594
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
440 GOptionEntry option_entries[] = {
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
441 {"config", 'c', 0,
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
442 G_OPTION_ARG_FILENAME, &opt_config_dir_arg,
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
443 _("use DIR for config files"), _("DIR")},
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
444 {"debug", 'd', G_OPTION_FLAG_OPTIONAL_ARG,
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
445 G_OPTION_ARG_CALLBACK, &debug_opt_arg_func,
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
446 _("print debugging messages to stdout"),
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
447 _("[colored]")},
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
448 {"force-online", 'f', 0,
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
449 G_OPTION_ARG_NONE, &opt_force_online,
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
450 _("force online, regardless of network status"), NULL},
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
451 {"login", 'l', G_OPTION_FLAG_OPTIONAL_ARG,
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
452 G_OPTION_ARG_CALLBACK, &login_opt_arg_func,
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
453 _("enable specified account(s) (optional argument NAME\n"
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
454 " "
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
455 "specifies account(s) to use, separated by commas.\n"
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
456 " "
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
457 "Without this only the first account will be enabled)"),
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
458 _("[NAME]")},
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
459 {"multiple", 'm', G_OPTION_FLAG_REVERSE,
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
460 G_OPTION_ARG_NONE, &opt_si,
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
461 _("allow multiple instances"), NULL},
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
462 {"nologin", 'n', 0,
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
463 G_OPTION_ARG_NONE, &opt_nologin,
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
464 _("don't automatically login"), NULL},
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
465 {"version", 'v', 0,
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
466 G_OPTION_ARG_NONE, &opt_version,
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
467 _("display the current version and exit"), NULL},
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
468 {NULL}
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
469 };
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
470
34296
d31a4f3b547e Debug log: optional colored output and no need for add linefeed at the end of each message
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34293
diff changeset
471 debug_colored = FALSE;
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
472 #ifdef DEBUG
10307
f3ba80364053 [gaim-migrate @ 11497]
Mark Doliner <markdoliner@pidgin.im>
parents: 10306
diff changeset
473 debug_enabled = TRUE;
f3ba80364053 [gaim-migrate @ 11497]
Mark Doliner <markdoliner@pidgin.im>
parents: 10306
diff changeset
474 #else
f3ba80364053 [gaim-migrate @ 11497]
Mark Doliner <markdoliner@pidgin.im>
parents: 10306
diff changeset
475 debug_enabled = FALSE;
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
476 #endif
17105
c0a8e07ee507 disapproval of revision 'd3231850edf096c5afacfab40b53717b34098355'
Sean Egan <seanegan@pidgin.im>
parents: 17104
diff changeset
477
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
478 #ifdef ENABLE_NLS
35850
1abeda205d6c cross-win32: make dirs more flexible, add them to the config.h
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35794
diff changeset
479 bindtextdomain(PACKAGE, PURPLE_LOCALEDIR);
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
480 bind_textdomain_codeset(PACKAGE, "UTF-8");
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
481 textdomain(PACKAGE);
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
482 #endif
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
483
13090
aee4ed853ff3 [gaim-migrate @ 15451]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents: 13024
diff changeset
484 /* 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
485 setlocale(LC_ALL, "");
11080
0578003800d0 [gaim-migrate @ 13092]
Piotr Zielinski <zielaj@users.sourceforge.net>
parents: 11067
diff changeset
486
38064
7cb860a7bb2e libpidgin: Fix Win32 build due to lacking signalpair() and some enums
Mike Ruprecht <cmaiku@gmail.com>
parents: 38048
diff changeset
487 #ifndef _WIN32
7cb860a7bb2e libpidgin: Fix Win32 build due to lacking signalpair() and some enums
Mike Ruprecht <cmaiku@gmail.com>
parents: 38048
diff changeset
488
12556
f4d4e4e3a825 [gaim-migrate @ 14875]
Richard Laager <rlaager@pidgin.im>
parents: 12409
diff changeset
489 #ifndef DEBUG
f4d4e4e3a825 [gaim-migrate @ 14875]
Richard Laager <rlaager@pidgin.im>
parents: 12409
diff changeset
490 /* 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
491 segfault_message_tmp = g_strdup_printf(_(
20395
81c963c89157 Include the version in the segfault message - enough people blindly copy
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20346
diff changeset
492 "%s %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
493 "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
494 "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
495 "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
496 "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
497 "%ssimpleticket/\n\n"
12556
f4d4e4e3a825 [gaim-migrate @ 14875]
Richard Laager <rlaager@pidgin.im>
parents: 12409
diff changeset
498 "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
499 "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
500 "how to get the backtrace, please read the instructions at\n"
24585
25d84f35abf8 kluge pointed out that the segfault message still recommends people IM
Richard Laager <rlaager@pidgin.im>
parents: 23545
diff changeset
501 "%swiki/GetABacktrace\n"),
25d84f35abf8 kluge pointed out that the segfault message still recommends people IM
Richard Laager <rlaager@pidgin.im>
parents: 23545
diff changeset
502 PIDGIN_NAME, DISPLAY_VERSION, PURPLE_DEVEL_WEBSITE, PURPLE_DEVEL_WEBSITE
13090
aee4ed853ff3 [gaim-migrate @ 15451]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents: 13024
diff changeset
503 );
13587
fb0245a7ccab [gaim-migrate @ 15971]
Daniel Atallah <datallah@pidgin.im>
parents: 13429
diff changeset
504
13215
c3e72e316531 [gaim-migrate @ 15578]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents: 13111
diff changeset
505 /* 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
506 charset) early because after a segmentation fault
c3e72e316531 [gaim-migrate @ 15578]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents: 13111
diff changeset
507 it's not a good practice to allocate memory */
13587
fb0245a7ccab [gaim-migrate @ 15971]
Daniel Atallah <datallah@pidgin.im>
parents: 13429
diff changeset
508 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
509 -1, NULL, NULL, &error);
c3e72e316531 [gaim-migrate @ 15578]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents: 13111
diff changeset
510 if (segfault_message != NULL) {
c3e72e316531 [gaim-migrate @ 15578]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents: 13111
diff changeset
511 g_free(segfault_message_tmp);
c3e72e316531 [gaim-migrate @ 15578]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents: 13111
diff changeset
512 }
c3e72e316531 [gaim-migrate @ 15578]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents: 13111
diff changeset
513 else {
c3e72e316531 [gaim-migrate @ 15578]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents: 13111
diff changeset
514 /* 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
515 g_warning("%s\n", error->message);
38607
51b50879b5c9 libpidgin: Fix Windows crash by initializing error to NULL
Mike Ruprecht <cmaiku@gmail.com>
parents: 38578
diff changeset
516 g_clear_error(&error);
13215
c3e72e316531 [gaim-migrate @ 15578]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents: 13111
diff changeset
517 segfault_message = segfault_message_tmp;
c3e72e316531 [gaim-migrate @ 15578]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents: 13111
diff changeset
518 }
12556
f4d4e4e3a825 [gaim-migrate @ 14875]
Richard Laager <rlaager@pidgin.im>
parents: 12409
diff changeset
519 #else
f4d4e4e3a825 [gaim-migrate @ 14875]
Richard Laager <rlaager@pidgin.im>
parents: 12409
diff changeset
520 /* Don't mark this for translation. */
f4d4e4e3a825 [gaim-migrate @ 14875]
Richard Laager <rlaager@pidgin.im>
parents: 12409
diff changeset
521 segfault_message = g_strdup(
f4d4e4e3a825 [gaim-migrate @ 14875]
Richard Laager <rlaager@pidgin.im>
parents: 12409
diff changeset
522 "Hi, user. We need to talk.\n"
f4d4e4e3a825 [gaim-migrate @ 14875]
Richard Laager <rlaager@pidgin.im>
parents: 12409
diff changeset
523 "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
524 "No, really, it's not you... it's me... no no no, I think we get along well\n"
12670
54597c65a004 [gaim-migrate @ 15013]
Will Thompson <resiak@pidgin.im>
parents: 12600
diff changeset
525 "it's just that.... well, I want to see other people. I... what?!? NO! I \n"
54597c65a004 [gaim-migrate @ 15013]
Will Thompson <resiak@pidgin.im>
parents: 12600
diff changeset
526 "haven't been cheating on you!! How many times do you want me to tell you?! And\n"
54597c65a004 [gaim-migrate @ 15013]
Will Thompson <resiak@pidgin.im>
parents: 12600
diff changeset
527 "for the last time, it's just a rash!\n"
12556
f4d4e4e3a825 [gaim-migrate @ 14875]
Richard Laager <rlaager@pidgin.im>
parents: 12409
diff changeset
528 );
f4d4e4e3a825 [gaim-migrate @ 14875]
Richard Laager <rlaager@pidgin.im>
parents: 12409
diff changeset
529 #endif
f4d4e4e3a825 [gaim-migrate @ 14875]
Richard Laager <rlaager@pidgin.im>
parents: 12409
diff changeset
530
28820
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
531 /*
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
532 * Create a socket pair for receiving unix signals from a signal
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
533 * handler.
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
534 */
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
535 if (socketpair(AF_UNIX, SOCK_STREAM, 0, signal_sockets) < 0) {
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
536 perror("Failed to create sockets for GLib signal handling");
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
537 exit(1);
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
538 }
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
539 signal_channel = g_io_channel_unix_new(signal_sockets[1]);
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
540
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
541 /*
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
542 * Set the channel encoding to raw binary instead of the default of
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
543 * UTF-8, because we'll be sending integers across instead of strings.
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
544 */
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
545 signal_status = g_io_channel_set_encoding(signal_channel, NULL, &error);
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
546 if (signal_status != G_IO_STATUS_NORMAL) {
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
547 fprintf(stderr, "Failed to set the signal channel to raw "
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
548 "binary: %s", error->message);
38607
51b50879b5c9 libpidgin: Fix Windows crash by initializing error to NULL
Mike Ruprecht <cmaiku@gmail.com>
parents: 38578
diff changeset
549 g_clear_error(&error);
28820
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
550 exit(1);
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
551 }
29991
37e306c31983 Try to be polite and free stuff associated with our signal watcher pipes
Mark Doliner <markdoliner@pidgin.im>
parents: 29662
diff changeset
552 signal_channel_watcher = g_io_add_watch(signal_channel, G_IO_IN, mainloop_sighandler, NULL);
37e306c31983 Try to be polite and free stuff associated with our signal watcher pipes
Mark Doliner <markdoliner@pidgin.im>
parents: 29662
diff changeset
553 g_io_channel_unref(signal_channel);
28820
58701e24ed40 We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents: 28800
diff changeset
554
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
555 /* Let's not violate any PLA's!!!! */
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
556 /* jseymour: whatever the fsck that means */
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
557 /* Robot101: for some reason things like gdm like to block *
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
558 * useful signals like SIGCHLD, so we unblock all the ones we *
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
559 * declare a handler for. thanks JSeymour and Vann. */
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
560 if (sigemptyset(&sigset)) {
29991
37e306c31983 Try to be polite and free stuff associated with our signal watcher pipes
Mark Doliner <markdoliner@pidgin.im>
parents: 29662
diff changeset
561 snprintf(errmsg, sizeof(errmsg), "Warning: couldn't initialise empty signal set");
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
562 perror(errmsg);
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
563 }
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
564 for(sig_indx = 0; catch_sig_list[sig_indx] != -1; ++sig_indx) {
33794
716cbef8d1c6 Fix a number of additional trivial issues - unused variables, etc.
Daniel Atallah <datallah@pidgin.im>
parents: 33371
diff changeset
565 if(signal(catch_sig_list[sig_indx], sighandler) == SIG_ERR) {
29991
37e306c31983 Try to be polite and free stuff associated with our signal watcher pipes
Mark Doliner <markdoliner@pidgin.im>
parents: 29662
diff changeset
566 snprintf(errmsg, sizeof(errmsg), "Warning: couldn't set signal %d for catching",
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
567 catch_sig_list[sig_indx]);
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
568 perror(errmsg);
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
569 }
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
570 if(sigaddset(&sigset, catch_sig_list[sig_indx])) {
29991
37e306c31983 Try to be polite and free stuff associated with our signal watcher pipes
Mark Doliner <markdoliner@pidgin.im>
parents: 29662
diff changeset
571 snprintf(errmsg, sizeof(errmsg), "Warning: couldn't include signal %d for unblocking",
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
572 catch_sig_list[sig_indx]);
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
573 perror(errmsg);
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
574 }
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
575 }
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
576 for(sig_indx = 0; ignore_sig_list[sig_indx] != -1; ++sig_indx) {
33794
716cbef8d1c6 Fix a number of additional trivial issues - unused variables, etc.
Daniel Atallah <datallah@pidgin.im>
parents: 33371
diff changeset
577 if(signal(ignore_sig_list[sig_indx], SIG_IGN) == SIG_ERR) {
29991
37e306c31983 Try to be polite and free stuff associated with our signal watcher pipes
Mark Doliner <markdoliner@pidgin.im>
parents: 29662
diff changeset
578 snprintf(errmsg, sizeof(errmsg), "Warning: couldn't set signal %d to ignore",
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
579 ignore_sig_list[sig_indx]);
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
580 perror(errmsg);
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
581 }
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
582 }
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
583
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
584 if (sigprocmask(SIG_UNBLOCK, &sigset, NULL)) {
29991
37e306c31983 Try to be polite and free stuff associated with our signal watcher pipes
Mark Doliner <markdoliner@pidgin.im>
parents: 29662
diff changeset
585 snprintf(errmsg, sizeof(errmsg), "Warning: couldn't unblock signals");
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
586 perror(errmsg);
10307
f3ba80364053 [gaim-migrate @ 11497]
Mark Doliner <markdoliner@pidgin.im>
parents: 10306
diff changeset
587 }
38064
7cb860a7bb2e libpidgin: Fix Win32 build due to lacking signalpair() and some enums
Mike Ruprecht <cmaiku@gmail.com>
parents: 38048
diff changeset
588 #endif /* !_WIN32 */
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
589
38594
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
590 context = g_option_context_new(NULL);
38800
8a2ea9672bcb Add the gplugin GOptionGroup to the GOptionContext of both Pidgin and Finch
Gary Kramlich <grim@reaperworld.com>
parents: 38647
diff changeset
591 g_option_context_add_group(context, gplugin_get_option_group());
38594
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
592
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
593 summary = g_strdup_printf("%s %s", PIDGIN_NAME, DISPLAY_VERSION);
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
594 g_option_context_set_summary(context, summary);
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
595 g_free(summary);
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
596
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
597 g_option_context_add_main_entries(context, option_entries, PACKAGE);
38595
9c113657d183 libpidgin: Open display when parsing arguments to simplify code
Mike Ruprecht <cmaiku@gmail.com>
parents: 38594
diff changeset
598 g_option_context_add_group(context, gtk_get_option_group(TRUE));
38594
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
599
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
600 #ifdef G_OS_WIN32
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
601 /* Handle Unicode filenames on Windows. See GOptionContext docs. */
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
602 args = g_win32_get_command_line();
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
603 #else
38594
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
604 args = g_strdupv(argv);
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
605 #endif
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
606
38594
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
607 if (!g_option_context_parse_strv(context, &args, &error)) {
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
608 g_strfreev(args);
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
609 g_printerr(_("%s %s: %s\nTry `%s -h' for more information.\n"),
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
610 PIDGIN_NAME, DISPLAY_VERSION, error->message,
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
611 argv[0]);
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
612 g_clear_error(&error);
38064
7cb860a7bb2e libpidgin: Fix Win32 build due to lacking signalpair() and some enums
Mike Ruprecht <cmaiku@gmail.com>
parents: 38048
diff changeset
613 #ifndef _WIN32
16193
e27165dcba9b Free segfault_message when Pidgin exits abnormally
Mark Doliner <markdoliner@pidgin.im>
parents: 16158
diff changeset
614 g_free(segfault_message);
38064
7cb860a7bb2e libpidgin: Fix Win32 build due to lacking signalpair() and some enums
Mike Ruprecht <cmaiku@gmail.com>
parents: 38048
diff changeset
615 #endif
38594
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
616 return 1;
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
617 }
38594
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
618
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
619 g_strfreev(args);
eb2d289be0fe libpidgin: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38593
diff changeset
620
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
621 /* show version message */
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
622 if (opt_version) {
25702
41a5336bc2d6 applied changes from 20269e8849976ad6a0996f79ccbc0a12a311484f
Ethan Blanton <elb@pidgin.im>
parents: 25460
diff changeset
623 printf("%s %s (libpurple %s)\n", PIDGIN_NAME, DISPLAY_VERSION,
41a5336bc2d6 applied changes from 20269e8849976ad6a0996f79ccbc0a12a311484f
Ethan Blanton <elb@pidgin.im>
parents: 25460
diff changeset
624 purple_core_get_version());
38064
7cb860a7bb2e libpidgin: Fix Win32 build due to lacking signalpair() and some enums
Mike Ruprecht <cmaiku@gmail.com>
parents: 38048
diff changeset
625 #ifndef _WIN32
16193
e27165dcba9b Free segfault_message when Pidgin exits abnormally
Mark Doliner <markdoliner@pidgin.im>
parents: 16158
diff changeset
626 g_free(segfault_message);
38064
7cb860a7bb2e libpidgin: Fix Win32 build due to lacking signalpair() and some enums
Mike Ruprecht <cmaiku@gmail.com>
parents: 38048
diff changeset
627 #endif
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
628 return 0;
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
629 }
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
630
10323
f4a013ac9e7c [gaim-migrate @ 11530]
Mark Doliner <markdoliner@pidgin.im>
parents: 10322
diff changeset
631 /* set a user-specified config directory */
f4a013ac9e7c [gaim-migrate @ 11530]
Mark Doliner <markdoliner@pidgin.im>
parents: 10322
diff changeset
632 if (opt_config_dir_arg != NULL) {
32785
5e08d5a41442 pidgin/finch: Make relative paths absolute with -c
Paul Aurich <darkrain42@pidgin.im>
parents: 31992
diff changeset
633 if (g_path_is_absolute(opt_config_dir_arg)) {
5e08d5a41442 pidgin/finch: Make relative paths absolute with -c
Paul Aurich <darkrain42@pidgin.im>
parents: 31992
diff changeset
634 purple_util_set_user_dir(opt_config_dir_arg);
5e08d5a41442 pidgin/finch: Make relative paths absolute with -c
Paul Aurich <darkrain42@pidgin.im>
parents: 31992
diff changeset
635 } else {
5e08d5a41442 pidgin/finch: Make relative paths absolute with -c
Paul Aurich <darkrain42@pidgin.im>
parents: 31992
diff changeset
636 /* Make an absolute (if not canonical) path */
5e08d5a41442 pidgin/finch: Make relative paths absolute with -c
Paul Aurich <darkrain42@pidgin.im>
parents: 31992
diff changeset
637 char *cwd = g_get_current_dir();
5e08d5a41442 pidgin/finch: Make relative paths absolute with -c
Paul Aurich <darkrain42@pidgin.im>
parents: 31992
diff changeset
638 char *path = g_build_path(G_DIR_SEPARATOR_S, cwd, opt_config_dir_arg, NULL);
5e08d5a41442 pidgin/finch: Make relative paths absolute with -c
Paul Aurich <darkrain42@pidgin.im>
parents: 31992
diff changeset
639 purple_util_set_user_dir(path);
5e08d5a41442 pidgin/finch: Make relative paths absolute with -c
Paul Aurich <darkrain42@pidgin.im>
parents: 31992
diff changeset
640 g_free(path);
5e08d5a41442 pidgin/finch: Make relative paths absolute with -c
Paul Aurich <darkrain42@pidgin.im>
parents: 31992
diff changeset
641 g_free(cwd);
5e08d5a41442 pidgin/finch: Make relative paths absolute with -c
Paul Aurich <darkrain42@pidgin.im>
parents: 31992
diff changeset
642 }
10323
f4a013ac9e7c [gaim-migrate @ 11530]
Mark Doliner <markdoliner@pidgin.im>
parents: 10322
diff changeset
643 }
f4a013ac9e7c [gaim-migrate @ 11530]
Mark Doliner <markdoliner@pidgin.im>
parents: 10322
diff changeset
644
10448
4415ffba12e9 [gaim-migrate @ 11713]
Mark Doliner <markdoliner@pidgin.im>
parents: 10447
diff changeset
645 /*
4415ffba12e9 [gaim-migrate @ 11713]
Mark Doliner <markdoliner@pidgin.im>
parents: 10447
diff changeset
646 * We're done piddling around with command line arguments.
4415ffba12e9 [gaim-migrate @ 11713]
Mark Doliner <markdoliner@pidgin.im>
parents: 10447
diff changeset
647 * Fire up this baby.
4415ffba12e9 [gaim-migrate @ 11713]
Mark Doliner <markdoliner@pidgin.im>
parents: 10447
diff changeset
648 */
4415ffba12e9 [gaim-migrate @ 11713]
Mark Doliner <markdoliner@pidgin.im>
parents: 10447
diff changeset
649
35794
973dff96780a Debug: introduce PIDGIN_DEBUG_COLORED env var
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35781
diff changeset
650 if (g_getenv("PIDGIN_DEBUG_COLORED") != NULL)
973dff96780a Debug: introduce PIDGIN_DEBUG_COLORED env var
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35781
diff changeset
651 debug_colored = TRUE;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
652 purple_debug_set_enabled(debug_enabled);
34296
d31a4f3b547e Debug log: optional colored output and no need for add linefeed at the end of each message
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34293
diff changeset
653 purple_debug_set_colored(debug_colored);
10448
4415ffba12e9 [gaim-migrate @ 11713]
Mark Doliner <markdoliner@pidgin.im>
parents: 10447
diff changeset
654
38383
0ceb576f5617 libpidgin: Port to use GtkApplication
Mike Ruprecht <cmaiku@gmail.com>
parents: 38240
diff changeset
655 app = G_APPLICATION(gtk_application_new("im.pidgin.Pidgin",
0ceb576f5617 libpidgin: Port to use GtkApplication
Mike Ruprecht <cmaiku@gmail.com>
parents: 38240
diff changeset
656 G_APPLICATION_NON_UNIQUE));
0ceb576f5617 libpidgin: Port to use GtkApplication
Mike Ruprecht <cmaiku@gmail.com>
parents: 38240
diff changeset
657
38428
da70eb42306a libpidgin: Use GtkApplication session manager
Mike Ruprecht <cmaiku@gmail.com>
parents: 38383
diff changeset
658 g_object_set(app, "register-session", TRUE, NULL);
da70eb42306a libpidgin: Use GtkApplication session manager
Mike Ruprecht <cmaiku@gmail.com>
parents: 38383
diff changeset
659
38383
0ceb576f5617 libpidgin: Port to use GtkApplication
Mike Ruprecht <cmaiku@gmail.com>
parents: 38240
diff changeset
660 g_signal_connect(app, "activate",
0ceb576f5617 libpidgin: Port to use GtkApplication
Mike Ruprecht <cmaiku@gmail.com>
parents: 38240
diff changeset
661 G_CALLBACK(pidgin_activate_cb), NULL);
0ceb576f5617 libpidgin: Port to use GtkApplication
Mike Ruprecht <cmaiku@gmail.com>
parents: 38240
diff changeset
662
0ceb576f5617 libpidgin: Port to use GtkApplication
Mike Ruprecht <cmaiku@gmail.com>
parents: 38240
diff changeset
663 if (!g_application_register(app, NULL, &error)) {
0ceb576f5617 libpidgin: Port to use GtkApplication
Mike Ruprecht <cmaiku@gmail.com>
parents: 38240
diff changeset
664 purple_debug_error("gtk",
0ceb576f5617 libpidgin: Port to use GtkApplication
Mike Ruprecht <cmaiku@gmail.com>
parents: 38240
diff changeset
665 "Unable to register GApplication: %s\n",
0ceb576f5617 libpidgin: Port to use GtkApplication
Mike Ruprecht <cmaiku@gmail.com>
parents: 38240
diff changeset
666 error->message);
0ceb576f5617 libpidgin: Port to use GtkApplication
Mike Ruprecht <cmaiku@gmail.com>
parents: 38240
diff changeset
667 g_clear_error(&error);
0ceb576f5617 libpidgin: Port to use GtkApplication
Mike Ruprecht <cmaiku@gmail.com>
parents: 38240
diff changeset
668 g_object_unref(app);
0ceb576f5617 libpidgin: Port to use GtkApplication
Mike Ruprecht <cmaiku@gmail.com>
parents: 38240
diff changeset
669 #ifndef _WIN32
0ceb576f5617 libpidgin: Port to use GtkApplication
Mike Ruprecht <cmaiku@gmail.com>
parents: 38240
diff changeset
670 g_free(segfault_message);
0ceb576f5617 libpidgin: Port to use GtkApplication
Mike Ruprecht <cmaiku@gmail.com>
parents: 38240
diff changeset
671 #endif
0ceb576f5617 libpidgin: Port to use GtkApplication
Mike Ruprecht <cmaiku@gmail.com>
parents: 38240
diff changeset
672 return 1;
0ceb576f5617 libpidgin: Port to use GtkApplication
Mike Ruprecht <cmaiku@gmail.com>
parents: 38240
diff changeset
673 }
0ceb576f5617 libpidgin: Port to use GtkApplication
Mike Ruprecht <cmaiku@gmail.com>
parents: 38240
diff changeset
674
33926
0c11d752fbe4 Load custom CSS for styling on GTK+3.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33890
diff changeset
675 search_path = g_build_filename(purple_user_dir(), "gtk-3.0.css", NULL);
0c11d752fbe4 Load custom CSS for styling on GTK+3.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33890
diff changeset
676
0c11d752fbe4 Load custom CSS for styling on GTK+3.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33890
diff changeset
677 provider = gtk_css_provider_new();
0c11d752fbe4 Load custom CSS for styling on GTK+3.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33890
diff changeset
678 gui_check = gtk_css_provider_load_from_path(provider, search_path, &error);
0c11d752fbe4 Load custom CSS for styling on GTK+3.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33890
diff changeset
679
0c11d752fbe4 Load custom CSS for styling on GTK+3.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33890
diff changeset
680 if (gui_check && !error) {
0c11d752fbe4 Load custom CSS for styling on GTK+3.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33890
diff changeset
681 screen = gdk_screen_get_default();
0c11d752fbe4 Load custom CSS for styling on GTK+3.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33890
diff changeset
682 gtk_style_context_add_provider_for_screen(screen,
0c11d752fbe4 Load custom CSS for styling on GTK+3.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33890
diff changeset
683 GTK_STYLE_PROVIDER(provider),
0c11d752fbe4 Load custom CSS for styling on GTK+3.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33890
diff changeset
684 GTK_STYLE_PROVIDER_PRIORITY_USER);
0c11d752fbe4 Load custom CSS for styling on GTK+3.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33890
diff changeset
685 } else {
0c11d752fbe4 Load custom CSS for styling on GTK+3.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33890
diff changeset
686 purple_debug_error("gtk", "Unable to load custom gtk-3.0.css: %s\n",
0c11d752fbe4 Load custom CSS for styling on GTK+3.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33890
diff changeset
687 error ? error->message : "(unknown error)");
38607
51b50879b5c9 libpidgin: Fix Windows crash by initializing error to NULL
Mike Ruprecht <cmaiku@gmail.com>
parents: 38578
diff changeset
688 g_clear_error(&error);
33926
0c11d752fbe4 Load custom CSS for styling on GTK+3.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33890
diff changeset
689 }
0c11d752fbe4 Load custom CSS for styling on GTK+3.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33890
diff changeset
690
0c11d752fbe4 Load custom CSS for styling on GTK+3.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33890
diff changeset
691 g_free(search_path);
0c11d752fbe4 Load custom CSS for styling on GTK+3.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33890
diff changeset
692
12572
a71b6aef215b [gaim-migrate @ 14891]
Daniel Atallah <datallah@pidgin.im>
parents: 12562
diff changeset
693 #ifdef _WIN32
35605
8a0ae6cc73fc Fix win32 build
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35499
diff changeset
694 winpidgin_init();
12572
a71b6aef215b [gaim-migrate @ 14891]
Daniel Atallah <datallah@pidgin.im>
parents: 12562
diff changeset
695 #endif
a71b6aef215b [gaim-migrate @ 14891]
Daniel Atallah <datallah@pidgin.im>
parents: 12562
diff changeset
696
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
697 purple_core_set_ui_ops(pidgin_core_get_ui_ops());
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
698
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
699 if (!purple_core_init(PIDGIN_UI)) {
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
700 fprintf(stderr,
16977
c9cb49bea66d Change the PIDGIN_NAME stuff to allow translators to transliterate the
Richard Laager <rlaager@pidgin.im>
parents: 16967
diff changeset
701 "Initialization of the libpurple core failed. Dumping core.\n"
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
702 "Please report this!\n");
38064
7cb860a7bb2e libpidgin: Fix Win32 build due to lacking signalpair() and some enums
Mike Ruprecht <cmaiku@gmail.com>
parents: 38048
diff changeset
703 #ifndef _WIN32
16193
e27165dcba9b Free segfault_message when Pidgin exits abnormally
Mark Doliner <markdoliner@pidgin.im>
parents: 16158
diff changeset
704 g_free(segfault_message);
38064
7cb860a7bb2e libpidgin: Fix Win32 build due to lacking signalpair() and some enums
Mike Ruprecht <cmaiku@gmail.com>
parents: 38048
diff changeset
705 #endif
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
706 abort();
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
707 }
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
708
36415
1c0b40253875 Refactored gtkdocklet, gtkimhtmltoolbar, gtkmain to use the new API
Ankit Vani <a@nevitus.org>
parents: 34708
diff changeset
709 search_path = g_build_filename(purple_user_dir(), "plugins", NULL);
1c0b40253875 Refactored gtkdocklet, gtkimhtmltoolbar, gtkmain to use the new API
Ankit Vani <a@nevitus.org>
parents: 34708
diff changeset
710 if (!g_stat(search_path, &st))
1c0b40253875 Refactored gtkdocklet, gtkimhtmltoolbar, gtkmain to use the new API
Ankit Vani <a@nevitus.org>
parents: 34708
diff changeset
711 g_mkdir(search_path, S_IRUSR | S_IWUSR | S_IXUSR);
36431
ea007725fd4d Refactored the codebase to use the plugin wrapper functions
Ankit Vani <a@nevitus.org>
parents: 36415
diff changeset
712 purple_plugins_add_search_path(search_path);
36485
bfb60fd48059 Add LIBDIR to pidgin and finch search paths
Ankit Vani <a@nevitus.org>
parents: 36431
diff changeset
713 g_free(search_path);
bfb60fd48059 Add LIBDIR to pidgin and finch search paths
Ankit Vani <a@nevitus.org>
parents: 36431
diff changeset
714
37136
cfa7c57f9ca5 Merge default branch
Ankit Vani <a@nevitus.org>
parents: 37134 35850
diff changeset
715 purple_plugins_add_search_path(PIDGIN_LIBDIR);
36431
ea007725fd4d Refactored the codebase to use the plugin wrapper functions
Ankit Vani <a@nevitus.org>
parents: 36415
diff changeset
716 purple_plugins_refresh();
36415
1c0b40253875 Refactored gtkdocklet, gtkimhtmltoolbar, gtkmain to use the new API
Ankit Vani <a@nevitus.org>
parents: 34708
diff changeset
717
18207
e89bf4430ea6 Allow disabling check for single instance.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18191
diff changeset
718 if (opt_si && !purple_core_ensure_single_instance()) {
22872
41d80fc58db2 Pop up the buddylist of the running instance instead of exiting quietly
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22791
diff changeset
719 #ifdef HAVE_DBUS
41d80fc58db2 Pop up the buddylist of the running instance instead of exiting quietly
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22791
diff changeset
720 DBusConnection *conn = purple_dbus_get_connection();
35499
c4c5e0a670b1 Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents: 35387
diff changeset
721 DBusMessage *message = dbus_message_new_method_call(PURPLE_DBUS_SERVICE, PURPLE_DBUS_PATH,
c4c5e0a670b1 Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents: 35387
diff changeset
722 PURPLE_DBUS_INTERFACE, "PurpleBlistSetVisible");
22872
41d80fc58db2 Pop up the buddylist of the running instance instead of exiting quietly
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22791
diff changeset
723 gboolean tr = TRUE;
25725
afd7e78b98bd *** Plucked rev 079a5ca1 (paul@darkrain42.org):
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25702
diff changeset
724 dbus_message_append_args(message, DBUS_TYPE_INT32, &tr, DBUS_TYPE_INVALID);
22872
41d80fc58db2 Pop up the buddylist of the running instance instead of exiting quietly
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22791
diff changeset
725 dbus_connection_send_with_reply_and_block(conn, message, -1, NULL);
41d80fc58db2 Pop up the buddylist of the running instance instead of exiting quietly
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22791
diff changeset
726 dbus_message_unref(message);
41d80fc58db2 Pop up the buddylist of the running instance instead of exiting quietly
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22791
diff changeset
727 #endif
31506
d282fb1e8315 Remove the dependency on libstartup-notification. Our use of it had some bugs
David Benjamin <davidben@mit.edu>
parents: 30844
diff changeset
728 gdk_notify_startup_complete();
17126
909c4e988d00 Added purple_core_quit to cleanup.
Gabriel Schulhof <nix@go-nix.ca>
parents: 17122
diff changeset
729 purple_core_quit();
25460
3d23980668be Display rather than log the error when another instance is running.
Richard Laager <rlaager@pidgin.im>
parents: 25440
diff changeset
730 g_printerr(_("Exiting because another libpurple client is already running.\n"));
38064
7cb860a7bb2e libpidgin: Fix Win32 build due to lacking signalpair() and some enums
Mike Ruprecht <cmaiku@gmail.com>
parents: 38048
diff changeset
731 #ifndef _WIN32
17121
43d41f5ce17b Alternative dbus_uniq implementation
Gabriel Schulhof <nix@go-nix.ca>
parents: 17104
diff changeset
732 g_free(segfault_message);
38064
7cb860a7bb2e libpidgin: Fix Win32 build due to lacking signalpair() and some enums
Mike Ruprecht <cmaiku@gmail.com>
parents: 38048
diff changeset
733 #endif
17124
f3952abcaad9 Whitespace fix in the dbus_uniq code.
Richard Laager <rlaager@pidgin.im>
parents: 17122
diff changeset
734 return 0;
17122
5ba216aa4583 Style changes + removed unnecessary NULL checks.
Gabriel Schulhof <nix@go-nix.ca>
parents: 17121
diff changeset
735 }
17121
43d41f5ce17b Alternative dbus_uniq implementation
Gabriel Schulhof <nix@go-nix.ca>
parents: 17104
diff changeset
736
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
737 /* 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
738 purple_plugins_load_saved(PIDGIN_PREFS_ROOT "/plugins/loaded");
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
739
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
740 ui_main();
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
741
37424
04cf8cbe44d8 Remove more NULL-checks before free().
Michael McConville <mmcco@mykolab.com>
parents: 37422
diff changeset
742 g_free(opt_config_dir_arg);
04cf8cbe44d8 Remove more NULL-checks before free().
Michael McConville <mmcco@mykolab.com>
parents: 37422
diff changeset
743 opt_config_dir_arg = NULL;
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
744
24999
84d597b7e7c6 Add a -f/--force-online option to Pidgin which tells libpurple to claim the
Richard Laager <rlaager@pidgin.im>
parents: 24674
diff changeset
745 /* This needs to be before purple_blist_show() so the
84d597b7e7c6 Add a -f/--force-online option to Pidgin which tells libpurple to claim the
Richard Laager <rlaager@pidgin.im>
parents: 24674
diff changeset
746 * statusbox gets the forced online status. */
84d597b7e7c6 Add a -f/--force-online option to Pidgin which tells libpurple to claim the
Richard Laager <rlaager@pidgin.im>
parents: 24674
diff changeset
747 if (opt_force_online)
84d597b7e7c6 Add a -f/--force-online option to Pidgin which tells libpurple to claim the
Richard Laager <rlaager@pidgin.im>
parents: 24674
diff changeset
748 purple_network_force_online();
84d597b7e7c6 Add a -f/--force-online option to Pidgin which tells libpurple to claim the
Richard Laager <rlaager@pidgin.im>
parents: 24674
diff changeset
749
12011
85a627679414 [gaim-migrate @ 14304]
Mark Doliner <markdoliner@pidgin.im>
parents: 11928
diff changeset
750 /*
85a627679414 [gaim-migrate @ 14304]
Mark Doliner <markdoliner@pidgin.im>
parents: 11928
diff changeset
751 * 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
752 * user feels warm and fuzzy (not cold and prickley).
85a627679414 [gaim-migrate @ 14304]
Mark Doliner <markdoliner@pidgin.im>
parents: 11928
diff changeset
753 */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
754 purple_blist_show();
12011
85a627679414 [gaim-migrate @ 14304]
Mark Doliner <markdoliner@pidgin.im>
parents: 11928
diff changeset
755
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16071
diff changeset
756 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
757 pidgin_debug_window_show();
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
758
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
759 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
760 /* 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
761 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
762 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
763 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
764 }
8070b1610abe Make -l do something slightly more sane than it does now, even though it
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17105
diff changeset
765 /* 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
766 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
767 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
768 /* 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
769 dologin_named(opt_login_arg);
37424
04cf8cbe44d8 Remove more NULL-checks before free().
Michael McConville <mmcco@mykolab.com>
parents: 37422
diff changeset
770 g_free(opt_login_arg);
04cf8cbe44d8 Remove more NULL-checks before free().
Michael McConville <mmcco@mykolab.com>
parents: 37422
diff changeset
771 opt_login_arg = NULL;
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
772 } else if (opt_nologin) {
11806
269e9f78cf89 [gaim-migrate @ 14097]
Mark Doliner <markdoliner@pidgin.im>
parents: 11795
diff changeset
773 /* Set all accounts to "offline" */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
774 PurpleSavedStatus *saved_status;
13111
31caa48825f7 [gaim-migrate @ 15472]
Mark Doliner <markdoliner@pidgin.im>
parents: 13106
diff changeset
775
31caa48825f7 [gaim-migrate @ 15472]
Mark Doliner <markdoliner@pidgin.im>
parents: 13106
diff changeset
776 /* If we've used this type+message before, lookup the transient status */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
777 saved_status = purple_savedstatus_find_transient_by_type_and_message(
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
778 PURPLE_STATUS_OFFLINE, NULL);
13111
31caa48825f7 [gaim-migrate @ 15472]
Mark Doliner <markdoliner@pidgin.im>
parents: 13106
diff changeset
779
31caa48825f7 [gaim-migrate @ 15472]
Mark Doliner <markdoliner@pidgin.im>
parents: 13106
diff changeset
780 /* 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
781 if (saved_status == NULL)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
782 saved_status = purple_savedstatus_new(NULL, PURPLE_STATUS_OFFLINE);
13111
31caa48825f7 [gaim-migrate @ 15472]
Mark Doliner <markdoliner@pidgin.im>
parents: 13106
diff changeset
783
31caa48825f7 [gaim-migrate @ 15472]
Mark Doliner <markdoliner@pidgin.im>
parents: 13106
diff changeset
784 /* Set the status for each account */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
785 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
786 } else {
11348
b8938b189d61 [gaim-migrate @ 13565]
Mark Doliner <markdoliner@pidgin.im>
parents: 11277
diff changeset
787 /* 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
788 if (!purple_prefs_get_bool("/purple/savedstatus/startup_current_status"))
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
789 purple_savedstatus_activate(purple_savedstatus_get_startup());
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
790 purple_accounts_restore_current_statuses();
10738
63ca8277c234 [gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents: 10638
diff changeset
791 }
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
792
18121
2d8ea56b9097 Mark the return type const for the following functions. I noticed this
Richard Laager <rlaager@pidgin.im>
parents: 18093
diff changeset
793 if ((active_accounts = purple_accounts_get_all_active()) == NULL)
11403
e7e7ed37dc51 [gaim-migrate @ 13638]
Mark Doliner <markdoliner@pidgin.im>
parents: 11348
diff changeset
794 {
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15498
diff changeset
795 pidgin_accounts_window_show();
10315
2738b56121ca [gaim-migrate @ 11515]
Sean Egan <seanegan@pidgin.im>
parents: 10307
diff changeset
796 }
13835
86dea5f9cffa [gaim-migrate @ 16282]
Yosef Radchenko
parents: 13587
diff changeset
797 else
86dea5f9cffa [gaim-migrate @ 16282]
Yosef Radchenko
parents: 13587
diff changeset
798 {
18121
2d8ea56b9097 Mark the return type const for the following functions. I noticed this
Richard Laager <rlaager@pidgin.im>
parents: 18093
diff changeset
799 g_list_free(active_accounts);
13835
86dea5f9cffa [gaim-migrate @ 16282]
Yosef Radchenko
parents: 13587
diff changeset
800 }
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
801
31506
d282fb1e8315 Remove the dependency on libstartup-notification. Our use of it had some bugs
David Benjamin <davidben@mit.edu>
parents: 30844
diff changeset
802 /* GTK clears the notification for us when opening the first window,
d282fb1e8315 Remove the dependency on libstartup-notification. Our use of it had some bugs
David Benjamin <davidben@mit.edu>
parents: 30844
diff changeset
803 * but we may have launched with only a status icon, so clear the it
d282fb1e8315 Remove the dependency on libstartup-notification. Our use of it had some bugs
David Benjamin <davidben@mit.edu>
parents: 30844
diff changeset
804 * just in case. */
d282fb1e8315 Remove the dependency on libstartup-notification. Our use of it had some bugs
David Benjamin <davidben@mit.edu>
parents: 30844
diff changeset
805 gdk_notify_startup_complete();
14762
f494a5f12981 [gaim-migrate @ 17452]
Daniel Atallah <datallah@pidgin.im>
parents: 14743
diff changeset
806
f494a5f12981 [gaim-migrate @ 17452]
Daniel Atallah <datallah@pidgin.im>
parents: 14743
diff changeset
807 #ifdef _WIN32
15574
18d9d1c05994 Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents: 15567
diff changeset
808 winpidgin_post_init();
14762
f494a5f12981 [gaim-migrate @ 17452]
Daniel Atallah <datallah@pidgin.im>
parents: 14743
diff changeset
809 #endif
f494a5f12981 [gaim-migrate @ 17452]
Daniel Atallah <datallah@pidgin.im>
parents: 14743
diff changeset
810
38383
0ceb576f5617 libpidgin: Port to use GtkApplication
Mike Ruprecht <cmaiku@gmail.com>
parents: 38240
diff changeset
811 /* TODO: Use GtkApplicationWindow or add a window instead */
0ceb576f5617 libpidgin: Port to use GtkApplication
Mike Ruprecht <cmaiku@gmail.com>
parents: 38240
diff changeset
812 g_application_hold(app);
0ceb576f5617 libpidgin: Port to use GtkApplication
Mike Ruprecht <cmaiku@gmail.com>
parents: 38240
diff changeset
813
0ceb576f5617 libpidgin: Port to use GtkApplication
Mike Ruprecht <cmaiku@gmail.com>
parents: 38240
diff changeset
814 ret = g_application_run(app, 0, NULL);
0ceb576f5617 libpidgin: Port to use GtkApplication
Mike Ruprecht <cmaiku@gmail.com>
parents: 38240
diff changeset
815
0ceb576f5617 libpidgin: Port to use GtkApplication
Mike Ruprecht <cmaiku@gmail.com>
parents: 38240
diff changeset
816 /* Make sure purple has quit in case something in GApplication
0ceb576f5617 libpidgin: Port to use GtkApplication
Mike Ruprecht <cmaiku@gmail.com>
parents: 38240
diff changeset
817 * has caused g_application_run() to finish on its own. This can
0ceb576f5617 libpidgin: Port to use GtkApplication
Mike Ruprecht <cmaiku@gmail.com>
parents: 38240
diff changeset
818 * happen, for example, if the desktop session is ending.
0ceb576f5617 libpidgin: Port to use GtkApplication
Mike Ruprecht <cmaiku@gmail.com>
parents: 38240
diff changeset
819 */
0ceb576f5617 libpidgin: Port to use GtkApplication
Mike Ruprecht <cmaiku@gmail.com>
parents: 38240
diff changeset
820 if (purple_get_core() != NULL) {
0ceb576f5617 libpidgin: Port to use GtkApplication
Mike Ruprecht <cmaiku@gmail.com>
parents: 38240
diff changeset
821 purple_core_quit();
0ceb576f5617 libpidgin: Port to use GtkApplication
Mike Ruprecht <cmaiku@gmail.com>
parents: 38240
diff changeset
822 }
0ceb576f5617 libpidgin: Port to use GtkApplication
Mike Ruprecht <cmaiku@gmail.com>
parents: 38240
diff changeset
823
0ceb576f5617 libpidgin: Port to use GtkApplication
Mike Ruprecht <cmaiku@gmail.com>
parents: 38240
diff changeset
824 /* Now that we're sure purple_core_quit() has been called,
0ceb576f5617 libpidgin: Port to use GtkApplication
Mike Ruprecht <cmaiku@gmail.com>
parents: 38240
diff changeset
825 * this can be freed.
0ceb576f5617 libpidgin: Port to use GtkApplication
Mike Ruprecht <cmaiku@gmail.com>
parents: 38240
diff changeset
826 */
0ceb576f5617 libpidgin: Port to use GtkApplication
Mike Ruprecht <cmaiku@gmail.com>
parents: 38240
diff changeset
827 g_object_unref(app);
10320
f5b0f5cf8562 [gaim-migrate @ 11527]
Mark Doliner <markdoliner@pidgin.im>
parents: 10317
diff changeset
828
38064
7cb860a7bb2e libpidgin: Fix Win32 build due to lacking signalpair() and some enums
Mike Ruprecht <cmaiku@gmail.com>
parents: 38048
diff changeset
829 #ifndef _WIN32
12556
f4d4e4e3a825 [gaim-migrate @ 14875]
Richard Laager <rlaager@pidgin.im>
parents: 12409
diff changeset
830 g_free(segfault_message);
29991
37e306c31983 Try to be polite and free stuff associated with our signal watcher pipes
Mark Doliner <markdoliner@pidgin.im>
parents: 29662
diff changeset
831 g_source_remove(signal_channel_watcher);
37e306c31983 Try to be polite and free stuff associated with our signal watcher pipes
Mark Doliner <markdoliner@pidgin.im>
parents: 29662
diff changeset
832 close(signal_sockets[0]);
37e306c31983 Try to be polite and free stuff associated with our signal watcher pipes
Mark Doliner <markdoliner@pidgin.im>
parents: 29662
diff changeset
833 close(signal_sockets[1]);
38064
7cb860a7bb2e libpidgin: Fix Win32 build due to lacking signalpair() and some enums
Mike Ruprecht <cmaiku@gmail.com>
parents: 38048
diff changeset
834 #endif
12556
f4d4e4e3a825 [gaim-migrate @ 14875]
Richard Laager <rlaager@pidgin.im>
parents: 12409
diff changeset
835
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
836 #ifdef _WIN32
15574
18d9d1c05994 Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents: 15567
diff changeset
837 winpidgin_cleanup();
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
838 #endif
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
839
38383
0ceb576f5617 libpidgin: Port to use GtkApplication
Mike Ruprecht <cmaiku@gmail.com>
parents: 38240
diff changeset
840 return ret;
10302
8c73238fb5d4 [gaim-migrate @ 11487]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
841 }

mercurial