Thu, 23 Mar 2023 23:11:59 -0500
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/
|
40601
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1 | /* |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
2 | * Pidgin - Internet Messenger |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
3 | * Copyright (C) Pidgin Developers <devel@pidgin.im> |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
4 | * |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
5 | * Pidgin is the legal property of its developers, whose names are too numerous |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
6 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
7 | * source distribution. |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
8 | * |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
9 | * This program is free software; you can redistribute it and/or modify |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
10 | * it under the terms of the GNU General Public License as published by |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
11 | * the Free Software Foundation; either version 2 of the License, or |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
12 | * (at your option) any later version. |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
13 | * |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
14 | * This program is distributed in the hope that it will be useful, |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
17 | * GNU General Public License for more details. |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
18 | * |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
19 | * You should have received a copy of the GNU General Public License |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
20 | * along with this program; if not, see <https://www.gnu.org/licenses/>. |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
21 | */ |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
22 | |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
23 | #include "pidgin/pidginpresenceicon.h" |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
24 | |
|
41027
aa0e688f2f46
Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
40652
diff
changeset
|
25 | #include "pidgin/pidginiconname.h" |
|
40652
0006f8158d6e
Extract pidgin_presence_get_icon_name from PidginPresenceIcon so others can use it.
Gary Kramlich <grim@reaperworld.com>
parents:
40604
diff
changeset
|
26 | |
|
40601
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
27 | struct _PidginPresenceIcon { |
|
41355
cb48a8dd1bfc
Re-subclass PidginPresenceIcon onto GtkBox as GtkImage is final in Gtk4
Gary Kramlich <grim@reaperworld.com>
parents:
41027
diff
changeset
|
28 | GtkBox parent; |
|
cb48a8dd1bfc
Re-subclass PidginPresenceIcon onto GtkBox as GtkImage is final in Gtk4
Gary Kramlich <grim@reaperworld.com>
parents:
41027
diff
changeset
|
29 | |
|
cb48a8dd1bfc
Re-subclass PidginPresenceIcon onto GtkBox as GtkImage is final in Gtk4
Gary Kramlich <grim@reaperworld.com>
parents:
41027
diff
changeset
|
30 | GtkWidget *icon; |
|
40601
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
31 | |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
32 | PurplePresence *presence; |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
33 | gchar *fallback; |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
34 | }; |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
35 | |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
36 | enum { |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
37 | PROP_0, |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
38 | PROP_PRESENCE, |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
39 | PROP_FALLBACK, |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
40 | PROP_ICON_SIZE, |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
41 | N_PROPERTIES |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
42 | }; |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
43 | static GParamSpec *properties[N_PROPERTIES] = { NULL, }; |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
44 | |
|
41355
cb48a8dd1bfc
Re-subclass PidginPresenceIcon onto GtkBox as GtkImage is final in Gtk4
Gary Kramlich <grim@reaperworld.com>
parents:
41027
diff
changeset
|
45 | G_DEFINE_TYPE(PidginPresenceIcon, pidgin_presence_icon, GTK_TYPE_BOX) |
|
40601
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
46 | |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
47 | /****************************************************************************** |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
48 | * Implementation |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
49 | *****************************************************************************/ |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
50 | static void |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
51 | pidgin_presence_icon_update(PidginPresenceIcon *icon) { |
|
40652
0006f8158d6e
Extract pidgin_presence_get_icon_name from PidginPresenceIcon so others can use it.
Gary Kramlich <grim@reaperworld.com>
parents:
40604
diff
changeset
|
52 | const gchar *icon_name = NULL; |
|
40601
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
53 | |
|
41027
aa0e688f2f46
Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
40652
diff
changeset
|
54 | icon_name = pidgin_icon_name_from_presence(icon->presence, icon->fallback); |
|
40601
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
55 | |
|
41545
b02de51a738e
Update PidginPresenceIcon for GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41479
diff
changeset
|
56 | gtk_image_set_from_icon_name(GTK_IMAGE(icon->icon), icon_name); |
|
40601
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
57 | } |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
58 | |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
59 | static void |
|
41947
7b3312d0760c
Bump C standard to C99 for Pidgin files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41545
diff
changeset
|
60 | pidgin_presence_icon_active_status_changed_cb(G_GNUC_UNUSED GObject *obj, |
|
7b3312d0760c
Bump C standard to C99 for Pidgin files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41545
diff
changeset
|
61 | G_GNUC_UNUSED GParamSpec *pspec, |
|
40601
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
62 | gpointer data) |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
63 | { |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
64 | pidgin_presence_icon_update(PIDGIN_PRESENCE_ICON(data)); |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
65 | } |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
66 | |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
67 | /****************************************************************************** |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
68 | * GObject Implementation |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
69 | *****************************************************************************/ |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
70 | static void |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
71 | pidgin_presence_icon_get_property(GObject *obj, guint param_id, GValue *value, |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
72 | GParamSpec *pspec) |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
73 | { |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
74 | PidginPresenceIcon *icon = PIDGIN_PRESENCE_ICON(obj); |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
75 | |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
76 | switch(param_id) { |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
77 | case PROP_PRESENCE: |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
78 | g_value_set_object(value, pidgin_presence_icon_get_presence(icon)); |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
79 | break; |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
80 | case PROP_FALLBACK: |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
81 | g_value_set_string(value, pidgin_presence_icon_get_fallback(icon)); |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
82 | break; |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
83 | case PROP_ICON_SIZE: |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
84 | g_value_set_enum(value, pidgin_presence_icon_get_icon_size(icon)); |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
85 | break; |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
86 | default: |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
87 | G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec); |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
88 | break; |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
89 | } |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
90 | } |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
91 | |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
92 | static void |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
93 | pidgin_presence_icon_set_property(GObject *obj, guint param_id, |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
94 | const GValue *value, GParamSpec *pspec) |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
95 | { |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
96 | PidginPresenceIcon *icon = PIDGIN_PRESENCE_ICON(obj); |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
97 | |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
98 | switch(param_id) { |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
99 | case PROP_PRESENCE: |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
100 | pidgin_presence_icon_set_presence(icon, g_value_get_object(value)); |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
101 | break; |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
102 | case PROP_FALLBACK: |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
103 | pidgin_presence_icon_set_fallback(icon, g_value_get_string(value)); |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
104 | break; |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
105 | case PROP_ICON_SIZE: |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
106 | pidgin_presence_icon_set_icon_size(icon, g_value_get_enum(value)); |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
107 | break; |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
108 | default: |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
109 | G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec); |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
110 | break; |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
111 | } |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
112 | } |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
113 | |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
114 | static void |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
115 | pidgin_presence_icon_finalize(GObject *obj) { |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
116 | PidginPresenceIcon *icon = PIDGIN_PRESENCE_ICON(obj); |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
117 | |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
118 | g_clear_object(&icon->presence); |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
119 | g_clear_pointer(&icon->fallback, g_free); |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
120 | |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
121 | G_OBJECT_CLASS(pidgin_presence_icon_parent_class)->finalize(obj); |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
122 | } |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
123 | |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
124 | static void |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
125 | pidgin_presence_icon_init(PidginPresenceIcon *presenceicon) { |
|
41355
cb48a8dd1bfc
Re-subclass PidginPresenceIcon onto GtkBox as GtkImage is final in Gtk4
Gary Kramlich <grim@reaperworld.com>
parents:
41027
diff
changeset
|
126 | gtk_widget_init_template(GTK_WIDGET(presenceicon)); |
|
40601
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
127 | } |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
128 | |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
129 | static void |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
130 | pidgin_presence_icon_class_init(PidginPresenceIconClass *klass) { |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
131 | GObjectClass *obj_class = G_OBJECT_CLASS(klass); |
|
41355
cb48a8dd1bfc
Re-subclass PidginPresenceIcon onto GtkBox as GtkImage is final in Gtk4
Gary Kramlich <grim@reaperworld.com>
parents:
41027
diff
changeset
|
132 | GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass); |
|
40601
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
133 | |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
134 | obj_class->finalize = pidgin_presence_icon_finalize; |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
135 | obj_class->get_property = pidgin_presence_icon_get_property; |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
136 | obj_class->set_property = pidgin_presence_icon_set_property; |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
137 | |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
138 | /** |
|
41479
3d2e114380f6
Add source files to GObject introspection
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41355
diff
changeset
|
139 | * PidginPresenceIcon:presence: |
|
40601
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
140 | * |
|
41479
3d2e114380f6
Add source files to GObject introspection
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41355
diff
changeset
|
141 | * The presence that this icon will be representing. |
|
40601
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
142 | */ |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
143 | properties[PROP_PRESENCE] = g_param_spec_object( |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
144 | "presence", "presence", |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
145 | "The presence that this icon is representing", |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
146 | PURPLE_TYPE_PRESENCE, |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
147 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS); |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
148 | |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
149 | /** |
|
41479
3d2e114380f6
Add source files to GObject introspection
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41355
diff
changeset
|
150 | * PidginPresenceIcon:fallback: |
|
40601
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
151 | * |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
152 | * The name of the icon to use as a fallback when no presence is set. |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
153 | */ |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
154 | properties[PROP_FALLBACK] = g_param_spec_string( |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
155 | "fallback", "fallback", |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
156 | "The name of the icon to use as a fallback", |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
157 | "user-invisible", |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
158 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS); |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
159 | |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
160 | /** |
|
41479
3d2e114380f6
Add source files to GObject introspection
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41355
diff
changeset
|
161 | * PidginPresenceIcon:icon-size: |
|
40601
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
162 | * |
|
41479
3d2e114380f6
Add source files to GObject introspection
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41355
diff
changeset
|
163 | * The size of the icon that should be used. |
|
40601
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
164 | */ |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
165 | properties[PROP_ICON_SIZE] = g_param_spec_enum( |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
166 | "icon-size", "icon-size", |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
167 | "The GtkIconSize to use", |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
168 | GTK_TYPE_ICON_SIZE, |
|
41545
b02de51a738e
Update PidginPresenceIcon for GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41479
diff
changeset
|
169 | GTK_ICON_SIZE_NORMAL, |
|
40601
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
170 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS); |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
171 | |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
172 | g_object_class_install_properties(obj_class, N_PROPERTIES, properties); |
|
41355
cb48a8dd1bfc
Re-subclass PidginPresenceIcon onto GtkBox as GtkImage is final in Gtk4
Gary Kramlich <grim@reaperworld.com>
parents:
41027
diff
changeset
|
173 | |
|
cb48a8dd1bfc
Re-subclass PidginPresenceIcon onto GtkBox as GtkImage is final in Gtk4
Gary Kramlich <grim@reaperworld.com>
parents:
41027
diff
changeset
|
174 | gtk_widget_class_set_template_from_resource( |
|
cb48a8dd1bfc
Re-subclass PidginPresenceIcon onto GtkBox as GtkImage is final in Gtk4
Gary Kramlich <grim@reaperworld.com>
parents:
41027
diff
changeset
|
175 | widget_class, |
|
cb48a8dd1bfc
Re-subclass PidginPresenceIcon onto GtkBox as GtkImage is final in Gtk4
Gary Kramlich <grim@reaperworld.com>
parents:
41027
diff
changeset
|
176 | "/im/pidgin/Pidgin3/presenceicon.ui" |
|
cb48a8dd1bfc
Re-subclass PidginPresenceIcon onto GtkBox as GtkImage is final in Gtk4
Gary Kramlich <grim@reaperworld.com>
parents:
41027
diff
changeset
|
177 | ); |
|
cb48a8dd1bfc
Re-subclass PidginPresenceIcon onto GtkBox as GtkImage is final in Gtk4
Gary Kramlich <grim@reaperworld.com>
parents:
41027
diff
changeset
|
178 | |
|
cb48a8dd1bfc
Re-subclass PidginPresenceIcon onto GtkBox as GtkImage is final in Gtk4
Gary Kramlich <grim@reaperworld.com>
parents:
41027
diff
changeset
|
179 | gtk_widget_class_bind_template_child(widget_class, PidginPresenceIcon, |
|
cb48a8dd1bfc
Re-subclass PidginPresenceIcon onto GtkBox as GtkImage is final in Gtk4
Gary Kramlich <grim@reaperworld.com>
parents:
41027
diff
changeset
|
180 | icon); |
|
40601
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
181 | } |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
182 | |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
183 | /****************************************************************************** |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
184 | * Public API |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
185 | *****************************************************************************/ |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
186 | GtkWidget * |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
187 | pidgin_presence_icon_new(PurplePresence *presence, const gchar *fallback, |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
188 | GtkIconSize icon_size) |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
189 | { |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
190 | return g_object_new( |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
191 | PIDGIN_TYPE_PRESENCE_ICON, |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
192 | "presence", presence, |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
193 | "fallback", fallback, |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
194 | "icon_size", icon_size, |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
195 | NULL); |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
196 | } |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
197 | |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
198 | PurplePresence * |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
199 | pidgin_presence_icon_get_presence(PidginPresenceIcon *icon) { |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
200 | g_return_val_if_fail(PIDGIN_IS_PRESENCE_ICON(icon), NULL); |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
201 | |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
202 | return icon->presence; |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
203 | } |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
204 | |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
205 | void |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
206 | pidgin_presence_icon_set_presence(PidginPresenceIcon *icon, |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
207 | PurplePresence *presence) |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
208 | { |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
209 | PurplePresence *old = NULL; |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
210 | |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
211 | g_return_if_fail(PIDGIN_IS_PRESENCE_ICON(icon)); |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
212 | |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
213 | /* We only want to disconnect signal handlers if the presence was changed, |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
214 | * but to do that, we need to keep a reference to the old presence. |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
215 | */ |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
216 | if(PURPLE_IS_PRESENCE(icon->presence)) { |
|
40604
cd55d0fc0f81
Fix some more new warnings.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40601
diff
changeset
|
217 | old = g_object_ref(icon->presence); |
|
40601
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
218 | } |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
219 | |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
220 | if(g_set_object(&icon->presence, presence)) { |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
221 | if(G_IS_OBJECT(old)) { |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
222 | /* If we previously had a presence, disconnect our signal handlers. |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
223 | */ |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
224 | g_signal_handlers_disconnect_by_data(old, icon); |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
225 | } |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
226 | |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
227 | if(PURPLE_IS_PRESENCE(icon->presence)) { |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
228 | g_signal_connect(icon->presence, "notify::active-status", |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
229 | G_CALLBACK(pidgin_presence_icon_active_status_changed_cb), |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
230 | icon); |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
231 | } |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
232 | |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
233 | g_object_freeze_notify(G_OBJECT(icon)); |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
234 | |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
235 | pidgin_presence_icon_update(icon); |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
236 | |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
237 | g_object_notify_by_pspec(G_OBJECT(icon), properties[PROP_PRESENCE]); |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
238 | |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
239 | g_object_thaw_notify(G_OBJECT(icon)); |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
240 | } |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
241 | |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
242 | g_clear_object(&old); |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
243 | } |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
244 | |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
245 | const gchar * |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
246 | pidgin_presence_icon_get_fallback(PidginPresenceIcon *icon) { |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
247 | g_return_val_if_fail(PIDGIN_IS_PRESENCE_ICON(icon), NULL); |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
248 | |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
249 | return icon->fallback; |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
250 | } |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
251 | |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
252 | void |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
253 | pidgin_presence_icon_set_fallback(PidginPresenceIcon *icon, |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
254 | const gchar *fallback) |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
255 | { |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
256 | g_return_if_fail(PIDGIN_IS_PRESENCE_ICON(icon)); |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
257 | g_return_if_fail(fallback != NULL); |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
258 | |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
259 | g_free(icon->fallback); |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
260 | icon->fallback = g_strdup(fallback); |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
261 | |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
262 | g_object_freeze_notify(G_OBJECT(icon)); |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
263 | |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
264 | pidgin_presence_icon_update(icon); |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
265 | |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
266 | g_object_notify_by_pspec(G_OBJECT(icon), properties[PROP_FALLBACK]); |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
267 | |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
268 | g_object_thaw_notify(G_OBJECT(icon)); |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
269 | } |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
270 | |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
271 | GtkIconSize |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
272 | pidgin_presence_icon_get_icon_size(PidginPresenceIcon *icon) { |
|
41545
b02de51a738e
Update PidginPresenceIcon for GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41479
diff
changeset
|
273 | g_return_val_if_fail(PIDGIN_IS_PRESENCE_ICON(icon), GTK_ICON_SIZE_INHERIT); |
|
40601
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
274 | |
|
41545
b02de51a738e
Update PidginPresenceIcon for GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41479
diff
changeset
|
275 | return gtk_image_get_icon_size(GTK_IMAGE(icon->icon)); |
|
40601
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
276 | } |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
277 | |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
278 | void |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
279 | pidgin_presence_icon_set_icon_size(PidginPresenceIcon *icon, |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
280 | GtkIconSize icon_size) |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
281 | { |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
282 | g_return_if_fail(PIDGIN_IS_PRESENCE_ICON(icon)); |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
283 | |
|
41545
b02de51a738e
Update PidginPresenceIcon for GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41479
diff
changeset
|
284 | gtk_image_set_icon_size(GTK_IMAGE(icon->icon), icon_size); |
|
40601
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
285 | |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
286 | g_object_freeze_notify(G_OBJECT(icon)); |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
287 | |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
288 | pidgin_presence_icon_update(icon); |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
289 | |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
290 | g_object_notify_by_pspec(G_OBJECT(icon), properties[PROP_ICON_SIZE]); |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
291 | |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
292 | g_object_thaw_notify(G_OBJECT(icon)); |
|
228284223862
Create PidginPresenceIcon that displays the correct icon for its bound PurplePresence
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
293 | } |