Mon, 10 Oct 2022 02:30:03 -0500
Add a get_settings_backend vfunc to CoreUiOps
This allows the user interface to declare their own settings backend. There's
some minor duplication between finch and pidgin for this, but this means the
test ui can use a memory backend instead of something on disk.
Testing Done:
Ran the unit tests multiple times and verified that the credential manager test stops messing up everything else.
Reviewed at https://reviews.imfreedom.org/r/1921/
| 10302 | 1 | /* |
|
15931
716b5fac1895
Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@pidgin.im>
parents:
15884
diff
changeset
|
2 | * pidgin |
| 10302 | 3 | * |
|
15931
716b5fac1895
Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@pidgin.im>
parents:
15884
diff
changeset
|
4 | * Pidgin is the legal property of its developers, whose names are too numerous |
| 10302 | 5 | * to list here. Please refer to the COPYRIGHT file distributed with this |
| 6 | * source distribution. | |
| 7 | * | |
| 8 | * This program is free software; you can redistribute it and/or modify | |
| 9 | * it under the terms of the GNU General Public License as published by | |
| 10 | * the Free Software Foundation; either version 2 of the License, or | |
| 11 | * (at your option) any later version. | |
| 12 | * | |
| 13 | * This program is distributed in the hope that it will be useful, | |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 16 | * GNU General Public License for more details. | |
| 17 | * | |
| 18 | * You should have received a copy of the GNU General Public License | |
| 19 | * along with this program; if not, write to the Free Software | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19840
diff
changeset
|
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 10302 | 21 | * |
| 22 | */ | |
| 23 | ||
|
40439
e9838d634d5e
Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents:
40360
diff
changeset
|
24 | #ifdef HAVE_CONFIG_H |
|
e9838d634d5e
Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents:
40360
diff
changeset
|
25 | # include <config.h> |
|
e9838d634d5e
Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents:
40360
diff
changeset
|
26 | #endif |
|
e9838d634d5e
Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents:
40360
diff
changeset
|
27 | |
|
40462
24ed25d87550
Fix some issues on macos that resulted from the internal.h cleanup
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
28 | #include <errno.h> |
|
24ed25d87550
Fix some issues on macos that resulted from the internal.h cleanup
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
29 | |
|
40439
e9838d634d5e
Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents:
40360
diff
changeset
|
30 | #include <glib/gi18n-lib.h> |
|
e9838d634d5e
Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents:
40360
diff
changeset
|
31 | #include <glib/gstdio.h> |
|
e9838d634d5e
Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents:
40360
diff
changeset
|
32 | |
|
41806
b7a1aab4b3be
Add a get_settings_backend vfunc to CoreUiOps
Gary Kramlich <grim@reaperworld.com>
parents:
41723
diff
changeset
|
33 | #define G_SETTINGS_ENABLE_BACKEND |
|
b7a1aab4b3be
Add a get_settings_backend vfunc to CoreUiOps
Gary Kramlich <grim@reaperworld.com>
parents:
41723
diff
changeset
|
34 | #include <gio/gsettingsbackend.h> |
|
b7a1aab4b3be
Add a get_settings_backend vfunc to CoreUiOps
Gary Kramlich <grim@reaperworld.com>
parents:
41723
diff
changeset
|
35 | |
|
39372
43e3da39daf6
Include 'locale.h' directly in files which use setlocale()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39365
diff
changeset
|
36 | #include <locale.h> |
| 10302 | 37 | |
|
40360
e21f3bbcc2a5
Update all of the pidgin code to include purple.h
Gary Kramlich <grim@reaperworld.com>
parents:
40337
diff
changeset
|
38 | #include <purple.h> |
| 10302 | 39 | |
| 40 | #include "gtkaccount.h" | |
| 41 | #include "gtkblist.h" | |
| 42 | #include "gtkconn.h" | |
|
34910
60502558e400
Replacements for the GObject Xfer API
Ankit Vani <a@nevitus.org>
parents:
34892
diff
changeset
|
43 | #include "gtkxfer.h" |
|
11907
de3ea77afe3c
[gaim-migrate @ 14198]
Evan Schoenberg <evands@pidgin.im>
parents:
11906
diff
changeset
|
44 | #include "gtkidle.h" |
|
26269
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
24585
diff
changeset
|
45 | #include "gtkmedia.h" |
| 10302 | 46 | #include "gtknotify.h" |
| 47 | #include "gtkprivacy.h" | |
| 48 | #include "gtkrequest.h" | |
| 49 | #include "gtkroomlist.h" | |
| 50 | #include "gtkutils.h" | |
|
11475
1e222e6e52a0
[gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
11403
diff
changeset
|
51 | #include "gtkwhiteboard.h" |
|
40553
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
40531
diff
changeset
|
52 | #include "pidginapplication.h" |
|
40496
6941fece679b
phase2 of pidgin.h: move existing file to pidgincore.h
Gary Kramlich <grim@reaperworld.com>
parents:
40462
diff
changeset
|
53 | #include "pidgincore.h" |
|
39152
37144ff35a91
Rename gtkdebug -> pidgindebug.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39036
diff
changeset
|
54 | #include "pidgindebug.h" |
|
40222
40f2888f85c1
delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents:
40203
diff
changeset
|
55 | #include "pidginplugininfo.h" |
|
40886
198bf5bc58ce
Move Pidgin preferences code into a subdirectory.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40871
diff
changeset
|
56 | #include "pidginprefs.h" |
|
40871
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
40683
diff
changeset
|
57 | #include "pidginprivate.h" |
| 10302 | 58 | |
|
38064
7cb860a7bb2e
libpidgin: Fix Win32 build due to lacking signalpair() and some enums
Mike Ruprecht <cmaiku@gmail.com>
parents:
38048
diff
changeset
|
59 | #ifndef _WIN32 |
|
38047
312be70f9de6
Remove AC_HEADER_STDC and related C89 tests.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37998
diff
changeset
|
60 | #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
|
61 | #endif |
| 10302 | 62 | |
|
38064
7cb860a7bb2e
libpidgin: Fix Win32 build due to lacking signalpair() and some enums
Mike Ruprecht <cmaiku@gmail.com>
parents:
38048
diff
changeset
|
63 | #ifndef _WIN32 |
| 10302 | 64 | |
| 65 | /* | |
| 66 | * Lists of signals we wish to catch and those we wish to ignore. | |
| 67 | * Each list terminated with -1 | |
| 68 | */ | |
|
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
|
69 | static const int catch_sig_list[] = { |
| 10302 | 70 | SIGSEGV, |
| 71 | SIGINT, | |
| 72 | SIGTERM, | |
| 73 | 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
|
74 | SIGCHLD, |
| 10302 | 75 | -1 |
| 76 | }; | |
| 77 | ||
|
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
|
78 | static const int ignore_sig_list[] = { |
| 10302 | 79 | SIGPIPE, |
| 80 | -1 | |
| 81 | }; | |
|
38064
7cb860a7bb2e
libpidgin: Fix Win32 build due to lacking signalpair() and some enums
Mike Ruprecht <cmaiku@gmail.com>
parents:
38048
diff
changeset
|
82 | #endif /* !_WIN32 */ |
| 10302 | 83 | |
|
38064
7cb860a7bb2e
libpidgin: Fix Win32 build due to lacking signalpair() and some enums
Mike Ruprecht <cmaiku@gmail.com>
parents:
38048
diff
changeset
|
84 | #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
|
85 | 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
|
86 | |
|
39256
0245b49e1231
libpidgin: Use GApplication command line argument parsing and uniqueness
Mike Ruprecht <cmaiku@gmail.com>
parents:
39255
diff
changeset
|
87 | static guint signal_channel_watcher; |
|
0245b49e1231
libpidgin: Use GApplication command line argument parsing and uniqueness
Mike Ruprecht <cmaiku@gmail.com>
parents:
39255
diff
changeset
|
88 | |
|
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
|
89 | 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
|
90 | |
|
14542
7c1dd9601f1d
[gaim-migrate @ 17199]
Mark Doliner <markdoliner@pidgin.im>
parents:
14323
diff
changeset
|
91 | static void sighandler(int sig); |
|
7c1dd9601f1d
[gaim-migrate @ 17199]
Mark Doliner <markdoliner@pidgin.im>
parents:
14323
diff
changeset
|
92 | |
|
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
|
93 | 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
|
94 | { |
|
58701e24ed40
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents:
28800
diff
changeset
|
95 | 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
|
96 | |
|
58701e24ed40
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents:
28800
diff
changeset
|
97 | /* |
|
58701e24ed40
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents:
28800
diff
changeset
|
98 | * 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
|
99 | * 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
|
100 | * 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
|
101 | * 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
|
102 | * 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
|
103 | * 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
|
104 | * 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
|
105 | * 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
|
106 | * 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
|
107 | */ |
|
58701e24ed40
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents:
28800
diff
changeset
|
108 | 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
|
109 | 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
|
110 | 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
|
111 | 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
|
112 | } |
|
12556
f4d4e4e3a825
[gaim-migrate @ 14875]
Richard Laager <rlaager@pidgin.im>
parents:
12409
diff
changeset
|
113 | |
|
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
|
114 | written = write(signal_sockets[0], &sig, sizeof(int)); |
|
40133
b86418d6eb94
Remove redundant comparisons in conditions
qarkai <qarkai@gmail.com>
parents:
40094
diff
changeset
|
115 | if (written != sizeof(int)) { |
|
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
|
116 | /* 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
|
117 | 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
|
118 | "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
|
119 | 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
|
120 | 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
|
121 | 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
|
122 | } |
|
58701e24ed40
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents:
28800
diff
changeset
|
123 | } |
|
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 | |
|
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 | 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
|
126 | mainloop_sighandler(GIOChannel *source, GIOCondition cond, gpointer data) |
| 10302 | 127 | { |
|
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
|
128 | 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
|
129 | 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
|
130 | 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
|
131 | 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
|
132 | |
|
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 | /* 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
|
134 | 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
|
135 | &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
|
136 | 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
|
137 | 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
|
138 | "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
|
139 | 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
|
140 | 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
|
141 | } |
|
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 | |
|
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
|
143 | 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
|
144 | 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
|
145 | /* 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
|
146 | 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
|
147 | 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
|
148 | 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
|
149 | 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
|
150 | 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
|
151 | } |
|
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
|
152 | |
|
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 | return TRUE; |
| 10302 | 154 | } |
|
38064
7cb860a7bb2e
libpidgin: Fix Win32 build due to lacking signalpair() and some enums
Mike Ruprecht <cmaiku@gmail.com>
parents:
38048
diff
changeset
|
155 | #endif /* !_WIN32 */ |
| 10302 | 156 | |
| 157 | static void | |
|
41037
c2043b9692f6
Add icon-name, icon-search-path, and icon-resource-path to PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
41034
diff
changeset
|
158 | purple_ui_add_protocol_theme_paths(PurpleProtocol *protocol) { |
|
41539
447daf762aee
Migrate libpidgin.c to gtk4
Gary Kramlich <grim@reaperworld.com>
parents:
41517
diff
changeset
|
159 | GdkDisplay *display = NULL; |
|
41037
c2043b9692f6
Add icon-name, icon-search-path, and icon-resource-path to PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
41034
diff
changeset
|
160 | GtkIconTheme *theme = NULL; |
|
c2043b9692f6
Add icon-name, icon-search-path, and icon-resource-path to PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
41034
diff
changeset
|
161 | const gchar *path = NULL; |
|
c2043b9692f6
Add icon-name, icon-search-path, and icon-resource-path to PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
41034
diff
changeset
|
162 | |
|
41539
447daf762aee
Migrate libpidgin.c to gtk4
Gary Kramlich <grim@reaperworld.com>
parents:
41517
diff
changeset
|
163 | display = gdk_display_get_default(); |
|
447daf762aee
Migrate libpidgin.c to gtk4
Gary Kramlich <grim@reaperworld.com>
parents:
41517
diff
changeset
|
164 | |
|
447daf762aee
Migrate libpidgin.c to gtk4
Gary Kramlich <grim@reaperworld.com>
parents:
41517
diff
changeset
|
165 | theme = gtk_icon_theme_get_for_display(display); |
|
41037
c2043b9692f6
Add icon-name, icon-search-path, and icon-resource-path to PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
41034
diff
changeset
|
166 | |
|
c2043b9692f6
Add icon-name, icon-search-path, and icon-resource-path to PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
41034
diff
changeset
|
167 | path = purple_protocol_get_icon_search_path(protocol); |
|
c2043b9692f6
Add icon-name, icon-search-path, and icon-resource-path to PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
41034
diff
changeset
|
168 | if(path != NULL) { |
|
41539
447daf762aee
Migrate libpidgin.c to gtk4
Gary Kramlich <grim@reaperworld.com>
parents:
41517
diff
changeset
|
169 | gtk_icon_theme_add_search_path(theme, path); |
|
41037
c2043b9692f6
Add icon-name, icon-search-path, and icon-resource-path to PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
41034
diff
changeset
|
170 | } |
|
c2043b9692f6
Add icon-name, icon-search-path, and icon-resource-path to PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
41034
diff
changeset
|
171 | |
|
c2043b9692f6
Add icon-name, icon-search-path, and icon-resource-path to PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
41034
diff
changeset
|
172 | path = purple_protocol_get_icon_resource_path(protocol); |
|
c2043b9692f6
Add icon-name, icon-search-path, and icon-resource-path to PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
41034
diff
changeset
|
173 | if(path != NULL) { |
|
c2043b9692f6
Add icon-name, icon-search-path, and icon-resource-path to PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
41034
diff
changeset
|
174 | gtk_icon_theme_add_resource_path(theme, path); |
|
c2043b9692f6
Add icon-name, icon-search-path, and icon-resource-path to PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
41034
diff
changeset
|
175 | } |
|
c2043b9692f6
Add icon-name, icon-search-path, and icon-resource-path to PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
41034
diff
changeset
|
176 | } |
|
c2043b9692f6
Add icon-name, icon-search-path, and icon-resource-path to PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
41034
diff
changeset
|
177 | |
|
c2043b9692f6
Add icon-name, icon-search-path, and icon-resource-path to PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
41034
diff
changeset
|
178 | static void |
|
c2043b9692f6
Add icon-name, icon-search-path, and icon-resource-path to PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
41034
diff
changeset
|
179 | purple_ui_protocol_foreach_theme_cb(PurpleProtocol *protocol, gpointer data) { |
|
c2043b9692f6
Add icon-name, icon-search-path, and icon-resource-path to PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
41034
diff
changeset
|
180 | purple_ui_add_protocol_theme_paths(protocol); |
|
c2043b9692f6
Add icon-name, icon-search-path, and icon-resource-path to PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
41034
diff
changeset
|
181 | } |
|
c2043b9692f6
Add icon-name, icon-search-path, and icon-resource-path to PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
41034
diff
changeset
|
182 | |
|
c2043b9692f6
Add icon-name, icon-search-path, and icon-resource-path to PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
41034
diff
changeset
|
183 | static void |
|
c2043b9692f6
Add icon-name, icon-search-path, and icon-resource-path to PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
41034
diff
changeset
|
184 | purple_ui_protocol_registered_cb(PurpleProtocolManager *manager, |
|
c2043b9692f6
Add icon-name, icon-search-path, and icon-resource-path to PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
41034
diff
changeset
|
185 | PurpleProtocol *protocol) |
|
c2043b9692f6
Add icon-name, icon-search-path, and icon-resource-path to PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
41034
diff
changeset
|
186 | { |
|
c2043b9692f6
Add icon-name, icon-search-path, and icon-resource-path to PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
41034
diff
changeset
|
187 | purple_ui_add_protocol_theme_paths(protocol); |
|
c2043b9692f6
Add icon-name, icon-search-path, and icon-resource-path to PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
41034
diff
changeset
|
188 | } |
|
c2043b9692f6
Add icon-name, icon-search-path, and icon-resource-path to PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
41034
diff
changeset
|
189 | |
|
41109
755e1554051c
Make user interfaces setup the default history adapter.
Gary Kramlich <grim@reaperworld.com>
parents:
41106
diff
changeset
|
190 | static gboolean |
|
755e1554051c
Make user interfaces setup the default history adapter.
Gary Kramlich <grim@reaperworld.com>
parents:
41106
diff
changeset
|
191 | pidgin_history_init(GError **error) { |
|
755e1554051c
Make user interfaces setup the default history adapter.
Gary Kramlich <grim@reaperworld.com>
parents:
41106
diff
changeset
|
192 | PurpleHistoryManager *manager = NULL; |
|
755e1554051c
Make user interfaces setup the default history adapter.
Gary Kramlich <grim@reaperworld.com>
parents:
41106
diff
changeset
|
193 | PurpleHistoryAdapter *adapter = NULL; |
|
755e1554051c
Make user interfaces setup the default history adapter.
Gary Kramlich <grim@reaperworld.com>
parents:
41106
diff
changeset
|
194 | gchar *filename = NULL; |
|
755e1554051c
Make user interfaces setup the default history adapter.
Gary Kramlich <grim@reaperworld.com>
parents:
41106
diff
changeset
|
195 | const gchar *id = NULL; |
|
755e1554051c
Make user interfaces setup the default history adapter.
Gary Kramlich <grim@reaperworld.com>
parents:
41106
diff
changeset
|
196 | |
|
755e1554051c
Make user interfaces setup the default history adapter.
Gary Kramlich <grim@reaperworld.com>
parents:
41106
diff
changeset
|
197 | manager = purple_history_manager_get_default(); |
|
755e1554051c
Make user interfaces setup the default history adapter.
Gary Kramlich <grim@reaperworld.com>
parents:
41106
diff
changeset
|
198 | |
|
755e1554051c
Make user interfaces setup the default history adapter.
Gary Kramlich <grim@reaperworld.com>
parents:
41106
diff
changeset
|
199 | /* Attempt to create the config_dir. We don't care about the result as the |
|
755e1554051c
Make user interfaces setup the default history adapter.
Gary Kramlich <grim@reaperworld.com>
parents:
41106
diff
changeset
|
200 | * logging adapter will fail with a better error than us failing to create |
|
755e1554051c
Make user interfaces setup the default history adapter.
Gary Kramlich <grim@reaperworld.com>
parents:
41106
diff
changeset
|
201 | * the directory. |
|
755e1554051c
Make user interfaces setup the default history adapter.
Gary Kramlich <grim@reaperworld.com>
parents:
41106
diff
changeset
|
202 | */ |
|
755e1554051c
Make user interfaces setup the default history adapter.
Gary Kramlich <grim@reaperworld.com>
parents:
41106
diff
changeset
|
203 | g_mkdir_with_parents(purple_config_dir(), 0700); |
|
755e1554051c
Make user interfaces setup the default history adapter.
Gary Kramlich <grim@reaperworld.com>
parents:
41106
diff
changeset
|
204 | |
|
755e1554051c
Make user interfaces setup the default history adapter.
Gary Kramlich <grim@reaperworld.com>
parents:
41106
diff
changeset
|
205 | filename = g_build_filename(purple_config_dir(), "history.db", NULL); |
|
755e1554051c
Make user interfaces setup the default history adapter.
Gary Kramlich <grim@reaperworld.com>
parents:
41106
diff
changeset
|
206 | adapter = purple_sqlite_history_adapter_new(filename); |
|
755e1554051c
Make user interfaces setup the default history adapter.
Gary Kramlich <grim@reaperworld.com>
parents:
41106
diff
changeset
|
207 | g_free(filename); |
|
755e1554051c
Make user interfaces setup the default history adapter.
Gary Kramlich <grim@reaperworld.com>
parents:
41106
diff
changeset
|
208 | |
|
755e1554051c
Make user interfaces setup the default history adapter.
Gary Kramlich <grim@reaperworld.com>
parents:
41106
diff
changeset
|
209 | id = purple_history_adapter_get_id(adapter); |
|
755e1554051c
Make user interfaces setup the default history adapter.
Gary Kramlich <grim@reaperworld.com>
parents:
41106
diff
changeset
|
210 | if(!purple_history_manager_register(manager, adapter, error)) { |
|
755e1554051c
Make user interfaces setup the default history adapter.
Gary Kramlich <grim@reaperworld.com>
parents:
41106
diff
changeset
|
211 | g_clear_object(&adapter); |
|
755e1554051c
Make user interfaces setup the default history adapter.
Gary Kramlich <grim@reaperworld.com>
parents:
41106
diff
changeset
|
212 | |
|
755e1554051c
Make user interfaces setup the default history adapter.
Gary Kramlich <grim@reaperworld.com>
parents:
41106
diff
changeset
|
213 | return FALSE; |
|
755e1554051c
Make user interfaces setup the default history adapter.
Gary Kramlich <grim@reaperworld.com>
parents:
41106
diff
changeset
|
214 | } |
|
755e1554051c
Make user interfaces setup the default history adapter.
Gary Kramlich <grim@reaperworld.com>
parents:
41106
diff
changeset
|
215 | |
|
755e1554051c
Make user interfaces setup the default history adapter.
Gary Kramlich <grim@reaperworld.com>
parents:
41106
diff
changeset
|
216 | /* The manager adds a ref to the adapter on registration, so we can remove |
|
755e1554051c
Make user interfaces setup the default history adapter.
Gary Kramlich <grim@reaperworld.com>
parents:
41106
diff
changeset
|
217 | * our reference. |
|
755e1554051c
Make user interfaces setup the default history adapter.
Gary Kramlich <grim@reaperworld.com>
parents:
41106
diff
changeset
|
218 | */ |
|
755e1554051c
Make user interfaces setup the default history adapter.
Gary Kramlich <grim@reaperworld.com>
parents:
41106
diff
changeset
|
219 | g_clear_object(&adapter); |
|
755e1554051c
Make user interfaces setup the default history adapter.
Gary Kramlich <grim@reaperworld.com>
parents:
41106
diff
changeset
|
220 | |
|
755e1554051c
Make user interfaces setup the default history adapter.
Gary Kramlich <grim@reaperworld.com>
parents:
41106
diff
changeset
|
221 | return purple_history_manager_set_active(manager, id, error); |
|
755e1554051c
Make user interfaces setup the default history adapter.
Gary Kramlich <grim@reaperworld.com>
parents:
41106
diff
changeset
|
222 | } |
|
755e1554051c
Make user interfaces setup the default history adapter.
Gary Kramlich <grim@reaperworld.com>
parents:
41106
diff
changeset
|
223 | |
| 10302 | 224 | static void |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15498
diff
changeset
|
225 | pidgin_ui_init(void) |
| 10302 | 226 | { |
|
41037
c2043b9692f6
Add icon-name, icon-search-path, and icon-resource-path to PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
41034
diff
changeset
|
227 | PurpleProtocolManager *protocol_manager = NULL; |
|
41539
447daf762aee
Migrate libpidgin.c to gtk4
Gary Kramlich <grim@reaperworld.com>
parents:
41517
diff
changeset
|
228 | GdkDisplay *display = NULL; |
|
41029
b867c3e03cb0
Start embedding our icon theme by starting with the status icons used in PidginPresenceIcon
Gary Kramlich <grim@reaperworld.com>
parents:
40886
diff
changeset
|
229 | GtkIconTheme *theme = NULL; |
|
41109
755e1554051c
Make user interfaces setup the default history adapter.
Gary Kramlich <grim@reaperworld.com>
parents:
41106
diff
changeset
|
230 | GError *error = NULL; |
|
39036
ced50832d0c7
libpidgin: Add pidgin icon path to GtkIconTheme
Mike Ruprecht <cmaiku@gmail.com>
parents:
39014
diff
changeset
|
231 | gchar *path; |
|
ced50832d0c7
libpidgin: Add pidgin icon path to GtkIconTheme
Mike Ruprecht <cmaiku@gmail.com>
parents:
39014
diff
changeset
|
232 | |
|
41117
6dc7e403f8f2
Initialize Pidgin GLib logging handler earlier
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41111
diff
changeset
|
233 | pidgin_debug_init(); |
|
6dc7e403f8f2
Initialize Pidgin GLib logging handler earlier
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41111
diff
changeset
|
234 | |
|
41539
447daf762aee
Migrate libpidgin.c to gtk4
Gary Kramlich <grim@reaperworld.com>
parents:
41517
diff
changeset
|
235 | display = gdk_display_get_default(); |
|
447daf762aee
Migrate libpidgin.c to gtk4
Gary Kramlich <grim@reaperworld.com>
parents:
41517
diff
changeset
|
236 | theme = gtk_icon_theme_get_for_display(display); |
|
41029
b867c3e03cb0
Start embedding our icon theme by starting with the status icons used in PidginPresenceIcon
Gary Kramlich <grim@reaperworld.com>
parents:
40886
diff
changeset
|
237 | |
|
39036
ced50832d0c7
libpidgin: Add pidgin icon path to GtkIconTheme
Mike Ruprecht <cmaiku@gmail.com>
parents:
39014
diff
changeset
|
238 | path = g_build_filename(PURPLE_DATADIR, "pidgin", "icons", NULL); |
|
41539
447daf762aee
Migrate libpidgin.c to gtk4
Gary Kramlich <grim@reaperworld.com>
parents:
41517
diff
changeset
|
239 | gtk_icon_theme_add_search_path(theme, path); |
|
39036
ced50832d0c7
libpidgin: Add pidgin icon path to GtkIconTheme
Mike Ruprecht <cmaiku@gmail.com>
parents:
39014
diff
changeset
|
240 | g_free(path); |
|
ced50832d0c7
libpidgin: Add pidgin icon path to GtkIconTheme
Mike Ruprecht <cmaiku@gmail.com>
parents:
39014
diff
changeset
|
241 | |
|
41037
c2043b9692f6
Add icon-name, icon-search-path, and icon-resource-path to PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
41034
diff
changeset
|
242 | /* Add a callback for when a protocol is registered to add its icon paths |
|
c2043b9692f6
Add icon-name, icon-search-path, and icon-resource-path to PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
41034
diff
changeset
|
243 | * if it was found after initial startup. |
|
c2043b9692f6
Add icon-name, icon-search-path, and icon-resource-path to PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
41034
diff
changeset
|
244 | */ |
|
c2043b9692f6
Add icon-name, icon-search-path, and icon-resource-path to PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
41034
diff
changeset
|
245 | protocol_manager = purple_protocol_manager_get_default(); |
|
c2043b9692f6
Add icon-name, icon-search-path, and icon-resource-path to PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
41034
diff
changeset
|
246 | g_signal_connect(protocol_manager, "registered", |
|
c2043b9692f6
Add icon-name, icon-search-path, and icon-resource-path to PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
41034
diff
changeset
|
247 | G_CALLBACK(purple_ui_protocol_registered_cb), NULL); |
|
c2043b9692f6
Add icon-name, icon-search-path, and icon-resource-path to PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
41034
diff
changeset
|
248 | |
|
c2043b9692f6
Add icon-name, icon-search-path, and icon-resource-path to PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
41034
diff
changeset
|
249 | /* Add the icon paths for all the protocols that libpurple found at start |
|
c2043b9692f6
Add icon-name, icon-search-path, and icon-resource-path to PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
41034
diff
changeset
|
250 | * up. |
|
c2043b9692f6
Add icon-name, icon-search-path, and icon-resource-path to PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
41034
diff
changeset
|
251 | */ |
|
c2043b9692f6
Add icon-name, icon-search-path, and icon-resource-path to PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
41034
diff
changeset
|
252 | purple_protocol_manager_foreach(protocol_manager, |
|
c2043b9692f6
Add icon-name, icon-search-path, and icon-resource-path to PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
41034
diff
changeset
|
253 | purple_ui_protocol_foreach_theme_cb, NULL); |
|
c2043b9692f6
Add icon-name, icon-search-path, and icon-resource-path to PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
41034
diff
changeset
|
254 | |
|
41109
755e1554051c
Make user interfaces setup the default history adapter.
Gary Kramlich <grim@reaperworld.com>
parents:
41106
diff
changeset
|
255 | if(!pidgin_history_init(&error)) { |
|
755e1554051c
Make user interfaces setup the default history adapter.
Gary Kramlich <grim@reaperworld.com>
parents:
41106
diff
changeset
|
256 | g_critical("failed to initialize the history api: %s", |
|
755e1554051c
Make user interfaces setup the default history adapter.
Gary Kramlich <grim@reaperworld.com>
parents:
41106
diff
changeset
|
257 | error != NULL ? error->message : "unknown"); |
|
755e1554051c
Make user interfaces setup the default history adapter.
Gary Kramlich <grim@reaperworld.com>
parents:
41106
diff
changeset
|
258 | g_clear_error(&error); |
|
755e1554051c
Make user interfaces setup the default history adapter.
Gary Kramlich <grim@reaperworld.com>
parents:
41106
diff
changeset
|
259 | } |
|
755e1554051c
Make user interfaces setup the default history adapter.
Gary Kramlich <grim@reaperworld.com>
parents:
41106
diff
changeset
|
260 | |
| 10302 | 261 | /* Set the UI operation structures. */ |
| 15884 | 262 | purple_xfers_set_ui_ops(pidgin_xfers_get_ui_ops()); |
|
39693
86f5c1fef140
Convert UI ops to PurpleBuddyListClass methods.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39603
diff
changeset
|
263 | purple_blist_set_ui(PIDGIN_TYPE_BUDDY_LIST); |
| 15884 | 264 | purple_notify_set_ui_ops(pidgin_notify_get_ui_ops()); |
| 265 | purple_request_set_ui_ops(pidgin_request_get_ui_ops()); | |
| 266 | purple_connections_set_ui_ops(pidgin_connections_get_ui_ops()); | |
| 267 | purple_whiteboard_set_ui_ops(pidgin_whiteboard_get_ui_ops()); | |
|
41136
5397330041d6
Replace PurpleIdleUiOps with the PurpleIdleUi Interface
Gary Kramlich <grim@reaperworld.com>
parents:
41127
diff
changeset
|
268 | purple_idle_set_ui(pidgin_idle_new()); |
| 10302 | 269 | |
|
34587
a3bc28bb4ef5
Refactored pidgin to use the GObject-based PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
33955
diff
changeset
|
270 | pidgin_accounts_init(); |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15498
diff
changeset
|
271 | pidgin_connection_init(); |
|
34502
433382371e89
Request API: datasheet field
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34308
diff
changeset
|
272 | pidgin_request_init(); |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15498
diff
changeset
|
273 | pidgin_blist_init(); |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15498
diff
changeset
|
274 | pidgin_conversations_init(); |
|
40871
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
40683
diff
changeset
|
275 | pidgin_commands_init(); |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15498
diff
changeset
|
276 | pidgin_privacy_init(); |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15498
diff
changeset
|
277 | pidgin_xfers_init(); |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15498
diff
changeset
|
278 | pidgin_roomlist_init(); |
|
26269
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
24585
diff
changeset
|
279 | 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
|
280 | pidgin_notify_init(); |
| 10302 | 281 | } |
| 282 | ||
| 283 | static void | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15498
diff
changeset
|
284 | pidgin_quit(void) |
| 10302 | 285 | { |
|
10574
5abb2931b6ff
[gaim-migrate @ 11966]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10448
diff
changeset
|
286 | /* Uninit */ |
|
38645
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38578
diff
changeset
|
287 | |
|
41111
19acd30c5000
Close the Debug Window on shutdown
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
41109
diff
changeset
|
288 | /* Be sure to close all windows that are not attached to anything |
|
19acd30c5000
Close the Debug Window on shutdown
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
41109
diff
changeset
|
289 | * (e.g., the debug window), or they may access things after they are |
|
19acd30c5000
Close the Debug Window on shutdown
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
41109
diff
changeset
|
290 | * shut down. */ |
|
27476
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27361
diff
changeset
|
291 | pidgin_notify_uninit(); |
|
40871
7c5b89b33e19
Separate the conversation commands out to their own file
Gary Kramlich <grim@reaperworld.com>
parents:
40683
diff
changeset
|
292 | pidgin_commands_uninit(); |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15498
diff
changeset
|
293 | pidgin_conversations_uninit(); |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15498
diff
changeset
|
294 | pidgin_blist_uninit(); |
|
34502
433382371e89
Request API: datasheet field
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34308
diff
changeset
|
295 | pidgin_request_uninit(); |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15498
diff
changeset
|
296 | pidgin_connection_uninit(); |
|
34587
a3bc28bb4ef5
Refactored pidgin to use the GObject-based PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
33955
diff
changeset
|
297 | pidgin_accounts_uninit(); |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15498
diff
changeset
|
298 | pidgin_xfers_uninit(); |
|
41111
19acd30c5000
Close the Debug Window on shutdown
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
41109
diff
changeset
|
299 | pidgin_debug_window_hide(); |
|
41117
6dc7e403f8f2
Initialize Pidgin GLib logging handler earlier
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41111
diff
changeset
|
300 | pidgin_debug_uninit(); |
|
10574
5abb2931b6ff
[gaim-migrate @ 11966]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10448
diff
changeset
|
301 | |
| 10302 | 302 | /* and end it all... */ |
|
38383
0ceb576f5617
libpidgin: Port to use GtkApplication
Mike Ruprecht <cmaiku@gmail.com>
parents:
38240
diff
changeset
|
303 | g_application_quit(g_application_get_default()); |
| 10302 | 304 | } |
| 305 | ||
|
41806
b7a1aab4b3be
Add a get_settings_backend vfunc to CoreUiOps
Gary Kramlich <grim@reaperworld.com>
parents:
41723
diff
changeset
|
306 | static gpointer |
|
b7a1aab4b3be
Add a get_settings_backend vfunc to CoreUiOps
Gary Kramlich <grim@reaperworld.com>
parents:
41723
diff
changeset
|
307 | pidgin_get_settings_backend(void) { |
|
b7a1aab4b3be
Add a get_settings_backend vfunc to CoreUiOps
Gary Kramlich <grim@reaperworld.com>
parents:
41723
diff
changeset
|
308 | GSettingsBackend *backend = NULL; |
|
b7a1aab4b3be
Add a get_settings_backend vfunc to CoreUiOps
Gary Kramlich <grim@reaperworld.com>
parents:
41723
diff
changeset
|
309 | char *config = NULL; |
|
b7a1aab4b3be
Add a get_settings_backend vfunc to CoreUiOps
Gary Kramlich <grim@reaperworld.com>
parents:
41723
diff
changeset
|
310 | |
|
b7a1aab4b3be
Add a get_settings_backend vfunc to CoreUiOps
Gary Kramlich <grim@reaperworld.com>
parents:
41723
diff
changeset
|
311 | config = g_build_filename(purple_config_dir(), "pidgin3.ini", NULL); |
|
b7a1aab4b3be
Add a get_settings_backend vfunc to CoreUiOps
Gary Kramlich <grim@reaperworld.com>
parents:
41723
diff
changeset
|
312 | backend = g_keyfile_settings_backend_new(config, "/", NULL); |
|
b7a1aab4b3be
Add a get_settings_backend vfunc to CoreUiOps
Gary Kramlich <grim@reaperworld.com>
parents:
41723
diff
changeset
|
313 | |
|
b7a1aab4b3be
Add a get_settings_backend vfunc to CoreUiOps
Gary Kramlich <grim@reaperworld.com>
parents:
41723
diff
changeset
|
314 | g_free(config); |
|
b7a1aab4b3be
Add a get_settings_backend vfunc to CoreUiOps
Gary Kramlich <grim@reaperworld.com>
parents:
41723
diff
changeset
|
315 | |
|
b7a1aab4b3be
Add a get_settings_backend vfunc to CoreUiOps
Gary Kramlich <grim@reaperworld.com>
parents:
41723
diff
changeset
|
316 | return backend; |
|
b7a1aab4b3be
Add a get_settings_backend vfunc to CoreUiOps
Gary Kramlich <grim@reaperworld.com>
parents:
41723
diff
changeset
|
317 | } |
|
b7a1aab4b3be
Add a get_settings_backend vfunc to CoreUiOps
Gary Kramlich <grim@reaperworld.com>
parents:
41723
diff
changeset
|
318 | |
|
41723
124c95083fad
Move PurpleCoreUiOps to struct intializers.
Gary Kramlich <grim@reaperworld.com>
parents:
41539
diff
changeset
|
319 | static PurpleCoreUiOps core_ops = { |
|
124c95083fad
Move PurpleCoreUiOps to struct intializers.
Gary Kramlich <grim@reaperworld.com>
parents:
41539
diff
changeset
|
320 | .ui_prefs_init = pidgin_prefs_init, |
|
124c95083fad
Move PurpleCoreUiOps to struct intializers.
Gary Kramlich <grim@reaperworld.com>
parents:
41539
diff
changeset
|
321 | .ui_init = pidgin_ui_init, |
|
124c95083fad
Move PurpleCoreUiOps to struct intializers.
Gary Kramlich <grim@reaperworld.com>
parents:
41539
diff
changeset
|
322 | .quit = pidgin_quit, |
|
41806
b7a1aab4b3be
Add a get_settings_backend vfunc to CoreUiOps
Gary Kramlich <grim@reaperworld.com>
parents:
41723
diff
changeset
|
323 | .get_settings_backend = pidgin_get_settings_backend, |
| 10302 | 324 | }; |
| 325 | ||
|
40553
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
40531
diff
changeset
|
326 | PurpleCoreUiOps * |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15498
diff
changeset
|
327 | pidgin_core_get_ui_ops(void) |
| 10302 | 328 | { |
| 329 | return &core_ops; | |
| 330 | } | |
| 331 | ||
|
39256
0245b49e1231
libpidgin: Use GApplication command line argument parsing and uniqueness
Mike Ruprecht <cmaiku@gmail.com>
parents:
39255
diff
changeset
|
332 | #ifndef _WIN32 |
|
0245b49e1231
libpidgin: Use GApplication command line argument parsing and uniqueness
Mike Ruprecht <cmaiku@gmail.com>
parents:
39255
diff
changeset
|
333 | static void |
|
0245b49e1231
libpidgin: Use GApplication command line argument parsing and uniqueness
Mike Ruprecht <cmaiku@gmail.com>
parents:
39255
diff
changeset
|
334 | pidgin_setup_error_handler(void) |
| 10302 | 335 | { |
| 336 | int sig_indx; /* for setting up signal catching */ | |
| 337 | sigset_t sigset; | |
|
10323
f4a013ac9e7c
[gaim-migrate @ 11530]
Mark Doliner <markdoliner@pidgin.im>
parents:
10322
diff
changeset
|
338 | 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
|
339 | 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
|
340 | GIOStatus signal_status; |
|
39365
af69ee5abbf2
pidgin: Fix compiling with -Dconsole-logging=true
Mike Ruprecht <cmaiku@gmail.com>
parents:
39335
diff
changeset
|
341 | GError *error = NULL; |
|
13215
c3e72e316531
[gaim-migrate @ 15578]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13111
diff
changeset
|
342 | char *segfault_message_tmp; |
| 10302 | 343 | |
|
40531
ed47469c4311
Fix some broken urls and get rid of the old developer segfault message
Gary Kramlich <grim@reaperworld.com>
parents:
40509
diff
changeset
|
344 | /* We translate this here in case the crash breaks gettext. */ |
|
ed47469c4311
Fix some broken urls and get rid of the old developer segfault message
Gary Kramlich <grim@reaperworld.com>
parents:
40509
diff
changeset
|
345 | segfault_message_tmp = g_strdup_printf(_( |
|
ed47469c4311
Fix some broken urls and get rid of the old developer segfault message
Gary Kramlich <grim@reaperworld.com>
parents:
40509
diff
changeset
|
346 | "%s %s has segfaulted and attempted to dump a core file.\n" |
|
ed47469c4311
Fix some broken urls and get rid of the old developer segfault message
Gary Kramlich <grim@reaperworld.com>
parents:
40509
diff
changeset
|
347 | "This is a bug in the software and has happened through\n" |
|
ed47469c4311
Fix some broken urls and get rid of the old developer segfault message
Gary Kramlich <grim@reaperworld.com>
parents:
40509
diff
changeset
|
348 | "no fault of your own.\n\n" |
|
ed47469c4311
Fix some broken urls and get rid of the old developer segfault message
Gary Kramlich <grim@reaperworld.com>
parents:
40509
diff
changeset
|
349 | "If you can reproduce the crash, please notify the developers\n" |
|
ed47469c4311
Fix some broken urls and get rid of the old developer segfault message
Gary Kramlich <grim@reaperworld.com>
parents:
40509
diff
changeset
|
350 | "by reporting a bug at:\n" |
|
ed47469c4311
Fix some broken urls and get rid of the old developer segfault message
Gary Kramlich <grim@reaperworld.com>
parents:
40509
diff
changeset
|
351 | "%snewissue\n\n" |
|
ed47469c4311
Fix some broken urls and get rid of the old developer segfault message
Gary Kramlich <grim@reaperworld.com>
parents:
40509
diff
changeset
|
352 | "Please make sure to specify what you were doing at the time\n" |
|
ed47469c4311
Fix some broken urls and get rid of the old developer segfault message
Gary Kramlich <grim@reaperworld.com>
parents:
40509
diff
changeset
|
353 | "and post the backtrace from the core file. If you do not know\n" |
|
ed47469c4311
Fix some broken urls and get rid of the old developer segfault message
Gary Kramlich <grim@reaperworld.com>
parents:
40509
diff
changeset
|
354 | "how to get the backtrace, please read the instructions at\n" |
|
ed47469c4311
Fix some broken urls and get rid of the old developer segfault message
Gary Kramlich <grim@reaperworld.com>
parents:
40509
diff
changeset
|
355 | "https://developer.pidgin.im/wiki/GetABacktrace\n"), |
|
ed47469c4311
Fix some broken urls and get rid of the old developer segfault message
Gary Kramlich <grim@reaperworld.com>
parents:
40509
diff
changeset
|
356 | PIDGIN_NAME, DISPLAY_VERSION, PURPLE_WEBSITE |
|
ed47469c4311
Fix some broken urls and get rid of the old developer segfault message
Gary Kramlich <grim@reaperworld.com>
parents:
40509
diff
changeset
|
357 | ); |
|
13587
fb0245a7ccab
[gaim-migrate @ 15971]
Daniel Atallah <datallah@pidgin.im>
parents:
13429
diff
changeset
|
358 | |
|
40531
ed47469c4311
Fix some broken urls and get rid of the old developer segfault message
Gary Kramlich <grim@reaperworld.com>
parents:
40509
diff
changeset
|
359 | /* we have to convert the message (UTF-8 to console |
|
ed47469c4311
Fix some broken urls and get rid of the old developer segfault message
Gary Kramlich <grim@reaperworld.com>
parents:
40509
diff
changeset
|
360 | charset) early because after a segmentation fault |
|
ed47469c4311
Fix some broken urls and get rid of the old developer segfault message
Gary Kramlich <grim@reaperworld.com>
parents:
40509
diff
changeset
|
361 | it's not a good practice to allocate memory */ |
|
ed47469c4311
Fix some broken urls and get rid of the old developer segfault message
Gary Kramlich <grim@reaperworld.com>
parents:
40509
diff
changeset
|
362 | segfault_message = g_locale_from_utf8(segfault_message_tmp, -1, NULL, NULL, |
|
ed47469c4311
Fix some broken urls and get rid of the old developer segfault message
Gary Kramlich <grim@reaperworld.com>
parents:
40509
diff
changeset
|
363 | &error); |
|
ed47469c4311
Fix some broken urls and get rid of the old developer segfault message
Gary Kramlich <grim@reaperworld.com>
parents:
40509
diff
changeset
|
364 | if(segfault_message != NULL) { |
|
ed47469c4311
Fix some broken urls and get rid of the old developer segfault message
Gary Kramlich <grim@reaperworld.com>
parents:
40509
diff
changeset
|
365 | g_free(segfault_message_tmp); |
|
ed47469c4311
Fix some broken urls and get rid of the old developer segfault message
Gary Kramlich <grim@reaperworld.com>
parents:
40509
diff
changeset
|
366 | } else { |
|
ed47469c4311
Fix some broken urls and get rid of the old developer segfault message
Gary Kramlich <grim@reaperworld.com>
parents:
40509
diff
changeset
|
367 | /* use 'segfault_message_tmp' (UTF-8) as a fallback */ |
|
ed47469c4311
Fix some broken urls and get rid of the old developer segfault message
Gary Kramlich <grim@reaperworld.com>
parents:
40509
diff
changeset
|
368 | g_warning("%s\n", error->message); |
|
ed47469c4311
Fix some broken urls and get rid of the old developer segfault message
Gary Kramlich <grim@reaperworld.com>
parents:
40509
diff
changeset
|
369 | g_clear_error(&error); |
|
ed47469c4311
Fix some broken urls and get rid of the old developer segfault message
Gary Kramlich <grim@reaperworld.com>
parents:
40509
diff
changeset
|
370 | segfault_message = segfault_message_tmp; |
|
ed47469c4311
Fix some broken urls and get rid of the old developer segfault message
Gary Kramlich <grim@reaperworld.com>
parents:
40509
diff
changeset
|
371 | } |
|
12556
f4d4e4e3a825
[gaim-migrate @ 14875]
Richard Laager <rlaager@pidgin.im>
parents:
12409
diff
changeset
|
372 | |
|
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
|
373 | /* |
|
58701e24ed40
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents:
28800
diff
changeset
|
374 | * 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
|
375 | * 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
|
376 | */ |
|
58701e24ed40
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents:
28800
diff
changeset
|
377 | 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
|
378 | 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
|
379 | 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
|
380 | } |
|
58701e24ed40
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents:
28800
diff
changeset
|
381 | 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
|
382 | |
|
58701e24ed40
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents:
28800
diff
changeset
|
383 | /* |
|
58701e24ed40
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents:
28800
diff
changeset
|
384 | * 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
|
385 | * 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
|
386 | */ |
|
58701e24ed40
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <markdoliner@pidgin.im>
parents:
28800
diff
changeset
|
387 | 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
|
388 | 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
|
389 | 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
|
390 | "binary: %s", error->message); |
|
38607
51b50879b5c9
libpidgin: Fix Windows crash by initializing error to NULL
Mike Ruprecht <cmaiku@gmail.com>
parents:
38578
diff
changeset
|
391 | 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
|
392 | 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
|
393 | } |
|
29991
37e306c31983
Try to be polite and free stuff associated with our signal watcher pipes
Mark Doliner <markdoliner@pidgin.im>
parents:
29662
diff
changeset
|
394 | 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
|
395 | 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
|
396 | |
| 10302 | 397 | /* Let's not violate any PLA's!!!! */ |
| 398 | /* jseymour: whatever the fsck that means */ | |
| 399 | /* Robot101: for some reason things like gdm like to block * | |
| 400 | * useful signals like SIGCHLD, so we unblock all the ones we * | |
| 401 | * declare a handler for. thanks JSeymour and Vann. */ | |
| 402 | if (sigemptyset(&sigset)) { | |
|
40094
8e6d91e4dd8f
Use g_(v)snprintf so we need less wrappers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39954
diff
changeset
|
403 | g_snprintf(errmsg, sizeof(errmsg), |
|
8e6d91e4dd8f
Use g_(v)snprintf so we need less wrappers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39954
diff
changeset
|
404 | "Warning: couldn't initialise empty signal set"); |
| 10302 | 405 | perror(errmsg); |
| 406 | } | |
| 407 | 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
|
408 | if(signal(catch_sig_list[sig_indx], sighandler) == SIG_ERR) { |
|
40094
8e6d91e4dd8f
Use g_(v)snprintf so we need less wrappers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39954
diff
changeset
|
409 | g_snprintf(errmsg, sizeof(errmsg), |
|
8e6d91e4dd8f
Use g_(v)snprintf so we need less wrappers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39954
diff
changeset
|
410 | "Warning: couldn't set signal %d for catching", |
|
8e6d91e4dd8f
Use g_(v)snprintf so we need less wrappers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39954
diff
changeset
|
411 | catch_sig_list[sig_indx]); |
| 10302 | 412 | perror(errmsg); |
| 413 | } | |
| 414 | if(sigaddset(&sigset, catch_sig_list[sig_indx])) { | |
|
40094
8e6d91e4dd8f
Use g_(v)snprintf so we need less wrappers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39954
diff
changeset
|
415 | g_snprintf(errmsg, sizeof(errmsg), |
|
8e6d91e4dd8f
Use g_(v)snprintf so we need less wrappers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39954
diff
changeset
|
416 | "Warning: couldn't include signal %d for unblocking", |
|
8e6d91e4dd8f
Use g_(v)snprintf so we need less wrappers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39954
diff
changeset
|
417 | catch_sig_list[sig_indx]); |
| 10302 | 418 | perror(errmsg); |
| 419 | } | |
| 420 | } | |
| 421 | 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
|
422 | if(signal(ignore_sig_list[sig_indx], SIG_IGN) == SIG_ERR) { |
|
40094
8e6d91e4dd8f
Use g_(v)snprintf so we need less wrappers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39954
diff
changeset
|
423 | g_snprintf(errmsg, sizeof(errmsg), |
|
8e6d91e4dd8f
Use g_(v)snprintf so we need less wrappers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39954
diff
changeset
|
424 | "Warning: couldn't set signal %d to ignore", |
|
8e6d91e4dd8f
Use g_(v)snprintf so we need less wrappers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39954
diff
changeset
|
425 | ignore_sig_list[sig_indx]); |
| 10302 | 426 | perror(errmsg); |
| 427 | } | |
| 428 | } | |
| 429 | ||
| 430 | if (sigprocmask(SIG_UNBLOCK, &sigset, NULL)) { | |
|
40094
8e6d91e4dd8f
Use g_(v)snprintf so we need less wrappers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39954
diff
changeset
|
431 | g_snprintf(errmsg, sizeof(errmsg), "Warning: couldn't unblock signals"); |
| 10302 | 432 | perror(errmsg); |
|
10307
f3ba80364053
[gaim-migrate @ 11497]
Mark Doliner <markdoliner@pidgin.im>
parents:
10306
diff
changeset
|
433 | } |
|
39256
0245b49e1231
libpidgin: Use GApplication command line argument parsing and uniqueness
Mike Ruprecht <cmaiku@gmail.com>
parents:
39255
diff
changeset
|
434 | } |
|
38064
7cb860a7bb2e
libpidgin: Fix Win32 build due to lacking signalpair() and some enums
Mike Ruprecht <cmaiku@gmail.com>
parents:
38048
diff
changeset
|
435 | #endif /* !_WIN32 */ |
| 10302 | 436 | |
|
39256
0245b49e1231
libpidgin: Use GApplication command line argument parsing and uniqueness
Mike Ruprecht <cmaiku@gmail.com>
parents:
39255
diff
changeset
|
437 | int pidgin_start(int argc, char *argv[]) |
|
0245b49e1231
libpidgin: Use GApplication command line argument parsing and uniqueness
Mike Ruprecht <cmaiku@gmail.com>
parents:
39255
diff
changeset
|
438 | { |
|
0245b49e1231
libpidgin: Use GApplication command line argument parsing and uniqueness
Mike Ruprecht <cmaiku@gmail.com>
parents:
39255
diff
changeset
|
439 | GApplication *app; |
|
0245b49e1231
libpidgin: Use GApplication command line argument parsing and uniqueness
Mike Ruprecht <cmaiku@gmail.com>
parents:
39255
diff
changeset
|
440 | int ret; |
|
0245b49e1231
libpidgin: Use GApplication command line argument parsing and uniqueness
Mike Ruprecht <cmaiku@gmail.com>
parents:
39255
diff
changeset
|
441 | |
|
0245b49e1231
libpidgin: Use GApplication command line argument parsing and uniqueness
Mike Ruprecht <cmaiku@gmail.com>
parents:
39255
diff
changeset
|
442 | bindtextdomain(PACKAGE, PURPLE_LOCALEDIR); |
|
0245b49e1231
libpidgin: Use GApplication command line argument parsing and uniqueness
Mike Ruprecht <cmaiku@gmail.com>
parents:
39255
diff
changeset
|
443 | bind_textdomain_codeset(PACKAGE, "UTF-8"); |
|
0245b49e1231
libpidgin: Use GApplication command line argument parsing and uniqueness
Mike Ruprecht <cmaiku@gmail.com>
parents:
39255
diff
changeset
|
444 | textdomain(PACKAGE); |
|
0245b49e1231
libpidgin: Use GApplication command line argument parsing and uniqueness
Mike Ruprecht <cmaiku@gmail.com>
parents:
39255
diff
changeset
|
445 | |
|
0245b49e1231
libpidgin: Use GApplication command line argument parsing and uniqueness
Mike Ruprecht <cmaiku@gmail.com>
parents:
39255
diff
changeset
|
446 | /* Locale initialization is not complete here. See gtk_init_check() */ |
|
0245b49e1231
libpidgin: Use GApplication command line argument parsing and uniqueness
Mike Ruprecht <cmaiku@gmail.com>
parents:
39255
diff
changeset
|
447 | setlocale(LC_ALL, ""); |
|
0245b49e1231
libpidgin: Use GApplication command line argument parsing and uniqueness
Mike Ruprecht <cmaiku@gmail.com>
parents:
39255
diff
changeset
|
448 | |
|
0245b49e1231
libpidgin: Use GApplication command line argument parsing and uniqueness
Mike Ruprecht <cmaiku@gmail.com>
parents:
39255
diff
changeset
|
449 | #ifndef _WIN32 |
|
0245b49e1231
libpidgin: Use GApplication command line argument parsing and uniqueness
Mike Ruprecht <cmaiku@gmail.com>
parents:
39255
diff
changeset
|
450 | pidgin_setup_error_handler(); |
|
0245b49e1231
libpidgin: Use GApplication command line argument parsing and uniqueness
Mike Ruprecht <cmaiku@gmail.com>
parents:
39255
diff
changeset
|
451 | #endif |
|
0245b49e1231
libpidgin: Use GApplication command line argument parsing and uniqueness
Mike Ruprecht <cmaiku@gmail.com>
parents:
39255
diff
changeset
|
452 | |
|
40553
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
40531
diff
changeset
|
453 | app = pidgin_application_new(); |
|
40600
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40553
diff
changeset
|
454 | g_application_set_default(app); |
|
39256
0245b49e1231
libpidgin: Use GApplication command line argument parsing and uniqueness
Mike Ruprecht <cmaiku@gmail.com>
parents:
39255
diff
changeset
|
455 | |
|
0245b49e1231
libpidgin: Use GApplication command line argument parsing and uniqueness
Mike Ruprecht <cmaiku@gmail.com>
parents:
39255
diff
changeset
|
456 | ret = g_application_run(app, argc, argv); |
|
38383
0ceb576f5617
libpidgin: Port to use GtkApplication
Mike Ruprecht <cmaiku@gmail.com>
parents:
38240
diff
changeset
|
457 | |
|
0ceb576f5617
libpidgin: Port to use GtkApplication
Mike Ruprecht <cmaiku@gmail.com>
parents:
38240
diff
changeset
|
458 | /* 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
|
459 | * 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
|
460 | * happen, for example, if the desktop session is ending. |
|
0ceb576f5617
libpidgin: Port to use GtkApplication
Mike Ruprecht <cmaiku@gmail.com>
parents:
38240
diff
changeset
|
461 | */ |
|
0ceb576f5617
libpidgin: Port to use GtkApplication
Mike Ruprecht <cmaiku@gmail.com>
parents:
38240
diff
changeset
|
462 | if (purple_get_core() != NULL) { |
|
0ceb576f5617
libpidgin: Port to use GtkApplication
Mike Ruprecht <cmaiku@gmail.com>
parents:
38240
diff
changeset
|
463 | purple_core_quit(); |
|
0ceb576f5617
libpidgin: Port to use GtkApplication
Mike Ruprecht <cmaiku@gmail.com>
parents:
38240
diff
changeset
|
464 | } |
|
0ceb576f5617
libpidgin: Port to use GtkApplication
Mike Ruprecht <cmaiku@gmail.com>
parents:
38240
diff
changeset
|
465 | |
|
39256
0245b49e1231
libpidgin: Use GApplication command line argument parsing and uniqueness
Mike Ruprecht <cmaiku@gmail.com>
parents:
39255
diff
changeset
|
466 | if (g_application_get_is_registered(app) && |
|
0245b49e1231
libpidgin: Use GApplication command line argument parsing and uniqueness
Mike Ruprecht <cmaiku@gmail.com>
parents:
39255
diff
changeset
|
467 | g_application_get_is_remote(app)) { |
|
39921
a9c92a82f4c8
Don't pass literals to g_set_error / g_error_new.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39857
diff
changeset
|
468 | g_printerr("%s\n", _("Exiting because another libpurple client is " |
|
a9c92a82f4c8
Don't pass literals to g_set_error / g_error_new.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39857
diff
changeset
|
469 | "already running.")); |
|
39256
0245b49e1231
libpidgin: Use GApplication command line argument parsing and uniqueness
Mike Ruprecht <cmaiku@gmail.com>
parents:
39255
diff
changeset
|
470 | } |
|
0245b49e1231
libpidgin: Use GApplication command line argument parsing and uniqueness
Mike Ruprecht <cmaiku@gmail.com>
parents:
39255
diff
changeset
|
471 | |
|
38383
0ceb576f5617
libpidgin: Port to use GtkApplication
Mike Ruprecht <cmaiku@gmail.com>
parents:
38240
diff
changeset
|
472 | /* 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
|
473 | * this can be freed. |
|
0ceb576f5617
libpidgin: Port to use GtkApplication
Mike Ruprecht <cmaiku@gmail.com>
parents:
38240
diff
changeset
|
474 | */ |
|
0ceb576f5617
libpidgin: Port to use GtkApplication
Mike Ruprecht <cmaiku@gmail.com>
parents:
38240
diff
changeset
|
475 | g_object_unref(app); |
|
10320
f5b0f5cf8562
[gaim-migrate @ 11527]
Mark Doliner <markdoliner@pidgin.im>
parents:
10317
diff
changeset
|
476 | |
|
38064
7cb860a7bb2e
libpidgin: Fix Win32 build due to lacking signalpair() and some enums
Mike Ruprecht <cmaiku@gmail.com>
parents:
38048
diff
changeset
|
477 | #ifndef _WIN32 |
|
12556
f4d4e4e3a825
[gaim-migrate @ 14875]
Richard Laager <rlaager@pidgin.im>
parents:
12409
diff
changeset
|
478 | 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
|
479 | 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
|
480 | 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
|
481 | 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
|
482 | #endif |
|
12556
f4d4e4e3a825
[gaim-migrate @ 14875]
Richard Laager <rlaager@pidgin.im>
parents:
12409
diff
changeset
|
483 | |
| 10302 | 484 | #ifdef _WIN32 |
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15567
diff
changeset
|
485 | winpidgin_cleanup(); |
| 10302 | 486 | #endif |
| 487 | ||
|
38383
0ceb576f5617
libpidgin: Port to use GtkApplication
Mike Ruprecht <cmaiku@gmail.com>
parents:
38240
diff
changeset
|
488 | return ret; |
| 10302 | 489 | } |