pidgin/gtkpluginpref.c

Thu, 23 Mar 2023 23:11:59 -0500

author
Elliott Sales de Andrade <quantum.analyst@gmail.com>
date
Thu, 23 Mar 2023 23:11:59 -0500
changeset 42184
4e1bf25f5575
parent 42094
2707c81648a0
permissions
-rw-r--r--

Fix several leaks in tests

All of these are specific to tests, not the library code.

For the moment, `protocol_xfer` still leaks connections (and anything they hold on to) because it is very difficult to disentangle them from the connection manager in the partially implemented state they are in.

This fixes leaks of options in the account option test (these two leaks occur for every test since they all leak the option):
```
61 (48 direct, 13 indirect) bytes in 1 blocks are definitely lost in loss record 133 of 276
at 0x4848464: calloc (vg_replace_malloc.c:1340)
by 0x49F75F0: g_malloc0 (gmem.c:163)
by 0x48C3B2E: purple_account_option_new (purpleaccountoption.c:78)
by 0x4014AF: test_purple_account_option_copy_int (test_account_option.c:67)
by 0x4A1CC7D: UnknownInlinedFun (gtestutils.c:2933)
by 0x4A1CC7D: g_test_run_suite_internal (gtestutils.c:3021)
by 0x4A1C9E4: g_test_run_suite_internal (gtestutils.c:3038)
by 0x4A1C9E4: g_test_run_suite_internal (gtestutils.c:3038)
by 0x4A1D181: g_test_run_suite (gtestutils.c:3115)
by 0x4A156EC: UnknownInlinedFun (gtestutils.c:2234)
by 0x4A156EC: g_test_run (gtestutils.c:2221)
by 0x401721: main (test_account_option.c:157)

61 (48 direct, 13 indirect) bytes in 1 blocks are definitely lost in loss record 134 of 276
at 0x4848464: calloc (vg_replace_malloc.c:1340)
by 0x49F75F0: g_malloc0 (gmem.c:163)
by 0x48C3BC7: purple_account_option_copy (purpleaccountoption.c:93)
by 0x4014BF: test_purple_account_option_copy_int (test_account_option.c:68)
by 0x4A1CC7D: UnknownInlinedFun (gtestutils.c:2933)
by 0x4A1CC7D: g_test_run_suite_internal (gtestutils.c:3021)
by 0x4A1C9E4: g_test_run_suite_internal (gtestutils.c:3038)
by 0x4A1C9E4: g_test_run_suite_internal (gtestutils.c:3038)
by 0x4A1D181: g_test_run_suite (gtestutils.c:3115)
by 0x4A156EC: UnknownInlinedFun (gtestutils.c:2234)
by 0x4A156EC: g_test_run (gtestutils.c:2221)
by 0x401721: main (test_account_option.c:157)
```
leaks in the credential manager test (times 3 for read/write/cancel tests):
```
69 (16 direct, 53 indirect) bytes in 1 blocks are definitely lost in loss record 2,427 of 3,503
at 0x484386F: malloc (vg_replace_malloc.c:393)
by 0x4A58168: g_malloc (gmem.c:130)
by 0x4A6FAB5: g_slice_alloc (gslice.c:1074)
by 0x4A700EC: g_slice_alloc0 (gslice.c:1100)
by 0x4A3BECB: g_error_allocate (gerror.c:710)
by 0x4A3C93F: UnknownInlinedFun (gerror.c:724)
by 0x4A3C93F: g_error_new_valist (gerror.c:766)
by 0x4BEE558: g_task_return_new_error (gtask.c:1941)
by 0x48D82C0: purple_credential_manager_read_password_async (purplecredentialmanager.c:492)
by 0x403634: test_purple_credential_manager_no_provider_read_password_idle (test_credential_manager.c:329)
by 0x4A4ECB1: g_idle_dispatch (gmain.c:6124)
by 0x4A4FCBE: UnknownInlinedFun (gmain.c:3444)
by 0x4A4FCBE: g_main_context_dispatch (gmain.c:4162)
by 0x4AA5597: g_main_context_iterate.constprop.0 (gmain.c:4238)
by 0x4A4F28E: g_main_loop_run (gmain.c:4438)
by 0x40369F: test_purple_credential_manager_no_provider_read_password_async (test_credential_manager.c:345)
by 0x4A7DC7D: UnknownInlinedFun (gtestutils.c:2933)
by 0x4A7DC7D: g_test_run_suite_internal (gtestutils.c:3021)
by 0x4A7D9E4: g_test_run_suite_internal (gtestutils.c:3038)
by 0x4A7D9E4: g_test_run_suite_internal (gtestutils.c:3038)
by 0x4A7E181: g_test_run_suite (gtestutils.c:3115)
by 0x4A766EC: UnknownInlinedFun (gtestutils.c:2234)
by 0x4A766EC: g_test_run (gtestutils.c:2221)
by 0x4048F6: main (test_credential_manager.c:695)
```
a leak in the image test:
```
161 bytes in 1 blocks are definitely lost in loss record 260 of 274
at 0x484386F: malloc (vg_replace_malloc.c:393)
by 0x4A55363: g_try_malloc (gmem.c:286)
by 0x4A3D630: UnknownInlinedFun (gfileutils.c:819)
by 0x4A3D630: UnknownInlinedFun (gfileutils.c:924)
by 0x4A3D630: g_file_get_contents (gfileutils.c:1027)
by 0x401890: test_image_new_from_file (test_image.c:144)
by 0x4A7DC7D: UnknownInlinedFun (gtestutils.c:2933)
by 0x4A7DC7D: g_test_run_suite_internal (gtestutils.c:3021)
by 0x4A7D9E4: g_test_run_suite_internal (gtestutils.c:3038)
by 0x4A7E181: g_test_run_suite (gtestutils.c:3115)
by 0x4A766EC: UnknownInlinedFun (gtestutils.c:2234)
by 0x4A766EC: g_test_run (gtestutils.c:2221)
by 0x40195D: main (test_image.c:172)
```
a leak in queued output stream test:
```
72 (40 direct, 32 indirect) bytes in 1 blocks are definitely lost in loss record 219 of 396
at 0x49D51EF: g_type_create_instance (gtype.c:1909)
by 0x49BAC1F: g_object_new_internal (gobject.c:2228)
by 0x49BC247: g_object_new_with_properties (gobject.c:2391)
by 0x49BCFF0: g_object_new (gobject.c:2037)
by 0x402003: test_queued_output_stream_push_bytes_async_error (test_queued_output_stream.c:219)
by 0x4A7DC7D: UnknownInlinedFun (gtestutils.c:2933)
by 0x4A7DC7D: g_test_run_suite_internal (gtestutils.c:3021)
by 0x4A7D9E4: g_test_run_suite_internal (gtestutils.c:3038)
by 0x4A7E181: g_test_run_suite (gtestutils.c:3115)
by 0x4A766EC: UnknownInlinedFun (gtestutils.c:2234)
by 0x4A766EC: g_test_run (gtestutils.c:2221)
by 0x402429: main (test_queued_output_stream.c:280)
```
and protocol xfer tests (times 3 for each test that creates a test protocol object):
```
112 (48 direct, 64 indirect) bytes in 1 blocks are definitely lost in loss record 3,430 of 3,698
at 0x49D51EF: g_type_create_instance (gtype.c:1909)
by 0x49BAC1F: g_object_new_internal (gobject.c:2228)
by 0x49BC247: g_object_new_with_properties (gobject.c:2391)
by 0x49BCFF0: g_object_new (gobject.c:2037)
by 0x40291C: test_purple_protocol_xfer_send_file_func (test_protocol_xfer.c:146)
by 0x4A7DC7D: UnknownInlinedFun (gtestutils.c:2933)
by 0x4A7DC7D: g_test_run_suite_internal (gtestutils.c:3021)
by 0x4A7D9E4: g_test_run_suite_internal (gtestutils.c:3038)
by 0x4A7E181: g_test_run_suite (gtestutils.c:3115)
by 0x4A766EC: UnknownInlinedFun (gtestutils.c:2234)
by 0x4A766EC: g_test_run (gtestutils.c:2221)
by 0x402B64: main (test_protocol_xfer.c:195)
```
and util tests (times 3 for each call to `purple_text_strip_mnemonic` in the test):
```
5 bytes in 1 blocks are definitely lost in loss record 5 of 247
at 0x484386F: malloc (vg_replace_malloc.c:393)
by 0x49F7168: g_malloc (gmem.c:130)
by 0x491975B: purple_text_strip_mnemonic (util.c:895)
by 0x4015B0: test_util_text_strip_mnemonic (test_util.c:49)
by 0x4A1CC7D: UnknownInlinedFun (gtestutils.c:2933)
by 0x4A1CC7D: g_test_run_suite_internal (gtestutils.c:3021)
by 0x4A1C9E4: g_test_run_suite_internal (gtestutils.c:3038)
by 0x4A1C9E4: g_test_run_suite_internal (gtestutils.c:3038)
by 0x4A1D181: g_test_run_suite (gtestutils.c:3115)
by 0x4A156EC: UnknownInlinedFun (gtestutils.c:2234)
by 0x4A156EC: g_test_run (gtestutils.c:2221)
by 0x401901: main (test_util.c:224)
```
and these leaks in any test that initializes the test UI:
```
4,104 bytes in 1 blocks are possibly lost in loss record 3,451 of 3,457
at 0x484386F: malloc (vg_replace_malloc.c:393)
by 0x5235B67: sqlite3MemMalloc.lto_priv.0 (sqlite3.c:25493)
by 0x5232797: UnknownInlinedFun (sqlite3.c:29181)
by 0x5232797: UnknownInlinedFun (sqlite3.c:29227)
by 0x5232797: sqlite3Malloc.lto_priv.0 (sqlite3.c:29221)
by 0x523BD8B: pcache1Alloc.lto_priv.0 (sqlite3.c:53546)
by 0x5249A8B: UnknownInlinedFun (sqlite3.c:53675)
by 0x5249A8B: allocateTempSpace (sqlite3.c:70848)
by 0x52625A6: sqlite3VdbeExec.lto_priv.0 (sqlite3.c:93857)
by 0x525CBEE: UnknownInlinedFun (sqlite3.c:87995)
by 0x525CBEE: UnknownInlinedFun (sqlite3.c:88056)
by 0x525CBEE: sqlite3_step (sqlite3.c:88045)
by 0x529B324: sqlite3_exec (sqlite3.c:131002)
by 0x48FD558: purple_sqlite3_run_migration (purplesqlite3.c:37)
by 0x48FDBB4: purple_sqlite3_run_migrations_from_resources (purplesqlite3.c:195)
by 0x48FDED9: purple_sqlite_history_adapter_run_migrations (purplesqlitehistoryadapter.c:69)
by 0x48FE7F0: purple_sqlite_history_adapter_activate (purplesqlitehistoryadapter.c:287)
by 0x48DB656: purple_history_adapter_activate (purplehistoryadapter.c:181)
by 0x48DC9BC: purple_history_manager_set_active (purplehistorymanager.c:308)
by 0x402BA8: test_ui_init_history (test_ui.c:132)
by 0x402C80: test_ui_purple_init (test_ui.c:167)
by 0x4027BB: main (test_contact.c:88)

4,368 bytes in 1 blocks are possibly lost in loss record 3,453 of 3,457
at 0x484386F: malloc (vg_replace_malloc.c:393)
by 0x5235B67: sqlite3MemMalloc.lto_priv.0 (sqlite3.c:25493)
by 0x5232797: UnknownInlinedFun (sqlite3.c:29181)
by 0x5232797: UnknownInlinedFun (sqlite3.c:29227)
by 0x5232797: sqlite3Malloc.lto_priv.0 (sqlite3.c:29221)
by 0x523BD8B: pcache1Alloc.lto_priv.0 (sqlite3.c:53546)
by 0x5240077: UnknownInlinedFun (sqlite3.c:53634)
by 0x5240077: pcache1FetchStage2 (sqlite3.c:54104)
by 0x5243E9C: UnknownInlinedFun (sqlite3.c:52671)
by 0x5243E9C: getPageNormal.lto_priv.0 (sqlite3.c:60628)
by 0x524A510: UnknownInlinedFun (sqlite3.c:60805)
by 0x524A510: btreeGetPage.lto_priv.0 (sqlite3.c:70289)
by 0x524C2F6: UnknownInlinedFun (sqlite3.c:71257)
by 0x524C2F6: sqlite3BtreeBeginTrans.lto_priv.0 (sqlite3.c:71647)
by 0x5266B3A: sqlite3VdbeExec.lto_priv.0 (sqlite3.c:93532)
by 0x525CBEE: UnknownInlinedFun (sqlite3.c:87995)
by 0x525CBEE: UnknownInlinedFun (sqlite3.c:88056)
by 0x525CBEE: sqlite3_step (sqlite3.c:88045)
by 0x48FD715: purple_sqlite3_get_schema_version (purplesqlite3.c:79)
by 0x48FD9DD: purple_sqlite3_run_migrations_from_resources (purplesqlite3.c:146)
by 0x48FDED9: purple_sqlite_history_adapter_run_migrations (purplesqlitehistoryadapter.c:69)
by 0x48FE7F0: purple_sqlite_history_adapter_activate (purplesqlitehistoryadapter.c:287)
by 0x48DB656: purple_history_adapter_activate (purplehistoryadapter.c:181)
by 0x48DC9BC: purple_history_manager_set_active (purplehistorymanager.c:308)
by 0x402BA8: test_ui_init_history (test_ui.c:132)
by 0x402C80: test_ui_purple_init (test_ui.c:167)
by 0x4027BB: main (test_contact.c:88)

4,368 bytes in 1 blocks are possibly lost in loss record 3,454 of 3,457
at 0x484386F: malloc (vg_replace_malloc.c:393)
by 0x5235B67: sqlite3MemMalloc.lto_priv.0 (sqlite3.c:25493)
by 0x5232797: UnknownInlinedFun (sqlite3.c:29181)
by 0x5232797: UnknownInlinedFun (sqlite3.c:29227)
by 0x5232797: sqlite3Malloc.lto_priv.0 (sqlite3.c:29221)
by 0x523BD8B: pcache1Alloc.lto_priv.0 (sqlite3.c:53546)
by 0x5240077: UnknownInlinedFun (sqlite3.c:53634)
by 0x5240077: pcache1FetchStage2 (sqlite3.c:54104)
by 0x5243E9C: UnknownInlinedFun (sqlite3.c:52671)
by 0x5243E9C: getPageNormal.lto_priv.0 (sqlite3.c:60628)
by 0x52499BC: UnknownInlinedFun (sqlite3.c:60805)
by 0x52499BC: UnknownInlinedFun (sqlite3.c:70289)
by 0x52499BC: btreeGetUnusedPage (sqlite3.c:70432)
by 0x524F504: allocateBtreePage.lto_priv.0 (sqlite3.c:74604)
by 0x5256209: btreeCreateTable.lto_priv.0 (sqlite3.c:77830)
by 0x5265EB2: UnknownInlinedFun (sqlite3.c:77849)
by 0x5265EB2: sqlite3VdbeExec.lto_priv.0 (sqlite3.c:96382)
by 0x525CBEE: UnknownInlinedFun (sqlite3.c:87995)
by 0x525CBEE: UnknownInlinedFun (sqlite3.c:88056)
by 0x525CBEE: sqlite3_step (sqlite3.c:88045)
by 0x529B324: sqlite3_exec (sqlite3.c:131002)
by 0x48FD558: purple_sqlite3_run_migration (purplesqlite3.c:37)
by 0x48FDBB4: purple_sqlite3_run_migrations_from_resources (purplesqlite3.c:195)
by 0x48FDED9: purple_sqlite_history_adapter_run_migrations (purplesqlitehistoryadapter.c:69)
by 0x48FE7F0: purple_sqlite_history_adapter_activate (purplesqlitehistoryadapter.c:287)
by 0x48DB656: purple_history_adapter_activate (purplehistoryadapter.c:181)
by 0x48DC9BC: purple_history_manager_set_active (purplehistorymanager.c:308)
by 0x402BA8: test_ui_init_history (test_ui.c:132)
by 0x402C80: test_ui_purple_init (test_ui.c:167)
by 0x4027BB: main (test_contact.c:88)
```

