Thu, 25 Aug 2022 23:25:12 -0500
Replace the style-updated signal with GtkIconTheme:changed
Testing Done:
Ran and make sure the `GWarning` went away.
Reviewed at https://reviews.imfreedom.org/r/1653/
|
37946
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1 | /* |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
2 | * purple |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
3 | * |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
4 | * Purple is the legal property of its developers, whose names are too numerous |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
5 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
6 | * source distribution. |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
7 | * |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
8 | * This program is free software; you can redistribute it and/or modify |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
9 | * it under the terms of the GNU General Public License as published by |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
10 | * the Free Software Foundation; either version 2 of the License, or |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
11 | * (at your option) any later version. |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
12 | * |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
13 | * This program is distributed in the hope that it will be useful, |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
16 | * GNU General Public License for more details. |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
17 | * |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
18 | * You should have received a copy of the GNU General Public License |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
19 | * along with this program; if not, write to the Free Software |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
21 | * |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
22 | */ |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
23 | |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
24 | #include "contact.h" |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
25 | #include "internal.h" /* TODO: this needs to die */ |
|
40537
fbf29150c28c
Move PurpleAccountPresence and PurpleBuddyPresence to their own files
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
26 | #include "purplebuddypresence.h" |
|
40992
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
27 | #include "purpleconversationmanager.h" |
|
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:
39782
diff
changeset
|
28 | #include "purpleprivate.h" |
|
37946
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
29 | #include "util.h" |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
30 | |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
31 | typedef struct _PurpleContactPrivate PurpleContactPrivate; |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
32 | |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
33 | struct _PurpleContactPrivate { |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
34 | char *alias; /* The user-set alias of the contact */ |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
35 | PurpleBuddy *priority_buddy; /* The "top" buddy for this contact */ |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
36 | gboolean priority_valid; /* Is priority valid? */ |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
37 | }; |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
38 | |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
39 | enum |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
40 | { |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
41 | PROP_0, |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
42 | PROP_ALIAS, |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
43 | PROP_PRIORITY_BUDDY, |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
44 | PROP_LAST |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
45 | }; |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
46 | |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
47 | /****************************************************************************** |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
48 | * Globals |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
49 | *****************************************************************************/ |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
50 | static GParamSpec *properties[PROP_LAST]; |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
51 | |
|
39364
54439db24429
libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
52 | G_DEFINE_TYPE_WITH_PRIVATE(PurpleContact, purple_contact, |
|
54439db24429
libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
53 | PURPLE_TYPE_COUNTING_NODE); |
|
54439db24429
libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
54 | |
|
37946
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
55 | /****************************************************************************** |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
56 | * API |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
57 | *****************************************************************************/ |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
58 | static void |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
59 | purple_contact_compute_priority_buddy(PurpleContact *contact) { |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
60 | PurpleBlistNode *bnode; |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
61 | PurpleBuddy *new_priority = NULL; |
|
39364
54439db24429
libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
62 | PurpleContactPrivate *priv = |
|
54439db24429
libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
63 | purple_contact_get_instance_private(contact); |
|
37946
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
64 | |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
65 | priv->priority_buddy = NULL; |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
66 | for (bnode = PURPLE_BLIST_NODE(contact)->child; |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
67 | bnode != NULL; |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
68 | bnode = bnode->next) |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
69 | { |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
70 | PurpleBuddy *buddy; |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
71 | |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
72 | if (!PURPLE_IS_BUDDY(bnode)) |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
73 | continue; |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
74 | |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
75 | buddy = PURPLE_BUDDY(bnode); |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
76 | if (new_priority == NULL) |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
77 | { |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
78 | new_priority = buddy; |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
79 | continue; |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
80 | } |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
81 | |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
82 | if (purple_account_is_connected(purple_buddy_get_account(buddy))) |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
83 | { |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
84 | int cmp = 1; |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
85 | if (purple_account_is_connected(purple_buddy_get_account(new_priority))) |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
86 | cmp = purple_buddy_presence_compare( |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
87 | PURPLE_BUDDY_PRESENCE(purple_buddy_get_presence(new_priority)), |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
88 | PURPLE_BUDDY_PRESENCE(purple_buddy_get_presence(buddy))); |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
89 | |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
90 | if (cmp > 0 || (cmp == 0 && |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
91 | purple_prefs_get_bool("/purple/contact/last_match"))) |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
92 | { |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
93 | new_priority = buddy; |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
94 | } |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
95 | } |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
96 | } |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
97 | |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
98 | priv->priority_buddy = new_priority; |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
99 | priv->priority_valid = TRUE; |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
100 | |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
101 | g_object_notify_by_pspec(G_OBJECT(contact), |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
102 | properties[PROP_PRIORITY_BUDDY]); |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
103 | } |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
104 | |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
105 | PurpleGroup * |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
106 | purple_contact_get_group(const PurpleContact *contact) |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
107 | { |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
108 | g_return_val_if_fail(PURPLE_IS_CONTACT(contact), NULL); |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
109 | |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
110 | return PURPLE_GROUP(PURPLE_BLIST_NODE(contact)->parent); |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
111 | } |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
112 | |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
113 | void |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
114 | purple_contact_set_alias(PurpleContact *contact, const char *alias) |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
115 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39676
diff
changeset
|
116 | PurpleContactPrivate *priv = NULL; |
|
40992
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
117 | PurpleConversationManager *manager = NULL; |
|
37946
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
118 | PurpleBlistNode *bnode; |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
119 | char *old_alias; |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
120 | char *new_alias = NULL; |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
121 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39676
diff
changeset
|
122 | g_return_if_fail(PURPLE_IS_CONTACT(contact)); |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39676
diff
changeset
|
123 | priv = purple_contact_get_instance_private(contact); |
|
37946
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
124 | |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
125 | if ((alias != NULL) && (*alias != '\0')) |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
126 | new_alias = purple_utf8_strip_unprintables(alias); |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
127 | |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
128 | if (!purple_strequal(priv->alias, new_alias)) { |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
129 | g_free(new_alias); |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
130 | return; |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
131 | } |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
132 | |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
133 | old_alias = priv->alias; |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
134 | |
|
40992
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
135 | if ((new_alias != NULL) && (*new_alias != '\0')) { |
|
37946
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
136 | priv->alias = new_alias; |
|
40992
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
137 | } else { |
|
37946
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
138 | priv->alias = NULL; |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
139 | g_free(new_alias); /* could be "\0" */ |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
140 | } |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
141 | |
|
40992
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
142 | g_object_notify_by_pspec(G_OBJECT(contact), properties[PROP_ALIAS]); |
|
37946
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
143 | |
|
39676
1e8394d47205
Add list parameter to all buddy list UI ops.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39675
diff
changeset
|
144 | purple_blist_save_node(purple_blist_get_default(), |
|
1e8394d47205
Add list parameter to all buddy list UI ops.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39675
diff
changeset
|
145 | PURPLE_BLIST_NODE(contact)); |
|
39675
583e2ba6e78e
Add wrapper functions for some PurpleBlistUiOps.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39665
diff
changeset
|
146 | purple_blist_update_node(purple_blist_get_default(), |
|
583e2ba6e78e
Add wrapper functions for some PurpleBlistUiOps.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39665
diff
changeset
|
147 | PURPLE_BLIST_NODE(contact)); |
|
37946
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
148 | |
|
40992
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
149 | manager = purple_conversation_manager_get_default(); |
|
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
150 | |
|
37946
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
151 | for(bnode = PURPLE_BLIST_NODE(contact)->child; bnode != NULL; bnode = bnode->next) |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
152 | { |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
153 | PurpleBuddy *buddy = PURPLE_BUDDY(bnode); |
|
40992
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
154 | PurpleConversation *im; |
|
37946
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
155 | |
|
40992
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
156 | im = purple_conversation_manager_find_im(manager, |
|
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
157 | purple_buddy_get_account(buddy), |
|
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
158 | purple_buddy_get_name(buddy)); |
|
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
159 | if(PURPLE_IS_IM_CONVERSATION(im)) { |
|
40885
87f6241da196
Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents:
40537
diff
changeset
|
160 | purple_conversation_autoset_title(im); |
|
40992
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
161 | } |
|
37946
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
162 | } |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
163 | |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
164 | purple_signal_emit(purple_blist_get_handle(), "blist-node-aliased", |
|
40992
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
165 | contact, old_alias); |
|
37946
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
166 | g_free(old_alias); |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
167 | } |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
168 | |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
169 | const char *purple_contact_get_alias(PurpleContact* contact) |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
170 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39676
diff
changeset
|
171 | PurpleContactPrivate *priv = NULL; |
|
37946
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
172 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39676
diff
changeset
|
173 | g_return_val_if_fail(PURPLE_IS_CONTACT(contact), NULL); |
|
37946
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
174 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39676
diff
changeset
|
175 | priv = purple_contact_get_instance_private(contact); |
|
37946
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
176 | if (priv->alias) |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
177 | return priv->alias; |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
178 | |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
179 | return purple_buddy_get_alias(purple_contact_get_priority_buddy(contact)); |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
180 | } |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
181 | |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
182 | gboolean purple_contact_on_account(PurpleContact *c, PurpleAccount *account) |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
183 | { |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
184 | PurpleBlistNode *bnode, *cnode = (PurpleBlistNode *) c; |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
185 | |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
186 | g_return_val_if_fail(PURPLE_IS_CONTACT(c), FALSE); |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
187 | g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), FALSE); |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
188 | |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
189 | for (bnode = cnode->child; bnode; bnode = bnode->next) { |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
190 | PurpleBuddy *buddy; |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
191 | |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
192 | if (! PURPLE_IS_BUDDY(bnode)) |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
193 | continue; |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
194 | |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
195 | buddy = (PurpleBuddy *)bnode; |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
196 | if (purple_buddy_get_account(buddy) == account) |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
197 | return TRUE; |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
198 | } |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
199 | return FALSE; |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
200 | } |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
201 | |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
202 | void purple_contact_invalidate_priority_buddy(PurpleContact *contact) |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
203 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39676
diff
changeset
|
204 | PurpleContactPrivate *priv = NULL; |
|
37946
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
205 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39676
diff
changeset
|
206 | g_return_if_fail(PURPLE_IS_CONTACT(contact)); |
|
37946
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
207 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39676
diff
changeset
|
208 | priv = purple_contact_get_instance_private(contact); |
|
37946
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
209 | priv->priority_valid = FALSE; |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
210 | } |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
211 | |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
212 | PurpleBuddy *purple_contact_get_priority_buddy(PurpleContact *contact) |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
213 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39676
diff
changeset
|
214 | PurpleContactPrivate *priv = NULL; |
|
37946
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
215 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39676
diff
changeset
|
216 | g_return_val_if_fail(PURPLE_IS_CONTACT(contact), NULL); |
|
37946
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
217 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39676
diff
changeset
|
218 | priv = purple_contact_get_instance_private(contact); |
|
37946
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
219 | if (!priv->priority_valid) |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
220 | purple_contact_compute_priority_buddy(contact); |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
221 | |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
222 | return priv->priority_buddy; |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
223 | } |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
224 | |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
225 | void purple_contact_merge(PurpleContact *source, PurpleBlistNode *node) |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
226 | { |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
227 | PurpleBlistNode *sourcenode = (PurpleBlistNode*)source; |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
228 | PurpleBlistNode *prev, *cur, *next; |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
229 | PurpleContact *target; |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
230 | |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
231 | g_return_if_fail(PURPLE_IS_CONTACT(source)); |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
232 | g_return_if_fail(PURPLE_IS_BLIST_NODE(node)); |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
233 | |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
234 | if (PURPLE_IS_CONTACT(node)) { |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
235 | target = (PurpleContact *)node; |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
236 | prev = _purple_blist_get_last_child(node); |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
237 | } else if (PURPLE_IS_BUDDY(node)) { |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
238 | target = (PurpleContact *)node->parent; |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
239 | prev = node; |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
240 | } else { |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
241 | return; |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
242 | } |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
243 | |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
244 | if (source == target || !target) |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
245 | return; |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
246 | |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
247 | next = sourcenode->child; |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
248 | |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
249 | while (next) { |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
250 | cur = next; |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
251 | next = cur->next; |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
252 | if (PURPLE_IS_BUDDY(cur)) { |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
253 | purple_blist_add_buddy((PurpleBuddy *)cur, target, NULL, prev); |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
254 | prev = cur; |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
255 | } |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
256 | } |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
257 | } |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
258 | |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
259 | /************************************************************************** |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
260 | * GObject Stuff |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
261 | **************************************************************************/ |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
262 | /* Set method for GObject properties */ |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
263 | static void |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
264 | purple_contact_set_property(GObject *obj, guint param_id, const GValue *value, |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
265 | GParamSpec *pspec) |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
266 | { |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
267 | PurpleContact *contact = PURPLE_CONTACT(obj); |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
268 | |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
269 | switch (param_id) { |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
270 | case PROP_ALIAS: |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
271 | purple_contact_set_alias(contact, g_value_get_string(value)); |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
272 | break; |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
273 | default: |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
274 | G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec); |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
275 | break; |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
276 | } |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
277 | } |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
278 | |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
279 | /* Get method for GObject properties */ |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
280 | static void |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
281 | purple_contact_get_property(GObject *obj, guint param_id, GValue *value, |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
282 | GParamSpec *pspec) |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
283 | { |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
284 | PurpleContact *contact = PURPLE_CONTACT(obj); |
|
39364
54439db24429
libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
285 | PurpleContactPrivate *priv = |
|
54439db24429
libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
286 | purple_contact_get_instance_private(contact); |
|
37946
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
287 | |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
288 | switch (param_id) { |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
289 | case PROP_ALIAS: |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
290 | g_value_set_string(value, priv->alias); |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
291 | break; |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
292 | case PROP_PRIORITY_BUDDY: |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
293 | g_value_set_object(value, purple_contact_get_priority_buddy(contact)); |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
294 | break; |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
295 | default: |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
296 | G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec); |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
297 | break; |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
298 | } |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
299 | } |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
300 | |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
301 | /* GObject initialization function */ |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
302 | static void |
|
39364
54439db24429
libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
303 | purple_contact_init(PurpleContact *contact) |
|
37946
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
304 | { |
|
39676
1e8394d47205
Add list parameter to all buddy list UI ops.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39675
diff
changeset
|
305 | purple_blist_new_node(purple_blist_get_default(), |
|
1e8394d47205
Add list parameter to all buddy list UI ops.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39675
diff
changeset
|
306 | PURPLE_BLIST_NODE(contact)); |
|
37946
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
307 | } |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
308 | |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
309 | /* GObject finalize function */ |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
310 | static void |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
311 | purple_contact_finalize(GObject *object) |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
312 | { |
|
39364
54439db24429
libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
313 | PurpleContactPrivate *priv = purple_contact_get_instance_private( |
|
54439db24429
libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
314 | PURPLE_CONTACT(object)); |
|
37946
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
315 | |
|
39364
54439db24429
libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
316 | g_free(priv->alias); |
|
54439db24429
libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
317 | |
|
54439db24429
libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
318 | G_OBJECT_CLASS(purple_contact_parent_class)->finalize(object); |
|
37946
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
319 | } |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
320 | |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
321 | /* Class initializer function */ |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
322 | static void purple_contact_class_init(PurpleContactClass *klass) |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
323 | { |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
324 | GObjectClass *obj_class = G_OBJECT_CLASS(klass); |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
325 | |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
326 | obj_class->finalize = purple_contact_finalize; |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
327 | |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
328 | /* Setup properties */ |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
329 | obj_class->get_property = purple_contact_get_property; |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
330 | obj_class->set_property = purple_contact_set_property; |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
331 | |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
332 | properties[PROP_ALIAS] = g_param_spec_string( |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
333 | "alias", |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
334 | "Alias", |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
335 | "The alias for the contact.", |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
336 | NULL, |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
337 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
338 | ); |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
339 | |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
340 | properties[PROP_PRIORITY_BUDDY] = g_param_spec_object( |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
341 | "priority-buddy", |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
342 | "Priority buddy", |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
343 | "The priority buddy of the contact.", |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
344 | PURPLE_TYPE_BUDDY, |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
345 | G_PARAM_READABLE | G_PARAM_STATIC_STRINGS |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
346 | ); |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
347 | |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
348 | g_object_class_install_properties(obj_class, PROP_LAST, properties); |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
349 | } |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
350 | |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
351 | PurpleContact * |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
352 | purple_contact_new(void) |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
353 | { |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
354 | return g_object_new(PURPLE_TYPE_CONTACT, NULL); |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
355 | } |
|
4318acee8ac6
Pulled PurpleContact out to it's own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
356 |