pidgin/pidgintalkatu.c

Sat, 29 Oct 2022 01:14:13 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Sat, 29 Oct 2022 01:14:13 -0500
changeset 41859
ed82ab63d15a
parent 40484
7df95db772d8
child 42094
2707c81648a0
permissions
-rw-r--r--

Convert PidginProxyPrefs to Adwaita 1.2

Testing Done:
Set all the values via the ui and the config file and tested bad values in the port in both as well. Bad values in the ui will store whatever atoi returned, but bad values in the config file will fallback to the default.

Reviewed at https://reviews.imfreedom.org/r/1996/

39223
7016ec26cd75 Move GtkPounce to Talkatu
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1 /* pidgin
7016ec26cd75 Move GtkPounce to Talkatu
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
2 *
7016ec26cd75 Move GtkPounce to Talkatu
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
3 * Pidgin is the legal property of its developers, whose names are too numerous
7016ec26cd75 Move GtkPounce to Talkatu
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
4 * to list here. Please refer to the COPYRIGHT file distributed with this
7016ec26cd75 Move GtkPounce to Talkatu
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
5 * source distribution.
7016ec26cd75 Move GtkPounce to Talkatu
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
6 *
7016ec26cd75 Move GtkPounce to Talkatu
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
7 * This program is free software; you can redistribute it and/or modify
7016ec26cd75 Move GtkPounce to Talkatu
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
8 * it under the terms of the GNU General Public License as published by
7016ec26cd75 Move GtkPounce to Talkatu
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
9 * the Free Software Foundation; either version 2 of the License, or
7016ec26cd75 Move GtkPounce to Talkatu
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
10 * (at your option) any later version.
7016ec26cd75 Move GtkPounce to Talkatu
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
11 *
7016ec26cd75 Move GtkPounce to Talkatu
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful,
7016ec26cd75 Move GtkPounce to Talkatu
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
7016ec26cd75 Move GtkPounce to Talkatu
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7016ec26cd75 Move GtkPounce to Talkatu
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
15 * GNU General Public License for more details.
7016ec26cd75 Move GtkPounce to Talkatu
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
16 *
7016ec26cd75 Move GtkPounce to Talkatu
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
17 * You should have received a copy of the GNU General Public License
7016ec26cd75 Move GtkPounce to Talkatu
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
18 * along with this program; if not, write to the Free Software
7016ec26cd75 Move GtkPounce to Talkatu
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
7016ec26cd75 Move GtkPounce to Talkatu
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
20 *
7016ec26cd75 Move GtkPounce to Talkatu
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
21 */
7016ec26cd75 Move GtkPounce to Talkatu
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
22
7016ec26cd75 Move GtkPounce to Talkatu
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
23 #include <pidgin/pidgintalkatu.h>
7016ec26cd75 Move GtkPounce to Talkatu
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
24
7016ec26cd75 Move GtkPounce to Talkatu
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
25 GtkWidget *
7016ec26cd75 Move GtkPounce to Talkatu
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
26 pidgin_talkatu_editor_new_for_connection(PurpleConnection *pc) {
40484
7df95db772d8 Update a a few things that were changed in talkatu
Gary Kramlich <grim@reaperworld.com>
parents: 39223
diff changeset
27 GtkWidget *editor = NULL, *input = NULL;
39223
7016ec26cd75 Move GtkPounce to Talkatu
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
28
7016ec26cd75 Move GtkPounce to Talkatu
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
29 g_return_val_if_fail(pc != NULL, NULL);
7016ec26cd75 Move GtkPounce to Talkatu
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
30
7016ec26cd75 Move GtkPounce to Talkatu
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
31 editor = talkatu_editor_new();
40484
7df95db772d8 Update a a few things that were changed in talkatu
Gary Kramlich <grim@reaperworld.com>
parents: 39223
diff changeset
32 input = talkatu_editor_get_input(TALKATU_EDITOR(editor));
39223
7016ec26cd75 Move GtkPounce to Talkatu
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
33
7016ec26cd75 Move GtkPounce to Talkatu
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
34 gtk_text_view_set_buffer(
40484
7df95db772d8 Update a a few things that were changed in talkatu
Gary Kramlich <grim@reaperworld.com>
parents: 39223
diff changeset
35 GTK_TEXT_VIEW(input),
39223
7016ec26cd75 Move GtkPounce to Talkatu
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
36 pidgin_talkatu_buffer_new_for_connection(pc)
7016ec26cd75 Move GtkPounce to Talkatu
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
37 );
7016ec26cd75 Move GtkPounce to Talkatu
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
38
7016ec26cd75 Move GtkPounce to Talkatu
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
39 return editor;
7016ec26cd75 Move GtkPounce to Talkatu
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
40 }
7016ec26cd75 Move GtkPounce to Talkatu
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
41
7016ec26cd75 Move GtkPounce to Talkatu
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
42 GtkTextBuffer *
7016ec26cd75 Move GtkPounce to Talkatu
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
43 pidgin_talkatu_buffer_new_for_connection(PurpleConnection *pc) {
7016ec26cd75 Move GtkPounce to Talkatu
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
44 PurpleConnectionFlags flags = 0;
7016ec26cd75 Move GtkPounce to Talkatu
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
45 GtkTextBuffer *buffer = NULL;
7016ec26cd75 Move GtkPounce to Talkatu
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
46
7016ec26cd75 Move GtkPounce to Talkatu
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
47 g_return_val_if_fail(pc != NULL, NULL);
7016ec26cd75 Move GtkPounce to Talkatu
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
48
7016ec26cd75 Move GtkPounce to Talkatu
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
49 flags = purple_connection_get_flags(pc);
7016ec26cd75 Move GtkPounce to Talkatu
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
50
7016ec26cd75 Move GtkPounce to Talkatu
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
51 if(flags & PURPLE_CONNECTION_FLAG_HTML) {
7016ec26cd75 Move GtkPounce to Talkatu
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
52 buffer = talkatu_html_buffer_new();
7016ec26cd75 Move GtkPounce to Talkatu
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
53 } else if(flags & PURPLE_CONNECTION_FLAG_FORMATTING_WBFO) {
7016ec26cd75 Move GtkPounce to Talkatu
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
54 buffer = talkatu_whole_buffer_new();
7016ec26cd75 Move GtkPounce to Talkatu
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
55 } else {
7016ec26cd75 Move GtkPounce to Talkatu
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
56 buffer = talkatu_buffer_new(NULL);
7016ec26cd75 Move GtkPounce to Talkatu
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
57 }
7016ec26cd75 Move GtkPounce to Talkatu
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
58
7016ec26cd75 Move GtkPounce to Talkatu
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
59 return buffer;
40484
7df95db772d8 Update a a few things that were changed in talkatu
Gary Kramlich <grim@reaperworld.com>
parents: 39223
diff changeset
60 }

mercurial