pidgin/gtksavedstatuses.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 41947
7b3312d0760c
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/

20330
650a7af9c238 remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@pidgin.im>
parents: 19859
diff changeset
1 /* pidgin
10418
7b632343a29c [gaim-migrate @ 11669]
Mark Doliner <markdoliner@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
10418
7b632343a29c [gaim-migrate @ 11669]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
4 * to list here. Please refer to the COPYRIGHT file distributed with this
7b632343a29c [gaim-migrate @ 11669]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
5 * source distribution.
7b632343a29c [gaim-migrate @ 11669]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
6 *
7b632343a29c [gaim-migrate @ 11669]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
7 * This program is free software; you can redistribute it and/or modify
7b632343a29c [gaim-migrate @ 11669]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
8 * it under the terms of the GNU General Public License as published by
7b632343a29c [gaim-migrate @ 11669]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
9 * the Free Software Foundation; either version 2 of the License, or
7b632343a29c [gaim-migrate @ 11669]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
10 * (at your option) any later version.
7b632343a29c [gaim-migrate @ 11669]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
11 *
7b632343a29c [gaim-migrate @ 11669]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful,
7b632343a29c [gaim-migrate @ 11669]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
7b632343a29c [gaim-migrate @ 11669]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7b632343a29c [gaim-migrate @ 11669]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
15 * GNU General Public License for more details.
7b632343a29c [gaim-migrate @ 11669]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
16 *
7b632343a29c [gaim-migrate @ 11669]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
17 * You should have received a copy of the GNU General Public License
7b632343a29c [gaim-migrate @ 11669]
Mark Doliner <markdoliner@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: 19570
diff changeset
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
10418
7b632343a29c [gaim-migrate @ 11669]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
20 */
7b632343a29c [gaim-migrate @ 11669]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
21
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
22 #include <glib/gi18n-lib.h>
39225
a3f3275250a4 Move GtkSavedStatus to Talkatu
Gary Kramlich <grim@reaperworld.com>
parents: 38583
diff changeset
23
41416
253e831b0a1e Remove the manager, editor, and substatus editor from gtksavedstatuses
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
24 #include <gtk/gtk.h>
18273
e61c53184c52 #include reorganizations to allow compiling with glib < 2.8 using the
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 18261
diff changeset
25
40360
e21f3bbcc2a5 Update all of the pidgin code to include purple.h
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
26 #include <purple.h>
10418
7b632343a29c [gaim-migrate @ 11669]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
27
7b632343a29c [gaim-migrate @ 11669]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
28 #include "gtksavedstatuses.h"
41095
c2471cdf5a4e Replace pidgin_stock_id_from_status_primitive by pidgin_icon_name_from_status_primitive
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41087
diff changeset
29 #include "pidginiconname.h"
10418
7b632343a29c [gaim-migrate @ 11669]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
30
14739
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
31 enum {
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
32 SS_MENU_ENTRY_TYPE_PRIMITIVE,
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
33 SS_MENU_ENTRY_TYPE_SAVEDSTATUS
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
34 };
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
35
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
36 enum {
35455
216a37403c5b Fix a bunch of gtk-doc warnings in pidgin
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
37 /* _SSMenuEntryType */
14739
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
38 SS_MENU_TYPE_COLUMN,
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
39
35455
216a37403c5b Fix a bunch of gtk-doc warnings in pidgin
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
40 /*
14739
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
41 * This is a GdkPixbuf (the other columns are strings).
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
42 * This column is visible.
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
43 */
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
44 SS_MENU_ICON_COLUMN,
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
45
35455
216a37403c5b Fix a bunch of gtk-doc warnings in pidgin
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
46 /* The text displayed on the status box. This column is visible. */
14739
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
47 SS_MENU_TEXT_COLUMN,
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
48
35455
216a37403c5b Fix a bunch of gtk-doc warnings in pidgin
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
49 /*
14739
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
50 * This value depends on SS_MENU_TYPE_COLUMN. For _SAVEDSTATUS types,
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
51 * this is the creation time. For _PRIMITIVE types,
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
52 * this is the PurpleStatusPrimitive.
14739
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
53 */
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
54 SS_MENU_DATA_COLUMN,
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
55
35455
216a37403c5b Fix a bunch of gtk-doc warnings in pidgin
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
56 /*
16482
a6621f3d0619 Use menu emblem for saved statuses in preferences also.
Sean Egan <seanegan@pidgin.im>
parents: 16254
diff changeset
57 * This is the emblem to use for this status
a6621f3d0619 Use menu emblem for saved statuses in preferences also.
Sean Egan <seanegan@pidgin.im>
parents: 16254
diff changeset
58 */
a6621f3d0619 Use menu emblem for saved statuses in preferences also.
Sean Egan <seanegan@pidgin.im>
parents: 16254
diff changeset
59 SS_MENU_EMBLEM_COLUMN,
a6621f3d0619 Use menu emblem for saved statuses in preferences also.
Sean Egan <seanegan@pidgin.im>
parents: 16254
diff changeset
60
35455
216a37403c5b Fix a bunch of gtk-doc warnings in pidgin
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
61 /*
16482
a6621f3d0619 Use menu emblem for saved statuses in preferences also.
Sean Egan <seanegan@pidgin.im>
parents: 16254
diff changeset
62 * And whether or not that emblem is visible
a6621f3d0619 Use menu emblem for saved statuses in preferences also.
Sean Egan <seanegan@pidgin.im>
parents: 16254
diff changeset
63 */
a6621f3d0619 Use menu emblem for saved statuses in preferences also.
Sean Egan <seanegan@pidgin.im>
parents: 16254
diff changeset
64 SS_MENU_EMBLEM_VISIBLE_COLUMN,
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 24816
diff changeset
65
14739
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
66 SS_MENU_NUM_COLUMNS
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
67 };
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
68
12246
7af1ef3b1cc4 [gaim-migrate @ 14548]
Mark Doliner <markdoliner@pidgin.im>
parents: 12238
diff changeset
69 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
70 status_menu_cb(GtkComboBox *widget, void(*callback)(PurpleSavedStatus*))
12195
ef8f46c29e77 [gaim-migrate @ 14497]
Sean Egan <seanegan@pidgin.im>
parents: 12173
diff changeset
71 {
12237
91cf841da813 [gaim-migrate @ 14539]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12199
diff changeset
72 GtkTreeIter iter;
14739
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
73 int type;
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
74 gpointer data;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
75 PurpleSavedStatus *status = NULL;
12237
91cf841da813 [gaim-migrate @ 14539]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12199
diff changeset
76
91cf841da813 [gaim-migrate @ 14539]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12199
diff changeset
77 if (!gtk_combo_box_get_active_iter(widget, &iter))
91cf841da813 [gaim-migrate @ 14539]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12199
diff changeset
78 return;
91cf841da813 [gaim-migrate @ 14539]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12199
diff changeset
79
91cf841da813 [gaim-migrate @ 14539]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12199
diff changeset
80 gtk_tree_model_get(gtk_combo_box_get_model(widget), &iter,
14739
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
81 SS_MENU_TYPE_COLUMN, &type,
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
82 SS_MENU_DATA_COLUMN, &data,
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
83 -1);
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
84
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
85 if (type == SS_MENU_ENTRY_TYPE_PRIMITIVE)
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
86 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
87 PurpleStatusPrimitive primitive = GPOINTER_TO_INT(data);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
88 status = purple_savedstatus_find_transient_by_type_and_message(primitive, NULL);
14739
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
89 if (status == NULL)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
90 status = purple_savedstatus_new(NULL, primitive);
14739
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
91 }
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
92 else if (type == SS_MENU_ENTRY_TYPE_SAVEDSTATUS)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
93 status = purple_savedstatus_find_by_creation_time(GPOINTER_TO_INT(data));
14739
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
94
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
95 callback(status);
12195
ef8f46c29e77 [gaim-migrate @ 14497]
Sean Egan <seanegan@pidgin.im>
parents: 12173
diff changeset
96 }
ef8f46c29e77 [gaim-migrate @ 14497]
Sean Egan <seanegan@pidgin.im>
parents: 12173
diff changeset
97
12817
d84b2c520f7d [gaim-migrate @ 15165]
Mark Doliner <markdoliner@pidgin.im>
parents: 12726
diff changeset
98 static gint
d84b2c520f7d [gaim-migrate @ 15165]
Mark Doliner <markdoliner@pidgin.im>
parents: 12726
diff changeset
99 saved_status_sort_alphabetically_func(gconstpointer a, gconstpointer b)
d84b2c520f7d [gaim-migrate @ 15165]
Mark Doliner <markdoliner@pidgin.im>
parents: 12726
diff changeset
100 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
101 const PurpleSavedStatus *saved_status_a = a;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
102 const PurpleSavedStatus *saved_status_b = b;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
103 return g_utf8_collate(purple_savedstatus_get_title(saved_status_a),
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
104 purple_savedstatus_get_title(saved_status_b));
12817
d84b2c520f7d [gaim-migrate @ 15165]
Mark Doliner <markdoliner@pidgin.im>
parents: 12726
diff changeset
105 }
d84b2c520f7d [gaim-migrate @ 15165]
Mark Doliner <markdoliner@pidgin.im>
parents: 12726
diff changeset
106
41947
7b3312d0760c Bump C standard to C99 for Pidgin files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41416
diff changeset
107 static gboolean
7b3312d0760c Bump C standard to C99 for Pidgin files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41416
diff changeset
108 pidgin_status_menu_add_primitive(GtkListStore *model,
7b3312d0760c Bump C standard to C99 for Pidgin files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41416
diff changeset
109 G_GNUC_UNUSED GtkWidget *w,
7b3312d0760c Bump C standard to C99 for Pidgin files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41416
diff changeset
110 PurpleStatusPrimitive primitive,
7b3312d0760c Bump C standard to C99 for Pidgin files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41416
diff changeset
111 PurpleSavedStatus *current_status)
14739
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
112 {
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
113 GtkTreeIter iter;
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
114 gboolean currently_selected = FALSE;
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
115
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
116 gtk_list_store_append(model, &iter);
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
117 gtk_list_store_set(model, &iter,
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
118 SS_MENU_TYPE_COLUMN, SS_MENU_ENTRY_TYPE_PRIMITIVE,
41095
c2471cdf5a4e Replace pidgin_stock_id_from_status_primitive by pidgin_icon_name_from_status_primitive
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41087
diff changeset
119 SS_MENU_ICON_COLUMN, pidgin_icon_name_from_status_primitive(primitive, NULL),
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
120 SS_MENU_TEXT_COLUMN, purple_primitive_get_name_from_type(primitive),
14739
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
121 SS_MENU_DATA_COLUMN, GINT_TO_POINTER(primitive),
16482
a6621f3d0619 Use menu emblem for saved statuses in preferences also.
Sean Egan <seanegan@pidgin.im>
parents: 16254
diff changeset
122 SS_MENU_EMBLEM_VISIBLE_COLUMN, FALSE,
14739
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
123 -1);
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
124
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
125 if (purple_savedstatus_is_transient(current_status)
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
126 && !purple_savedstatus_has_substatuses(current_status)
35378
5d9e2581005b gtk-doc prep: *_get_type() functions are hidden as standard GType-returning funcs, so rename them.
Ankit Vani <a@nevitus.org>
parents: 34955
diff changeset
127 && purple_savedstatus_get_primitive_type(current_status) == primitive)
14739
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
128 currently_selected = TRUE;
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
129
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
130 return currently_selected;
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
131 }
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
132
23401
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
133 static void
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
134 pidgin_status_menu_update_iter(GtkWidget *combobox, GtkListStore *store, GtkTreeIter *iter,
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
135 PurpleSavedStatus *status)
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
136 {
26846
d5546da39e44 Use stock-id in the status editor window too.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25900
diff changeset
137 PurpleStatusPrimitive primitive;
23401
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
138
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
139 if (store == NULL)
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
140 store = GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(combobox)));
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
141
35378
5d9e2581005b gtk-doc prep: *_get_type() functions are hidden as standard GType-returning funcs, so rename them.
Ankit Vani <a@nevitus.org>
parents: 34955
diff changeset
142 primitive = purple_savedstatus_get_primitive_type(status);
23401
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
143 gtk_list_store_set(store, iter,
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
144 SS_MENU_TYPE_COLUMN, SS_MENU_ENTRY_TYPE_SAVEDSTATUS,
41095
c2471cdf5a4e Replace pidgin_stock_id_from_status_primitive by pidgin_icon_name_from_status_primitive
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41087
diff changeset
145 SS_MENU_ICON_COLUMN, pidgin_icon_name_from_status_primitive(primitive, NULL),
23401
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
146 SS_MENU_TEXT_COLUMN, purple_savedstatus_get_title(status),
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
147 SS_MENU_DATA_COLUMN, GINT_TO_POINTER(purple_savedstatus_get_creation_time(status)),
41025
f8cb01c54b84 Remove the usage of Stock items from gtksavedstatues
Gary Kramlich <grim@reaperworld.com>
parents: 40704
diff changeset
148 SS_MENU_EMBLEM_COLUMN, "document-save",
23401
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
149 SS_MENU_EMBLEM_VISIBLE_COLUMN, TRUE,
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
150 -1);
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
151 }
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
152
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
153 static gboolean
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
154 pidgin_status_menu_find_iter(GtkListStore *store, GtkTreeIter *iter, PurpleSavedStatus *find)
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
155 {
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
156 int type;
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
157 gpointer data;
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
158 time_t creation_time = purple_savedstatus_get_creation_time(find);
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
159 GtkTreeModel *model = GTK_TREE_MODEL(store);
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
160
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
161 if (!gtk_tree_model_get_iter_first(model, iter))
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
162 return FALSE;
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
163
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
164 do {
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
165 gtk_tree_model_get(model, iter,
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
166 SS_MENU_TYPE_COLUMN, &type,
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
167 SS_MENU_DATA_COLUMN, &data,
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
168 -1);
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
169 if (type == SS_MENU_ENTRY_TYPE_PRIMITIVE)
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
170 continue;
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
171 if (GPOINTER_TO_INT(data) == creation_time)
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
172 return TRUE;
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
173 } while (gtk_tree_model_iter_next(model, iter));
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
174
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
175 return FALSE;
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
176 }
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
177
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
178 static void
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
179 savedstatus_added_cb(PurpleSavedStatus *status, GtkWidget *combobox)
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
180 {
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
181 GtkListStore *store;
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
182 GtkTreeIter iter;
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
183
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
184 if (purple_savedstatus_is_transient(status))
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
185 return;
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
186
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
187 store = GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(combobox)));
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
188 gtk_list_store_append(store, &iter);
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
189 pidgin_status_menu_update_iter(combobox, store, &iter, status);
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
190 }
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
191
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
192 static void
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
193 savedstatus_deleted_cb(PurpleSavedStatus *status, GtkWidget *combobox)
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
194 {
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
195 GtkListStore *store;
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
196 GtkTreeIter iter;
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
197
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
198 if (purple_savedstatus_is_transient(status))
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
199 return;
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
200
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
201 store = GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(combobox)));
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
202 if (pidgin_status_menu_find_iter(store, &iter, status))
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
203 gtk_list_store_remove(store, &iter);
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
204 }
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
205
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
206 static void
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
207 savedstatus_modified_cb(PurpleSavedStatus *status, GtkWidget *combobox)
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
208 {
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
209 GtkListStore *store;
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
210 GtkTreeIter iter;
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
211
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
212 if (purple_savedstatus_is_transient(status))
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
213 return;
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
214
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
215 store = GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(combobox)));
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
216 if (pidgin_status_menu_find_iter(store, &iter, status))
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
217 pidgin_status_menu_update_iter(combobox, store, &iter, status);
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
218 }
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
219
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
220 GtkWidget *pidgin_status_menu(PurpleSavedStatus *current_status, GCallback callback)
12195
ef8f46c29e77 [gaim-migrate @ 14497]
Sean Egan <seanegan@pidgin.im>
parents: 12173
diff changeset
221 {
ef8f46c29e77 [gaim-migrate @ 14497]
Sean Egan <seanegan@pidgin.im>
parents: 12173
diff changeset
222 GtkWidget *combobox;
14739
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
223 GtkListStore *model;
12817
d84b2c520f7d [gaim-migrate @ 15165]
Mark Doliner <markdoliner@pidgin.im>
parents: 12726
diff changeset
224 GList *sorted, *cur;
14739
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
225 int i = 0;
12195
ef8f46c29e77 [gaim-migrate @ 14497]
Sean Egan <seanegan@pidgin.im>
parents: 12173
diff changeset
226 int index = -1;
14739
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
227 GtkTreeIter iter;
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
228 GtkCellRenderer *text_rend;
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
229 GtkCellRenderer *icon_rend;
16482
a6621f3d0619 Use menu emblem for saved statuses in preferences also.
Sean Egan <seanegan@pidgin.im>
parents: 16254
diff changeset
230 GtkCellRenderer *emblem_rend;
12329
987036c6c7f9 [gaim-migrate @ 14633]
Mark Doliner <markdoliner@pidgin.im>
parents: 12246
diff changeset
231
26846
d5546da39e44 Use stock-id in the status editor window too.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25900
diff changeset
232 model = gtk_list_store_new(SS_MENU_NUM_COLUMNS, G_TYPE_INT, G_TYPE_STRING,
16482
a6621f3d0619 Use menu emblem for saved statuses in preferences also.
Sean Egan <seanegan@pidgin.im>
parents: 16254
diff changeset
233 G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_STRING, G_TYPE_BOOLEAN);
14739
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
234
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
235 combobox = gtk_combo_box_new();
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
236
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
237 if (pidgin_status_menu_add_primitive(model, combobox, PURPLE_STATUS_AVAILABLE, current_status))
14739
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
238 index = i;
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
239 i++;
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
240
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
241 if (pidgin_status_menu_add_primitive(model, combobox, PURPLE_STATUS_AWAY, current_status))
14739
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
242 index = i;
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
243 i++;
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
244
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
245 if (pidgin_status_menu_add_primitive(model, combobox, PURPLE_STATUS_INVISIBLE, current_status))
14739
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
246 index = i;
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
247 i++;
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
248
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
249 if (pidgin_status_menu_add_primitive(model, combobox, PURPLE_STATUS_OFFLINE, current_status))
14739
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
250 index = i;
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
251 i++;
12329
987036c6c7f9 [gaim-migrate @ 14633]
Mark Doliner <markdoliner@pidgin.im>
parents: 12246
diff changeset
252
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
253 sorted = g_list_copy((GList *)purple_savedstatuses_get_all());
12817
d84b2c520f7d [gaim-migrate @ 15165]
Mark Doliner <markdoliner@pidgin.im>
parents: 12726
diff changeset
254 sorted = g_list_sort(sorted, saved_status_sort_alphabetically_func);
14739
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
255 for (cur = sorted; cur; cur = cur->next)
12329
987036c6c7f9 [gaim-migrate @ 14633]
Mark Doliner <markdoliner@pidgin.im>
parents: 12246
diff changeset
256 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
257 PurpleSavedStatus *status = (PurpleSavedStatus *) cur->data;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
258 if (!purple_savedstatus_is_transient(status))
13179
e9e22c1cc839 [gaim-migrate @ 15541]
Mark Doliner <markdoliner@pidgin.im>
parents: 13177
diff changeset
259 {
14739
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
260 gtk_list_store_append(model, &iter);
23401
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
261
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
262 pidgin_status_menu_update_iter(combobox, model, &iter, status);
14739
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
263
12199
0cf90c70f0dc [gaim-migrate @ 14501]
Sean Egan <seanegan@pidgin.im>
parents: 12195
diff changeset
264 if (status == current_status)
0cf90c70f0dc [gaim-migrate @ 14501]
Sean Egan <seanegan@pidgin.im>
parents: 12195
diff changeset
265 index = i;
0cf90c70f0dc [gaim-migrate @ 14501]
Sean Egan <seanegan@pidgin.im>
parents: 12195
diff changeset
266 i++;
0cf90c70f0dc [gaim-migrate @ 14501]
Sean Egan <seanegan@pidgin.im>
parents: 12195
diff changeset
267 }
12195
ef8f46c29e77 [gaim-migrate @ 14497]
Sean Egan <seanegan@pidgin.im>
parents: 12173
diff changeset
268 }
12817
d84b2c520f7d [gaim-migrate @ 15165]
Mark Doliner <markdoliner@pidgin.im>
parents: 12726
diff changeset
269 g_list_free(sorted);
12246
7af1ef3b1cc4 [gaim-migrate @ 14548]
Mark Doliner <markdoliner@pidgin.im>
parents: 12238
diff changeset
270
14739
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
271 gtk_combo_box_set_model(GTK_COMBO_BOX(combobox), GTK_TREE_MODEL(model));
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
272
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
273 text_rend = gtk_cell_renderer_text_new();
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
274 icon_rend = gtk_cell_renderer_pixbuf_new();
16482
a6621f3d0619 Use menu emblem for saved statuses in preferences also.
Sean Egan <seanegan@pidgin.im>
parents: 16254
diff changeset
275 emblem_rend = gtk_cell_renderer_pixbuf_new();
14739
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
276 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combobox), icon_rend, FALSE);
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
277 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combobox), text_rend, TRUE);
16482
a6621f3d0619 Use menu emblem for saved statuses in preferences also.
Sean Egan <seanegan@pidgin.im>
parents: 16254
diff changeset
278 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combobox), emblem_rend, FALSE);
41095
c2471cdf5a4e Replace pidgin_stock_id_from_status_primitive by pidgin_icon_name_from_status_primitive
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41087
diff changeset
279 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combobox), icon_rend, "icon-name", SS_MENU_ICON_COLUMN, NULL);
14739
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
280 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combobox), text_rend, "markup", SS_MENU_TEXT_COLUMN, NULL);
16482
a6621f3d0619 Use menu emblem for saved statuses in preferences also.
Sean Egan <seanegan@pidgin.im>
parents: 16254
diff changeset
281 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combobox), emblem_rend,
41025
f8cb01c54b84 Remove the usage of Stock items from gtksavedstatues
Gary Kramlich <grim@reaperworld.com>
parents: 40704
diff changeset
282 "icon-name", SS_MENU_EMBLEM_COLUMN, "visible", SS_MENU_EMBLEM_VISIBLE_COLUMN, NULL);
28931
79e72b4741a2 Allow ellipsizing on the status menus in the preference window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27005
diff changeset
283 g_object_set(text_rend, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
14739
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
284
12195
ef8f46c29e77 [gaim-migrate @ 14497]
Sean Egan <seanegan@pidgin.im>
parents: 12173
diff changeset
285 gtk_combo_box_set_active(GTK_COMBO_BOX(combobox), index);
ef8f46c29e77 [gaim-migrate @ 14497]
Sean Egan <seanegan@pidgin.im>
parents: 12173
diff changeset
286 g_signal_connect(G_OBJECT(combobox), "changed", G_CALLBACK(status_menu_cb), callback);
12329
987036c6c7f9 [gaim-migrate @ 14633]
Mark Doliner <markdoliner@pidgin.im>
parents: 12246
diff changeset
287
23401
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
288 /* Make sure the list is updated dynamically when a substatus is changed/deleted
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
289 * or a new one is added. */
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
290 purple_signal_connect(purple_savedstatuses_get_handle(), "savedstatus-added",
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
291 combobox, G_CALLBACK(savedstatus_added_cb), combobox);
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
292 purple_signal_connect(purple_savedstatuses_get_handle(), "savedstatus-deleted",
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
293 combobox, G_CALLBACK(savedstatus_deleted_cb), combobox);
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
294 purple_signal_connect(purple_savedstatuses_get_handle(), "savedstatus-modified",
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
295 combobox, G_CALLBACK(savedstatus_modified_cb), combobox);
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
296 g_signal_connect(G_OBJECT(combobox), "destroy",
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
297 G_CALLBACK(purple_signals_disconnect_by_handle), NULL);
9aafdbc03ac0 Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
298
12195
ef8f46c29e77 [gaim-migrate @ 14497]
Sean Egan <seanegan@pidgin.im>
parents: 12173
diff changeset
299 return combobox;
ef8f46c29e77 [gaim-migrate @ 14497]
Sean Egan <seanegan@pidgin.im>
parents: 12173
diff changeset
300 }

mercurial