Testing Done:
Ran tests in valgrind, and all above leaks were gone except for noted `protocol_xfer` issues, and a bunch of leaks of the `PurpleBuddy`-`PurpleContact` compatibility bindings, which will go away in their entirety eventually.

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

20147
66f05a854eee applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents: 19859
diff changeset
1 /* pidgin
8713
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
2 *
15931
716b5fac1895 Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
3 * Pidgin is the legal property of its developers, whose names are too numerous
8713
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
4 * to list here. Please refer to the COPYRIGHT file distributed with this
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
5 * source distribution.
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
6 *
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
7 * This program is free software; you can redistribute it and/or modify
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
8 * it under the terms of the GNU General Public License as published by
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
9 * the Free Software Foundation; either version 2 of the License, or
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
10 * (at your option) any later version.
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
11 *
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful,
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
15 * GNU General Public License for more details.
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
16 *
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
17 * You should have received a copy of the GNU General Public License
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
18 * 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: 16254
diff changeset
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
8713
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
20 */
39227
291b3c800668 Move GtkPluginPref to use Talkatu instead of Webkit
Gary Kramlich <grim@reaperworld.com>
parents: 38007
diff changeset
21 #include <talkatu.h>
291b3c800668 Move GtkPluginPref to use Talkatu instead of Webkit
Gary Kramlich <grim@reaperworld.com>
parents: 38007
diff changeset
22
40360
e21f3bbcc2a5 Update all of the pidgin code to include purple.h
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
23 #include <purple.h>
8713
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
24
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
25 #include "gtkpluginpref.h"
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
26 #include "gtkutils.h"
40886
198bf5bc58ce Move Pidgin preferences code into a subdirectory.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40490
diff changeset
27 #include "pidginprefs.h"
8713
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
28
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
29 static gboolean
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
30 entry_cb(GtkWidget *entry, gpointer data) {
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
31 char *pref = data;
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
32
41531
2b86501d13fe Replace gtk_entry_[gs]et_text with gtk_editable_[gs]et_text
Gary Kramlich <grim@reaperworld.com>
parents: 40886
diff changeset
33 purple_prefs_set_string(pref, gtk_editable_get_text(GTK_EDITABLE(entry)));
8713
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
34
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
35 return FALSE;
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
36 }
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
37
12712
21ea46d3dee9 [gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11986
diff changeset
38
21ea46d3dee9 [gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11986
diff changeset
39 static void
41947
7b3312d0760c Bump C standard to C99 for Pidgin files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41629
diff changeset
40 multiline_cb(GtkTextBuffer *buffer, G_GNUC_UNUSED gpointer data) {
39227
291b3c800668 Move GtkPluginPref to use Talkatu instead of Webkit
Gary Kramlich <grim@reaperworld.com>
parents: 38007
diff changeset
41 gchar *pref = NULL, *text = NULL;
12712
21ea46d3dee9 [gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11986
diff changeset
42
39229
f2c79c2fc99f Correct a signal connection and comment out a broken one with a warning to fix it when talkatu has a solution for it
Gary Kramlich <grim@reaperworld.com>
parents: 39228
diff changeset
43 pref = g_object_get_data(G_OBJECT(buffer), "pref-key");
12712
21ea46d3dee9 [gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11986
diff changeset
44 g_return_if_fail(pref);
21ea46d3dee9 [gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11986
diff changeset
45
39227
291b3c800668 Move GtkPluginPref to use Talkatu instead of Webkit
Gary Kramlich <grim@reaperworld.com>
parents: 38007
diff changeset
46 text = talkatu_markup_get_html(buffer, NULL);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15882
diff changeset
47 purple_prefs_set_string(pref, text);
12712
21ea46d3dee9 [gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11986
diff changeset
48 g_free(text);
21ea46d3dee9 [gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11986
diff changeset
49 }
21ea46d3dee9 [gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11986
diff changeset
50
8713
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
51 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15882
diff changeset
52 make_string_pref(GtkWidget *parent, PurplePluginPref *pref, GtkSizeGroup *sg) {
13107
704041197f4d [gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents: 12794
diff changeset
53 GtkWidget *box, *gtk_label, *entry;
704041197f4d [gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents: 12794
diff changeset
54 const gchar *pref_name;
704041197f4d [gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents: 12794
diff changeset
55 const gchar *pref_label;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15882
diff changeset
56 PurpleStringFormatType format;
8713
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
57
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15882
diff changeset
58 pref_name = purple_plugin_pref_get_name(pref);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15882
diff changeset
59 pref_label = purple_plugin_pref_get_label(pref);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15882
diff changeset
60 format = purple_plugin_pref_get_format_type(pref);
8713
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
61
35378
5d9e2581005b gtk-doc prep: *_get_type() functions are hidden as standard GType-returning funcs, so rename them.
Ankit Vani <a@nevitus.org>
parents: 34274
diff changeset
62 switch(purple_plugin_pref_get_pref_type(pref)) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15882
diff changeset
63 case PURPLE_PLUGIN_PREF_CHOICE:
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
64 gtk_label = pidgin_prefs_dropdown_from_list(parent, pref_label,
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15882
diff changeset
65 PURPLE_PREF_STRING, pref_name,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15882
diff changeset
66 purple_plugin_pref_get_choices(pref));
38007
3b971d2ecae1 Simplify gtk_label_set_[xy]align calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37990
diff changeset
67 gtk_label_set_xalign(GTK_LABEL(gtk_label), 0);
8713
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
68
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
69 if(sg)
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
70 gtk_size_group_add_widget(sg, gtk_label);
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
71
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
72 break;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15882
diff changeset
73 case PURPLE_PLUGIN_PREF_NONE:
8713
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
74 default:
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15882
diff changeset
75 if (format == PURPLE_STRING_FORMAT_TYPE_NONE)
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 25457
diff changeset
76 {
12712
21ea46d3dee9 [gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11986
diff changeset
77 entry = gtk_entry_new();
41531
2b86501d13fe Replace gtk_entry_[gs]et_text with gtk_editable_[gs]et_text
Gary Kramlich <grim@reaperworld.com>
parents: 40886
diff changeset
78 gtk_editable_set_text(GTK_EDITABLE(entry), purple_prefs_get_string(pref_name));
12712
21ea46d3dee9 [gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11986
diff changeset
79 gtk_entry_set_max_length(GTK_ENTRY(entry),
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15882
diff changeset
80 purple_plugin_pref_get_max_length(pref));
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15882
diff changeset
81 if (purple_plugin_pref_get_masked(pref))
12712
21ea46d3dee9 [gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11986
diff changeset
82 {
21ea46d3dee9 [gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11986
diff changeset
83 gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE);
21ea46d3dee9 [gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11986
diff changeset
84 }
21ea46d3dee9 [gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11986
diff changeset
85 g_signal_connect(G_OBJECT(entry), "changed",
21ea46d3dee9 [gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11986
diff changeset
86 G_CALLBACK(entry_cb),
21ea46d3dee9 [gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11986
diff changeset
87 (gpointer)pref_name);
22139
f0f4a10114ea An additional push from Gabriel's omgp.pidgin.add-widget-util branch.
Ethan Blanton <elb@pidgin.im>
parents: 20289
diff changeset
88 pidgin_add_widget_to_vbox(GTK_BOX(parent), pref_label, sg, entry, TRUE, NULL);
12712
21ea46d3dee9 [gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11986
diff changeset
89 }
21ea46d3dee9 [gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11986
diff changeset
90 else
11986
21d2ab6421a7 [gaim-migrate @ 14279]
Mark Doliner <markdoliner@pidgin.im>
parents: 11243
diff changeset
91 {
13107
704041197f4d [gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents: 12794
diff changeset
92 GtkWidget *hbox;
704041197f4d [gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents: 12794
diff changeset
93 GtkWidget *spacer;
39227
291b3c800668 Move GtkPluginPref to use Talkatu instead of Webkit
Gary Kramlich <grim@reaperworld.com>
parents: 38007
diff changeset
94 GtkWidget *editor;
40484
7df95db772d8 Update a a few things that were changed in talkatu
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
95 GtkWidget *input;
39227
291b3c800668 Move GtkPluginPref to use Talkatu instead of Webkit
Gary Kramlich <grim@reaperworld.com>
parents: 38007
diff changeset
96 GtkTextBuffer *buffer;
42094
2707c81648a0 Update to talkatu 0.2.0
Gary Kramlich <grim@reaperworld.com>
parents: 41947
diff changeset
97 GSimpleActionGroup *ag = NULL;
13107
704041197f4d [gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents: 12794
diff changeset
98
40490
fb6e46c4c63c Remove PIDGIN_HIG_* constants
Gary Kramlich <grim@reaperworld.com>
parents: 40484
diff changeset
99 box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 6);
22139
f0f4a10114ea An additional push from Gabriel's omgp.pidgin.add-widget-util branch.
Ethan Blanton <elb@pidgin.im>
parents: 20289
diff changeset
100
f0f4a10114ea An additional push from Gabriel's omgp.pidgin.add-widget-util branch.
Ethan Blanton <elb@pidgin.im>
parents: 20289
diff changeset
101 gtk_widget_show(box);
41533
bca738fd139b Convert PidginPluginPref to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41531
diff changeset
102 gtk_box_append(GTK_BOX(parent), box);
22139
f0f4a10114ea An additional push from Gabriel's omgp.pidgin.add-widget-util branch.
Ethan Blanton <elb@pidgin.im>
parents: 20289
diff changeset
103
f0f4a10114ea An additional push from Gabriel's omgp.pidgin.add-widget-util branch.
Ethan Blanton <elb@pidgin.im>
parents: 20289
diff changeset
104 gtk_label = gtk_label_new_with_mnemonic(pref_label);
38007
3b971d2ecae1 Simplify gtk_label_set_[xy]align calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37990
diff changeset
105 gtk_label_set_xalign(GTK_LABEL(gtk_label), 0);
22139
f0f4a10114ea An additional push from Gabriel's omgp.pidgin.add-widget-util branch.
Ethan Blanton <elb@pidgin.im>
parents: 20289
diff changeset
106 gtk_widget_show(gtk_label);
41533
bca738fd139b Convert PidginPluginPref to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41531
diff changeset
107 gtk_box_append(GTK_BOX(box), gtk_label);
22139
f0f4a10114ea An additional push from Gabriel's omgp.pidgin.add-widget-util branch.
Ethan Blanton <elb@pidgin.im>
parents: 20289
diff changeset
108
f0f4a10114ea An additional push from Gabriel's omgp.pidgin.add-widget-util branch.
Ethan Blanton <elb@pidgin.im>
parents: 20289
diff changeset
109 if(sg)
f0f4a10114ea An additional push from Gabriel's omgp.pidgin.add-widget-util branch.
Ethan Blanton <elb@pidgin.im>
parents: 20289
diff changeset
110 gtk_size_group_add_widget(sg, gtk_label);
f0f4a10114ea An additional push from Gabriel's omgp.pidgin.add-widget-util branch.
Ethan Blanton <elb@pidgin.im>
parents: 20289
diff changeset
111
40490
fb6e46c4c63c Remove PIDGIN_HIG_* constants
Gary Kramlich <grim@reaperworld.com>
parents: 40484
diff changeset
112 hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6);
41533
bca738fd139b Convert PidginPluginPref to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41531
diff changeset
113 gtk_box_append(GTK_BOX(box), hbox);
13107
704041197f4d [gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents: 12794
diff changeset
114 gtk_widget_show(hbox);
704041197f4d [gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents: 12794
diff changeset
115
704041197f4d [gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents: 12794
diff changeset
116 spacer = gtk_label_new(" ");
41533
bca738fd139b Convert PidginPluginPref to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41531
diff changeset
117 gtk_box_append(GTK_BOX(hbox), spacer);
13107
704041197f4d [gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents: 12794
diff changeset
118 gtk_widget_show(spacer);
12712
21ea46d3dee9 [gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11986
diff changeset
119
39227
291b3c800668 Move GtkPluginPref to use Talkatu instead of Webkit
Gary Kramlich <grim@reaperworld.com>
parents: 38007
diff changeset
120 editor = talkatu_editor_new();
40484
7df95db772d8 Update a a few things that were changed in talkatu
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
121 input = talkatu_editor_get_input(TALKATU_EDITOR(editor));
39227
291b3c800668 Move GtkPluginPref to use Talkatu instead of Webkit
Gary Kramlich <grim@reaperworld.com>
parents: 38007
diff changeset
122
34274
9169710b5af5 Hide GtkWebViewToolbar stuff within the GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33683
diff changeset
123 if ((format & PURPLE_STRING_FORMAT_TYPE_HTML) != 0) {
42094
2707c81648a0 Update to talkatu 0.2.0
Gary Kramlich <grim@reaperworld.com>
parents: 41947
diff changeset
124 ag = talkatu_action_group_new(TALKATU_FORMAT_HTML);
33252
abcaf61b570d Disable formatting if the pluginpref doesn't allow HTML.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33199
diff changeset
125 }
12712
21ea46d3dee9 [gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11986
diff changeset
126
42094
2707c81648a0 Update to talkatu 0.2.0
Gary Kramlich <grim@reaperworld.com>
parents: 41947
diff changeset
127 buffer = talkatu_buffer_new(ag);
2707c81648a0 Update to talkatu 0.2.0
Gary Kramlich <grim@reaperworld.com>
parents: 41947
diff changeset
128 if(TALKATU_IS_ACTION_GROUP(ag)) {
2707c81648a0 Update to talkatu 0.2.0
Gary Kramlich <grim@reaperworld.com>
parents: 41947
diff changeset
129 talkatu_action_group_set_buffer(TALKATU_ACTION_GROUP(ag),
2707c81648a0 Update to talkatu 0.2.0
Gary Kramlich <grim@reaperworld.com>
parents: 41947
diff changeset
130 buffer);
2707c81648a0 Update to talkatu 0.2.0
Gary Kramlich <grim@reaperworld.com>
parents: 41947
diff changeset
131 }
2707c81648a0 Update to talkatu 0.2.0
Gary Kramlich <grim@reaperworld.com>
parents: 41947
diff changeset
132 g_clear_object(&ag);
2707c81648a0 Update to talkatu 0.2.0
Gary Kramlich <grim@reaperworld.com>
parents: 41947
diff changeset
133
40484
7df95db772d8 Update a a few things that were changed in talkatu
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
134 gtk_text_view_set_buffer(GTK_TEXT_VIEW(input), buffer);
39227
291b3c800668 Move GtkPluginPref to use Talkatu instead of Webkit
Gary Kramlich <grim@reaperworld.com>
parents: 38007
diff changeset
135
33199
e82a9f0fa7ec Convert plugin prefs to GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33170
diff changeset
136 if (format & PURPLE_STRING_FORMAT_TYPE_MULTILINE) {
e82a9f0fa7ec Convert plugin prefs to GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33170
diff changeset
137 gchar *tmp = purple_strreplace(purple_prefs_get_string(pref_name), "\n", "<br>");
39227
291b3c800668 Move GtkPluginPref to use Talkatu instead of Webkit
Gary Kramlich <grim@reaperworld.com>
parents: 38007
diff changeset
138 talkatu_markup_set_html(TALKATU_BUFFER(buffer), tmp, -1);
33199
e82a9f0fa7ec Convert plugin prefs to GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33170
diff changeset
139 g_free(tmp);
39227
291b3c800668 Move GtkPluginPref to use Talkatu instead of Webkit
Gary Kramlich <grim@reaperworld.com>
parents: 38007
diff changeset
140 } else {
291b3c800668 Move GtkPluginPref to use Talkatu instead of Webkit
Gary Kramlich <grim@reaperworld.com>
parents: 38007
diff changeset
141 talkatu_markup_set_html(TALKATU_BUFFER(buffer), purple_prefs_get_string(pref_name), -1);
291b3c800668 Move GtkPluginPref to use Talkatu instead of Webkit
Gary Kramlich <grim@reaperworld.com>
parents: 38007
diff changeset
142 }
291b3c800668 Move GtkPluginPref to use Talkatu instead of Webkit
Gary Kramlich <grim@reaperworld.com>
parents: 38007
diff changeset
143
40484
7df95db772d8 Update a a few things that were changed in talkatu
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
144 gtk_label_set_mnemonic_widget(GTK_LABEL(gtk_label), input);
39229
f2c79c2fc99f Correct a signal connection and comment out a broken one with a warning to fix it when talkatu has a solution for it
Gary Kramlich <grim@reaperworld.com>
parents: 39228
diff changeset
145 g_object_set_data(G_OBJECT(buffer), "pref-key", (gpointer)pref_name);
f2c79c2fc99f Correct a signal connection and comment out a broken one with a warning to fix it when talkatu has a solution for it
Gary Kramlich <grim@reaperworld.com>
parents: 39228
diff changeset
146 g_signal_connect(G_OBJECT(buffer), "changed",
39227
291b3c800668 Move GtkPluginPref to use Talkatu instead of Webkit
Gary Kramlich <grim@reaperworld.com>
parents: 38007
diff changeset
147 G_CALLBACK(multiline_cb), NULL);
39229
f2c79c2fc99f Correct a signal connection and comment out a broken one with a warning to fix it when talkatu has a solution for it
Gary Kramlich <grim@reaperworld.com>
parents: 39228
diff changeset
148 #warning fix this when talkatu has a solution
f2c79c2fc99f Correct a signal connection and comment out a broken one with a warning to fix it when talkatu has a solution for it
Gary Kramlich <grim@reaperworld.com>
parents: 39228
diff changeset
149 /*
39227
291b3c800668 Move GtkPluginPref to use Talkatu instead of Webkit
Gary Kramlich <grim@reaperworld.com>
parents: 38007
diff changeset
150 g_signal_connect(G_OBJECT(view), "format-toggled",
291b3c800668 Move GtkPluginPref to use Talkatu instead of Webkit
Gary Kramlich <grim@reaperworld.com>
parents: 38007
diff changeset
151 G_CALLBACK(multiline_cb), NULL);
39229
f2c79c2fc99f Correct a signal connection and comment out a broken one with a warning to fix it when talkatu has a solution for it
Gary Kramlich <grim@reaperworld.com>
parents: 39228
diff changeset
152 */
41533
bca738fd139b Convert PidginPluginPref to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41531
diff changeset
153 gtk_box_append(GTK_BOX(hbox), editor);
bca738fd139b Convert PidginPluginPref to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41531
diff changeset
154 gtk_widget_set_hexpand(editor, TRUE);
11986
21d2ab6421a7 [gaim-migrate @ 14279]
Mark Doliner <markdoliner@pidgin.im>
parents: 11243
diff changeset
155 }
8713
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
156
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
157 break;
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
158 }
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
159 }
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
160
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
161 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15882
diff changeset
162 make_int_pref(GtkWidget *parent, PurplePluginPref *pref, GtkSizeGroup *sg) {
8713
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
163 GtkWidget *gtk_label;
13107
704041197f4d [gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents: 12794
diff changeset
164 const gchar *pref_name;
704041197f4d [gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents: 12794
diff changeset
165 const gchar *pref_label;
8713
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
166 gint max, min;
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
167
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15882
diff changeset
168 pref_name = purple_plugin_pref_get_name(pref);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15882
diff changeset
169 pref_label = purple_plugin_pref_get_label(pref);
8713
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
170
35378
5d9e2581005b gtk-doc prep: *_get_type() functions are hidden as standard GType-returning funcs, so rename them.
Ankit Vani <a@nevitus.org>
parents: 34274
diff changeset
171 switch(purple_plugin_pref_get_pref_type(pref)) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15882
diff changeset
172 case PURPLE_PLUGIN_PREF_CHOICE:
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
173 gtk_label = pidgin_prefs_dropdown_from_list(parent, pref_label,
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15882
diff changeset
174 PURPLE_PREF_INT, pref_name, purple_plugin_pref_get_choices(pref));
38007
3b971d2ecae1 Simplify gtk_label_set_[xy]align calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37990
diff changeset
175 gtk_label_set_xalign(GTK_LABEL(gtk_label), 0);
8713
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
176
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
177 if(sg)
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
178 gtk_size_group_add_widget(sg, gtk_label);
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
179
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
180 break;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15882
diff changeset
181 case PURPLE_PLUGIN_PREF_NONE:
8713
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
182 default:
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15882
diff changeset
183 purple_plugin_pref_get_bounds(pref, &min, &max);
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
184 pidgin_prefs_labeled_spin_button(parent, pref_label,
9529
377b70382202 [gaim-migrate @ 10356]
Christopher O'Brien <siege@pidgin.im>
parents: 8713
diff changeset
185 pref_name, min, max, sg);
8713
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
186 break;
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
187 }
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
188 }
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
189
9529
377b70382202 [gaim-migrate @ 10356]
Christopher O'Brien <siege@pidgin.im>
parents: 8713
diff changeset
190
377b70382202 [gaim-migrate @ 10356]
Christopher O'Brien <siege@pidgin.im>
parents: 8713
diff changeset
191 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15882
diff changeset
192 make_info_pref(GtkWidget *parent, PurplePluginPref *pref) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15882
diff changeset
193 GtkWidget *gtk_label = gtk_label_new(purple_plugin_pref_get_label(pref));
38007
3b971d2ecae1 Simplify gtk_label_set_[xy]align calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37990
diff changeset
194 gtk_label_set_xalign(GTK_LABEL(gtk_label), 0);
3b971d2ecae1 Simplify gtk_label_set_[xy]align calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37990
diff changeset
195 gtk_label_set_yalign(GTK_LABEL(gtk_label), 0);
41533
bca738fd139b Convert PidginPluginPref to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41531
diff changeset
196 gtk_label_set_wrap(GTK_LABEL(gtk_label), TRUE);
bca738fd139b Convert PidginPluginPref to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41531
diff changeset
197 gtk_box_append(GTK_BOX(parent), gtk_label);
9529
377b70382202 [gaim-migrate @ 10356]
Christopher O'Brien <siege@pidgin.im>
parents: 8713
diff changeset
198 gtk_widget_show(gtk_label);
377b70382202 [gaim-migrate @ 10356]
Christopher O'Brien <siege@pidgin.im>
parents: 8713
diff changeset
199 }
377b70382202 [gaim-migrate @ 10356]
Christopher O'Brien <siege@pidgin.im>
parents: 8713
diff changeset
200
377b70382202 [gaim-migrate @ 10356]
Christopher O'Brien <siege@pidgin.im>
parents: 8713
diff changeset
201
8713
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
202 GtkWidget *
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15882
diff changeset
203 pidgin_plugin_pref_create_frame(PurplePluginPrefFrame *frame) {
8713
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
204 GtkWidget *ret, *parent;
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
205 GtkSizeGroup *sg;
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
206 GList *pp;
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
207
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
208 g_return_val_if_fail(frame, NULL);
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
209
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
210 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
211
35527
707c3c2b2c8a Fix more gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35500
diff changeset
212 parent = ret = gtk_box_new(GTK_ORIENTATION_VERTICAL, 16);
8713
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
213 gtk_widget_show(ret);
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
214
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15882
diff changeset
215 for(pp = purple_plugin_pref_frame_get_prefs(frame);
8713
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
216 pp != NULL;
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
217 pp = pp->next)
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
218 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15882
diff changeset
219 PurplePluginPref *pref = (PurplePluginPref *)pp->data;
8713
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
220
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15882
diff changeset
221 const char *name = purple_plugin_pref_get_name(pref);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15882
diff changeset
222 const char *label = purple_plugin_pref_get_label(pref);
8713
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
223
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
224 if(name == NULL) {
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
225 if(label == NULL)
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
226 continue;
9529
377b70382202 [gaim-migrate @ 10356]
Christopher O'Brien <siege@pidgin.im>
parents: 8713
diff changeset
227
35378
5d9e2581005b gtk-doc prep: *_get_type() functions are hidden as standard GType-returning funcs, so rename them.
Ankit Vani <a@nevitus.org>
parents: 34274
diff changeset
228 if(purple_plugin_pref_get_pref_type(pref) == PURPLE_PLUGIN_PREF_INFO) {
9529
377b70382202 [gaim-migrate @ 10356]
Christopher O'Brien <siege@pidgin.im>
parents: 8713
diff changeset
229 make_info_pref(parent, pref);
377b70382202 [gaim-migrate @ 10356]
Christopher O'Brien <siege@pidgin.im>
parents: 8713
diff changeset
230 } else {
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
231 parent = pidgin_make_frame(ret, label);
9529
377b70382202 [gaim-migrate @ 10356]
Christopher O'Brien <siege@pidgin.im>
parents: 8713
diff changeset
232 gtk_widget_show(parent);
377b70382202 [gaim-migrate @ 10356]
Christopher O'Brien <siege@pidgin.im>
parents: 8713
diff changeset
233 }
8713
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
234
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
235 continue;
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
236 }
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
237
35378
5d9e2581005b gtk-doc prep: *_get_type() functions are hidden as standard GType-returning funcs, so rename them.
Ankit Vani <a@nevitus.org>
parents: 34274
diff changeset
238 switch(purple_prefs_get_pref_type(name)) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15882
diff changeset
239 case PURPLE_PREF_BOOLEAN:
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
240 pidgin_prefs_checkbox(label, name, parent);
8713
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
241 break;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15882
diff changeset
242 case PURPLE_PREF_INT:
8713
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
243 make_int_pref(parent, pref, sg);
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
244 break;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15882
diff changeset
245 case PURPLE_PREF_STRING:
8713
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
246 make_string_pref(parent, pref, sg);
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
247 break;
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
248 default:
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
249 break;
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
250 }
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
251 }
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
252
20289
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20147
diff changeset
253 g_object_unref(sg);
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20147
diff changeset
254
8713
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
255 return ret;
8a7baa8f8460 [gaim-migrate @ 9467]
Gary Kramlich <grim@pidgin.im>
parents:
diff changeset
256 }

mercurial