Wed, 07 Aug 2019 01:15:14 -0400
Fix broken `priv != NULL` checks in libpurple.
The `*_get_instance_private` function just returns input value + offset,
so it is impossible for `priv` to be `NULL`.
| 11475 | 1 | /* |
| 15884 | 2 | * purple |
| 11475 | 3 | * |
| 15884 | 4 | * Purple is the legal property of its developers, whose names are too numerous |
| 11475 | 5 | * to list here. Please refer to the COPYRIGHT file distributed with this |
| 6 | * source distribution. | |
| 7 | * | |
| 8 | * This program is free software; you can redistribute it and/or modify | |
| 9 | * it under the terms of the GNU General Public License as published by | |
| 10 | * the Free Software Foundation; either version 2 of the License, or | |
| 11 | * (at your option) any later version. | |
| 12 | * | |
| 13 | * This program is distributed in the hope that it will be useful, | |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 16 | * GNU General Public License for more details. | |
| 17 | * | |
| 18 | * You should have received a copy of the GNU General Public License | |
| 19 | * along with this program; if not, write to the Free Software | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
18265
diff
changeset
|
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 11475 | 21 | * |
| 22 | */ | |
| 23 | ||
|
18265
9f26190d7f46
Move the define in internal.h instead.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15884
diff
changeset
|
24 | #include "internal.h" |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
25 | #include "glibcompat.h" |
| 11475 | 26 | #include "whiteboard.h" |
|
36543
a8c3fecee2d3
Renamed prpl.[ch] to protocol.[ch]
Ankit Vani <a@nevitus.org>
parents:
36376
diff
changeset
|
27 | #include "protocol.h" |
| 11475 | 28 | |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
29 | typedef struct _PurpleWhiteboardPrivate PurpleWhiteboardPrivate; |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
30 | |
|
35470
8ee08a41f2f3
Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents:
35102
diff
changeset
|
31 | /* Private data for a whiteboard */ |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
32 | struct _PurpleWhiteboardPrivate |
|
32708
e275f5e7b257
Hide struct PurpleWhiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32285
diff
changeset
|
33 | { |
|
35470
8ee08a41f2f3
Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents:
35102
diff
changeset
|
34 | int state; /* State of whiteboard session */ |
|
32708
e275f5e7b257
Hide struct PurpleWhiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32285
diff
changeset
|
35 | |
|
35470
8ee08a41f2f3
Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents:
35102
diff
changeset
|
36 | PurpleAccount *account; /* Account associated with this session */ |
|
8ee08a41f2f3
Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents:
35102
diff
changeset
|
37 | char *who; /* Name of the remote user */ |
|
32708
e275f5e7b257
Hide struct PurpleWhiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32285
diff
changeset
|
38 | |
| 35097 | 39 | /* TODO Remove this and use protocol-specific subclasses. */ |
|
35470
8ee08a41f2f3
Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents:
35102
diff
changeset
|
40 | void *proto_data; /* Protocol specific data */ |
| 35097 | 41 | |
| 37075 | 42 | PurpleWhiteboardOps *protocol_ops; /* Protocol operations */ |
|
32708
e275f5e7b257
Hide struct PurpleWhiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32285
diff
changeset
|
43 | |
|
35470
8ee08a41f2f3
Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents:
35102
diff
changeset
|
44 | GList *draw_list; /* List of drawing elements/deltas to |
|
8ee08a41f2f3
Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents:
35102
diff
changeset
|
45 | send */ |
|
32708
e275f5e7b257
Hide struct PurpleWhiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32285
diff
changeset
|
46 | }; |
|
e275f5e7b257
Hide struct PurpleWhiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32285
diff
changeset
|
47 | |
|
34939
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
48 | /* GObject Property enums */ |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
49 | enum |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
50 | { |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
51 | PROP_0, |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
52 | PROP_STATE, |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
53 | PROP_ACCOUNT, |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
54 | PROP_WHO, |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
55 | PROP_DRAW_LIST, |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
56 | PROP_LAST |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
57 | }; |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
58 | |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
59 | /****************************************************************************** |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
60 | * Globals |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
61 | *****************************************************************************/ |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
62 | static GParamSpec *properties[PROP_LAST]; |
|
34939
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
63 | |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
37119
diff
changeset
|
64 | G_DEFINE_TYPE_WITH_PRIVATE(PurpleWhiteboard, purple_whiteboard, G_TYPE_OBJECT); |
|
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
37119
diff
changeset
|
65 | |
| 15884 | 66 | static PurpleWhiteboardUiOps *whiteboard_ui_ops = NULL; |
|
36637
9b0109ae118d
Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents:
36623
diff
changeset
|
67 | /* static PurpleWhiteboardOps *whiteboard_protocol_ops = NULL; */ |
| 11475 | 68 | |
|
35102
ef8014abe867
Rename a camel case var to not be camel case.
Mark Doliner <mark@kingant.net>
parents:
35097
diff
changeset
|
69 | static GList *wb_list = NULL; |
| 11475 | 70 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
71 | /*static gboolean auto_accept = TRUE; */ |
| 11475 | 72 | |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
73 | /****************************************************************************** |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
74 | * API |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
75 | *****************************************************************************/ |
| 35572 | 76 | static PurpleWhiteboardUiOps * |
| 77 | purple_whiteboard_ui_ops_copy(PurpleWhiteboardUiOps *ops) | |
| 78 | { | |
| 79 | PurpleWhiteboardUiOps *ops_new; | |
| 80 | ||
| 81 | g_return_val_if_fail(ops != NULL, NULL); | |
| 82 | ||
| 83 | ops_new = g_new(PurpleWhiteboardUiOps, 1); | |
| 84 | *ops_new = *ops; | |
| 85 | ||
| 86 | return ops_new; | |
| 87 | } | |
| 88 | ||
| 89 | GType | |
| 90 | purple_whiteboard_ui_ops_get_type(void) | |
| 91 | { | |
| 92 | static GType type = 0; | |
| 93 | ||
| 94 | if (type == 0) { | |
| 95 | type = g_boxed_type_register_static("PurpleWhiteboardUiOps", | |
| 96 | (GBoxedCopyFunc)purple_whiteboard_ui_ops_copy, | |
|
35597
7fcfcf147b99
Use g_free as UiOps structures GBoxed free function
Ankit Vani <a@nevitus.org>
parents:
35572
diff
changeset
|
97 | (GBoxedFreeFunc)g_free); |
| 35572 | 98 | } |
| 99 | ||
| 100 | return type; | |
| 101 | } | |
| 102 | ||
| 15884 | 103 | void purple_whiteboard_set_ui_ops(PurpleWhiteboardUiOps *ops) |
| 11475 | 104 | { |
| 105 | whiteboard_ui_ops = ops; | |
| 106 | } | |
| 107 | ||
|
36637
9b0109ae118d
Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents:
36623
diff
changeset
|
108 | void purple_whiteboard_set_protocol_ops(PurpleWhiteboard *wb, PurpleWhiteboardOps *ops) |
| 11475 | 109 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
110 | PurpleWhiteboardPrivate *priv = NULL; |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
111 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
112 | g_return_if_fail(PURPLE_IS_WHITEBOARD(wb)); |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
113 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
114 | priv = purple_whiteboard_get_instance_private(wb); |
| 36693 | 115 | priv->protocol_ops = ops; |
| 11475 | 116 | } |
| 117 | ||
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
37119
diff
changeset
|
118 | PurpleAccount *purple_whiteboard_get_account(PurpleWhiteboard *wb) |
|
32285
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
119 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
120 | PurpleWhiteboardPrivate *priv = NULL; |
|
32285
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
121 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
122 | g_return_val_if_fail(PURPLE_IS_WHITEBOARD(wb), NULL); |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
123 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
124 | priv = purple_whiteboard_get_instance_private(wb); |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
125 | return priv->account; |
|
32285
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
126 | } |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
127 | |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
37119
diff
changeset
|
128 | const char *purple_whiteboard_get_who(PurpleWhiteboard *wb) |
|
32285
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
129 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
130 | PurpleWhiteboardPrivate *priv = NULL; |
|
32285
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
131 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
132 | g_return_val_if_fail(PURPLE_IS_WHITEBOARD(wb), NULL); |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
133 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
134 | priv = purple_whiteboard_get_instance_private(wb); |
|
39593
2d41781914e7
Document the protocol whiteboard and chat interfaces
Gary Kramlich <grim@reaperworld.com>
parents:
39423
diff
changeset
|
135 | return priv->who; |
|
32285
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
136 | } |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
137 | |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
138 | void purple_whiteboard_set_state(PurpleWhiteboard *wb, int state) |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
139 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
140 | PurpleWhiteboardPrivate *priv = NULL; |
|
32285
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
141 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
142 | g_return_if_fail(PURPLE_IS_WHITEBOARD(wb)); |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
143 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
144 | priv = purple_whiteboard_get_instance_private(wb); |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
145 | priv->state = state; |
|
35013
4718438d053b
Cleaned up properties and added g_object_notify calls for everything else
Ankit Vani <a@nevitus.org>
parents:
34986
diff
changeset
|
146 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
147 | g_object_notify_by_pspec(G_OBJECT(wb), properties[PROP_STATE]); |
|
32285
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
148 | } |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
149 | |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
37119
diff
changeset
|
150 | int purple_whiteboard_get_state(PurpleWhiteboard *wb) |
|
32285
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
151 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
152 | PurpleWhiteboardPrivate *priv = NULL; |
|
32285
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
153 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
154 | g_return_val_if_fail(PURPLE_IS_WHITEBOARD(wb), -1); |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
155 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
156 | priv = purple_whiteboard_get_instance_private(wb); |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
157 | return priv->state; |
|
32285
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
158 | } |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
159 | |
| 15884 | 160 | void purple_whiteboard_start(PurpleWhiteboard *wb) |
| 11475 | 161 | { |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
162 | /* Create frontend for whiteboard */ |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
163 | if(whiteboard_ui_ops && whiteboard_ui_ops->create) |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
164 | whiteboard_ui_ops->create(wb); |
| 11475 | 165 | } |
| 166 | ||
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
167 | /* Looks through the list of whiteboard sessions for one that is between |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
168 | * usernames 'me' and 'who'. Returns a pointer to a matching whiteboard |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
169 | * session; if none match, it returns NULL. |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
170 | */ |
| 15884 | 171 | PurpleWhiteboard *purple_whiteboard_get_session(const PurpleAccount *account, const char *who) |
| 11475 | 172 | { |
| 15884 | 173 | PurpleWhiteboard *wb; |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
174 | PurpleWhiteboardPrivate *priv; |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
175 | |
|
35102
ef8014abe867
Rename a camel case var to not be camel case.
Mark Doliner <mark@kingant.net>
parents:
35097
diff
changeset
|
176 | GList *l = wb_list; |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
177 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
178 | /* Look for a whiteboard session between the local user and the remote user |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
179 | */ |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
180 | while(l != NULL) |
| 11475 | 181 | { |
| 182 | wb = l->data; | |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
37119
diff
changeset
|
183 | priv = purple_whiteboard_get_instance_private(wb); |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
184 | |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
185 | if(priv->account == account && purple_strequal(priv->who, who)) |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
186 | return wb; |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
187 | |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
188 | l = l->next; |
| 11475 | 189 | } |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
190 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
191 | return NULL; |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
192 | } |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
193 | |
| 15884 | 194 | void purple_whiteboard_draw_list_destroy(GList *draw_list) |
|
12022
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
195 | { |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
13419
diff
changeset
|
196 | g_list_free(draw_list); |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
197 | } |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
198 | |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
37119
diff
changeset
|
199 | gboolean purple_whiteboard_get_dimensions(PurpleWhiteboard *wb, int *width, int *height) |
|
12022
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
200 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
201 | PurpleWhiteboardPrivate *priv = NULL; |
| 36693 | 202 | PurpleWhiteboardOps *protocol_ops; |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
203 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
204 | g_return_val_if_fail(PURPLE_IS_WHITEBOARD(wb), FALSE); |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
205 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
206 | priv = purple_whiteboard_get_instance_private(wb); |
| 36693 | 207 | protocol_ops = priv->protocol_ops; |
|
12022
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
208 | |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
209 | if (protocol_ops && protocol_ops->get_dimensions) |
|
12022
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
210 | { |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
211 | protocol_ops->get_dimensions(wb, width, height); |
|
12022
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
212 | return TRUE; |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
213 | } |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
214 | |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
215 | return FALSE; |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
216 | } |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
217 | |
| 15884 | 218 | void purple_whiteboard_set_dimensions(PurpleWhiteboard *wb, int width, int height) |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
219 | { |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
220 | if(whiteboard_ui_ops && whiteboard_ui_ops->set_dimensions) |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
221 | whiteboard_ui_ops->set_dimensions(wb, width, height); |
| 11475 | 222 | } |
| 223 | ||
| 15884 | 224 | void purple_whiteboard_send_draw_list(PurpleWhiteboard *wb, GList *list) |
|
12022
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
225 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
226 | PurpleWhiteboardPrivate *priv = NULL; |
| 36693 | 227 | PurpleWhiteboardOps *protocol_ops; |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
228 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
229 | g_return_if_fail(PURPLE_IS_WHITEBOARD(wb)); |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
230 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
231 | priv = purple_whiteboard_get_instance_private(wb); |
| 36693 | 232 | protocol_ops = priv->protocol_ops; |
|
12022
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
233 | |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
234 | if (protocol_ops && protocol_ops->send_draw_list) |
|
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
235 | protocol_ops->send_draw_list(wb, list); |
|
12022
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
236 | } |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
237 | |
| 15884 | 238 | void purple_whiteboard_draw_point(PurpleWhiteboard *wb, int x, int y, int color, int size) |
| 11475 | 239 | { |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
240 | if(whiteboard_ui_ops && whiteboard_ui_ops->draw_point) |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
241 | whiteboard_ui_ops->draw_point(wb, x, y, color, size); |
| 11475 | 242 | } |
| 243 | ||
| 15884 | 244 | void purple_whiteboard_draw_line(PurpleWhiteboard *wb, int x1, int y1, int x2, int y2, int color, int size) |
| 11475 | 245 | { |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
246 | if(whiteboard_ui_ops && whiteboard_ui_ops->draw_line) |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
247 | whiteboard_ui_ops->draw_line(wb, x1, y1, x2, y2, color, size); |
| 11475 | 248 | } |
| 249 | ||
| 15884 | 250 | void purple_whiteboard_clear(PurpleWhiteboard *wb) |
| 11475 | 251 | { |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
252 | if(whiteboard_ui_ops && whiteboard_ui_ops->clear) |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
253 | whiteboard_ui_ops->clear(wb); |
| 11475 | 254 | } |
| 255 | ||
| 15884 | 256 | void purple_whiteboard_send_clear(PurpleWhiteboard *wb) |
|
12022
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
257 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
258 | PurpleWhiteboardPrivate *priv = NULL; |
| 36693 | 259 | PurpleWhiteboardOps *protocol_ops; |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
260 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
261 | g_return_if_fail(PURPLE_IS_WHITEBOARD(wb)); |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
262 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
263 | priv = purple_whiteboard_get_instance_private(wb); |
| 36693 | 264 | protocol_ops = priv->protocol_ops; |
|
12022
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
265 | |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
266 | if (protocol_ops && protocol_ops->clear) |
|
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
267 | protocol_ops->clear(wb); |
|
12022
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
268 | } |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
269 | |
| 15884 | 270 | void purple_whiteboard_send_brush(PurpleWhiteboard *wb, int size, int color) |
|
12022
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
271 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
272 | PurpleWhiteboardPrivate *priv = NULL; |
| 36693 | 273 | PurpleWhiteboardOps *protocol_ops; |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
274 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
275 | g_return_if_fail(PURPLE_IS_WHITEBOARD(wb)); |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
276 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
277 | priv = purple_whiteboard_get_instance_private(wb); |
| 36693 | 278 | protocol_ops = priv->protocol_ops; |
|
12022
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
279 | |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
280 | if (protocol_ops && protocol_ops->set_brush) |
|
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
281 | protocol_ops->set_brush(wb, size, color); |
|
12022
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
282 | } |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
283 | |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
37119
diff
changeset
|
284 | gboolean purple_whiteboard_get_brush(PurpleWhiteboard *wb, int *size, int *color) |
|
12022
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
285 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
286 | PurpleWhiteboardPrivate *priv = NULL; |
| 36693 | 287 | PurpleWhiteboardOps *protocol_ops; |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
288 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
289 | g_return_val_if_fail(PURPLE_IS_WHITEBOARD(wb), FALSE); |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
290 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
291 | priv = purple_whiteboard_get_instance_private(wb); |
| 36693 | 292 | protocol_ops = priv->protocol_ops; |
|
12022
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
293 | |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
294 | if (protocol_ops && protocol_ops->get_brush) |
|
12022
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
295 | { |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
296 | protocol_ops->get_brush(wb, size, color); |
|
12022
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
297 | return TRUE; |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
298 | } |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
299 | return FALSE; |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
300 | } |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
301 | |
| 15884 | 302 | void purple_whiteboard_set_brush(PurpleWhiteboard *wb, int size, int color) |
|
12022
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
303 | { |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
304 | if (whiteboard_ui_ops && whiteboard_ui_ops->set_brush) |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
305 | whiteboard_ui_ops->set_brush(wb, size, color); |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
306 | } |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
307 | |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
37119
diff
changeset
|
308 | GList *purple_whiteboard_get_draw_list(PurpleWhiteboard *wb) |
|
32285
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
309 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
310 | PurpleWhiteboardPrivate *priv = NULL; |
|
32285
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
311 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
312 | g_return_val_if_fail(PURPLE_IS_WHITEBOARD(wb), NULL); |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
313 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
314 | priv = purple_whiteboard_get_instance_private(wb); |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
315 | return priv->draw_list; |
|
32285
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
316 | } |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
317 | |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
318 | void purple_whiteboard_set_draw_list(PurpleWhiteboard *wb, GList* draw_list) |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
319 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
320 | PurpleWhiteboardPrivate *priv = NULL; |
|
32285
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
321 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
322 | g_return_if_fail(PURPLE_IS_WHITEBOARD(wb)); |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
323 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
324 | priv = purple_whiteboard_get_instance_private(wb); |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
325 | priv->draw_list = draw_list; |
|
35013
4718438d053b
Cleaned up properties and added g_object_notify calls for everything else
Ankit Vani <a@nevitus.org>
parents:
34986
diff
changeset
|
326 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
327 | g_object_notify_by_pspec(G_OBJECT(wb), properties[PROP_DRAW_LIST]); |
|
32285
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
328 | } |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
329 | |
|
32282
c3df9b7a5160
Added protocol_data and ui_data accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
28981
diff
changeset
|
330 | void purple_whiteboard_set_protocol_data(PurpleWhiteboard *wb, gpointer proto_data) |
|
c3df9b7a5160
Added protocol_data and ui_data accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
28981
diff
changeset
|
331 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
332 | PurpleWhiteboardPrivate *priv = NULL; |
|
32282
c3df9b7a5160
Added protocol_data and ui_data accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
28981
diff
changeset
|
333 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
334 | g_return_if_fail(PURPLE_IS_WHITEBOARD(wb)); |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
335 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
336 | priv = purple_whiteboard_get_instance_private(wb); |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
337 | priv->proto_data = proto_data; |
|
32282
c3df9b7a5160
Added protocol_data and ui_data accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
28981
diff
changeset
|
338 | } |
|
c3df9b7a5160
Added protocol_data and ui_data accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
28981
diff
changeset
|
339 | |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
37119
diff
changeset
|
340 | gpointer purple_whiteboard_get_protocol_data(PurpleWhiteboard *wb) |
|
32282
c3df9b7a5160
Added protocol_data and ui_data accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
28981
diff
changeset
|
341 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
342 | PurpleWhiteboardPrivate *priv = NULL; |
|
32282
c3df9b7a5160
Added protocol_data and ui_data accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
28981
diff
changeset
|
343 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
344 | g_return_val_if_fail(PURPLE_IS_WHITEBOARD(wb), NULL); |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
345 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
346 | priv = purple_whiteboard_get_instance_private(wb); |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
347 | return priv->proto_data; |
|
32282
c3df9b7a5160
Added protocol_data and ui_data accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
28981
diff
changeset
|
348 | } |
|
c3df9b7a5160
Added protocol_data and ui_data accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
28981
diff
changeset
|
349 | |
|
c3df9b7a5160
Added protocol_data and ui_data accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
28981
diff
changeset
|
350 | void purple_whiteboard_set_ui_data(PurpleWhiteboard *wb, gpointer ui_data) |
|
c3df9b7a5160
Added protocol_data and ui_data accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
28981
diff
changeset
|
351 | { |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34939
diff
changeset
|
352 | g_return_if_fail(PURPLE_IS_WHITEBOARD(wb)); |
|
32282
c3df9b7a5160
Added protocol_data and ui_data accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
28981
diff
changeset
|
353 | |
|
c3df9b7a5160
Added protocol_data and ui_data accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
28981
diff
changeset
|
354 | wb->ui_data = ui_data; |
|
c3df9b7a5160
Added protocol_data and ui_data accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
28981
diff
changeset
|
355 | } |
|
c3df9b7a5160
Added protocol_data and ui_data accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
28981
diff
changeset
|
356 | |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
37119
diff
changeset
|
357 | gpointer purple_whiteboard_get_ui_data(PurpleWhiteboard *wb) |
|
32282
c3df9b7a5160
Added protocol_data and ui_data accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
28981
diff
changeset
|
358 | { |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34939
diff
changeset
|
359 | g_return_val_if_fail(PURPLE_IS_WHITEBOARD(wb), NULL); |
|
32282
c3df9b7a5160
Added protocol_data and ui_data accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
28981
diff
changeset
|
360 | |
|
c3df9b7a5160
Added protocol_data and ui_data accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
28981
diff
changeset
|
361 | return wb->ui_data; |
|
c3df9b7a5160
Added protocol_data and ui_data accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
28981
diff
changeset
|
362 | } |
|
34939
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
363 | |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
364 | /****************************************************************************** |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
365 | * GObject code |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
366 | *****************************************************************************/ |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
367 | /* Set method for GObject properties */ |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
368 | static void |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
369 | purple_whiteboard_set_property(GObject *obj, guint param_id, const GValue *value, |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
370 | GParamSpec *pspec) |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
371 | { |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
372 | PurpleWhiteboard *wb = PURPLE_WHITEBOARD(obj); |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
37119
diff
changeset
|
373 | PurpleWhiteboardPrivate *priv = |
|
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
37119
diff
changeset
|
374 | purple_whiteboard_get_instance_private(wb); |
|
34939
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
375 | |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
376 | switch (param_id) { |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
377 | case PROP_STATE: |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
378 | purple_whiteboard_set_state(wb, g_value_get_int(value)); |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
379 | break; |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
380 | case PROP_ACCOUNT: |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
381 | priv->account = g_value_get_object(value); |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
382 | break; |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
383 | case PROP_WHO: |
|
39423
6b457e717666
Use g_value_dup_string where needed.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39380
diff
changeset
|
384 | priv->who = g_value_dup_string(value); |
|
34939
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
385 | break; |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
386 | case PROP_DRAW_LIST: |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
387 | purple_whiteboard_set_draw_list(wb, g_value_get_pointer(value)); |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
388 | break; |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
389 | default: |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
390 | G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec); |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
391 | break; |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
392 | } |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
393 | } |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
394 | |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
395 | /* Get method for GObject properties */ |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
396 | static void |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
397 | purple_whiteboard_get_property(GObject *obj, guint param_id, GValue *value, |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
398 | GParamSpec *pspec) |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
399 | { |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
400 | PurpleWhiteboard *wb = PURPLE_WHITEBOARD(obj); |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
401 | |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
402 | switch (param_id) { |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
403 | case PROP_STATE: |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
404 | g_value_set_int(value, purple_whiteboard_get_state(wb)); |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
405 | break; |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
406 | case PROP_ACCOUNT: |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
407 | g_value_set_object(value, purple_whiteboard_get_account(wb)); |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
408 | break; |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
409 | case PROP_WHO: |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
410 | g_value_set_string(value, purple_whiteboard_get_who(wb)); |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
411 | break; |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
412 | case PROP_DRAW_LIST: |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
413 | g_value_set_pointer(value, purple_whiteboard_get_draw_list(wb)); |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
414 | break; |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
415 | default: |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
416 | G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec); |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
417 | break; |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
418 | } |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
419 | } |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
420 | |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
37119
diff
changeset
|
421 | static void |
|
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
37119
diff
changeset
|
422 | purple_whiteboard_init(PurpleWhiteboard *wb) |
|
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
37119
diff
changeset
|
423 | { |
|
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
37119
diff
changeset
|
424 | } |
|
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
37119
diff
changeset
|
425 | |
|
34939
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
426 | /* Called when done constructing */ |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
427 | static void |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
428 | purple_whiteboard_constructed(GObject *object) |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
429 | { |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
430 | PurpleWhiteboard *wb = PURPLE_WHITEBOARD(object); |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
37119
diff
changeset
|
431 | PurpleWhiteboardPrivate *priv = |
|
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
37119
diff
changeset
|
432 | purple_whiteboard_get_instance_private(wb); |
| 36693 | 433 | PurpleProtocol *protocol; |
|
34939
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
434 | |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
37119
diff
changeset
|
435 | G_OBJECT_CLASS(purple_whiteboard_parent_class)->constructed(object); |
|
34939
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
436 | |
| 36693 | 437 | protocol = purple_connection_get_protocol( |
| 438 | purple_account_get_connection(priv->account)); | |
| 439 | purple_whiteboard_set_protocol_ops(wb, | |
| 440 | purple_protocol_get_whiteboard_ops(protocol)); | |
|
34939
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
441 | |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
442 | /* Start up protocol specifics */ |
| 36693 | 443 | if(priv->protocol_ops && priv->protocol_ops->start) |
| 444 | priv->protocol_ops->start(wb); | |
|
34939
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
445 | |
|
35102
ef8014abe867
Rename a camel case var to not be camel case.
Mark Doliner <mark@kingant.net>
parents:
35097
diff
changeset
|
446 | wb_list = g_list_append(wb_list, wb); |
|
34939
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
447 | } |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
448 | |
|
34986
894c29e33300
Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents:
34983
diff
changeset
|
449 | /* GObject finalize function */ |
|
34939
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
450 | static void |
|
34986
894c29e33300
Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents:
34983
diff
changeset
|
451 | purple_whiteboard_finalize(GObject *object) |
|
34939
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
452 | { |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
453 | PurpleWhiteboard *wb = PURPLE_WHITEBOARD(object); |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
37119
diff
changeset
|
454 | PurpleWhiteboardPrivate *priv = |
|
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
37119
diff
changeset
|
455 | purple_whiteboard_get_instance_private(wb); |
|
34939
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
456 | |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
457 | if(wb->ui_data) |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
458 | { |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
459 | /* Destroy frontend */ |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
460 | if(whiteboard_ui_ops && whiteboard_ui_ops->destroy) |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
461 | whiteboard_ui_ops->destroy(wb); |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
462 | } |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
463 | |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
464 | /* Do protocol specific session ending procedures */ |
| 36693 | 465 | if(priv->protocol_ops && priv->protocol_ops->end) |
| 466 | priv->protocol_ops->end(wb); | |
|
34939
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
467 | |
|
35102
ef8014abe867
Rename a camel case var to not be camel case.
Mark Doliner <mark@kingant.net>
parents:
35097
diff
changeset
|
468 | wb_list = g_list_remove(wb_list, wb); |
|
34939
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
469 | |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
470 | g_free(priv->who); |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
471 | |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
37119
diff
changeset
|
472 | G_OBJECT_CLASS(purple_whiteboard_parent_class)->finalize(object); |
|
34939
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
473 | } |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
474 | |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
475 | /* Class initializer function */ |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
476 | static void |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
477 | purple_whiteboard_class_init(PurpleWhiteboardClass *klass) |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
478 | { |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
479 | GObjectClass *obj_class = G_OBJECT_CLASS(klass); |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
480 | |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
481 | obj_class->finalize = purple_whiteboard_finalize; |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
482 | obj_class->constructed = purple_whiteboard_constructed; |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
483 | |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
484 | /* Setup properties */ |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
485 | obj_class->get_property = purple_whiteboard_get_property; |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
486 | obj_class->set_property = purple_whiteboard_set_property; |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
487 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
488 | properties[PROP_STATE] = g_param_spec_int("state", "State", |
|
35058
506740af931c
Unmark property names and blurbs from translatable to non-translatable
Ankit Vani <a@nevitus.org>
parents:
35013
diff
changeset
|
489 | "State of the whiteboard.", |
|
34939
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
490 | G_MININT, G_MAXINT, 0, |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
491 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS); |
|
34939
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
492 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
493 | properties[PROP_ACCOUNT] = g_param_spec_object("account", "Account", |
|
35058
506740af931c
Unmark property names and blurbs from translatable to non-translatable
Ankit Vani <a@nevitus.org>
parents:
35013
diff
changeset
|
494 | "The whiteboard's account.", PURPLE_TYPE_ACCOUNT, |
|
35066
f997e5384f79
libpurple: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents:
35058
diff
changeset
|
495 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
496 | G_PARAM_STATIC_STRINGS); |
|
34939
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
497 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
498 | properties[PROP_WHO] = g_param_spec_string("who", "Who", |
|
35058
506740af931c
Unmark property names and blurbs from translatable to non-translatable
Ankit Vani <a@nevitus.org>
parents:
35013
diff
changeset
|
499 | "Who you're drawing with.", NULL, |
|
35066
f997e5384f79
libpurple: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents:
35058
diff
changeset
|
500 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
501 | G_PARAM_STATIC_STRINGS); |
|
34939
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
502 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
503 | properties[PROP_DRAW_LIST] = g_param_spec_pointer("draw-list", "Draw list", |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
504 | "A list of points to draw to the buddy.", |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
505 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); |
|
34939
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
506 | |
|
35085
abab0adfa0ec
libpurple: use g_object_class_install_properties instead of repeated g_object_class_install_property
Ankit Vani <a@nevitus.org>
parents:
35080
diff
changeset
|
507 | g_object_class_install_properties(obj_class, PROP_LAST, properties); |
|
34939
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
508 | } |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
509 | |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
510 | PurpleWhiteboard *purple_whiteboard_new(PurpleAccount *account, const char *who, int state) |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
511 | { |
|
36728
313d07370a7b
Use the protocol factory interface functions
Ankit Vani <a@nevitus.org>
parents:
36710
diff
changeset
|
512 | PurpleWhiteboard *wb; |
|
313d07370a7b
Use the protocol factory interface functions
Ankit Vani <a@nevitus.org>
parents:
36710
diff
changeset
|
513 | PurpleProtocol *protocol; |
|
313d07370a7b
Use the protocol factory interface functions
Ankit Vani <a@nevitus.org>
parents:
36710
diff
changeset
|
514 | |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34939
diff
changeset
|
515 | g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL); |
|
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34939
diff
changeset
|
516 | g_return_val_if_fail(who != NULL, NULL); |
|
34939
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
517 | |
|
36728
313d07370a7b
Use the protocol factory interface functions
Ankit Vani <a@nevitus.org>
parents:
36710
diff
changeset
|
518 | protocol = purple_protocols_find(purple_account_get_protocol_id(account)); |
|
313d07370a7b
Use the protocol factory interface functions
Ankit Vani <a@nevitus.org>
parents:
36710
diff
changeset
|
519 | |
|
36844
b62140058cd3
Check for valid PurpleProtocols
Ankit Vani <a@nevitus.org>
parents:
36843
diff
changeset
|
520 | g_return_val_if_fail(PURPLE_IS_PROTOCOL(protocol), NULL); |
|
36728
313d07370a7b
Use the protocol factory interface functions
Ankit Vani <a@nevitus.org>
parents:
36710
diff
changeset
|
521 | |
|
39759
ea1401483849
Rename *_GET_*_IFACE to more standard *_GET_IFACE.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39593
diff
changeset
|
522 | if (PURPLE_PROTOCOL_IMPLEMENTS(protocol, FACTORY, whiteboard_new)) |
|
36728
313d07370a7b
Use the protocol factory interface functions
Ankit Vani <a@nevitus.org>
parents:
36710
diff
changeset
|
523 | wb = purple_protocol_factory_iface_whiteboard_new(protocol, account, |
|
313d07370a7b
Use the protocol factory interface functions
Ankit Vani <a@nevitus.org>
parents:
36710
diff
changeset
|
524 | who, state); |
|
313d07370a7b
Use the protocol factory interface functions
Ankit Vani <a@nevitus.org>
parents:
36710
diff
changeset
|
525 | else |
|
313d07370a7b
Use the protocol factory interface functions
Ankit Vani <a@nevitus.org>
parents:
36710
diff
changeset
|
526 | wb = g_object_new(PURPLE_TYPE_WHITEBOARD, |
| 36872 | 527 | "account", account, |
| 528 | "who", who, | |
| 529 | "state", state, | |
|
36728
313d07370a7b
Use the protocol factory interface functions
Ankit Vani <a@nevitus.org>
parents:
36710
diff
changeset
|
530 | NULL |
|
313d07370a7b
Use the protocol factory interface functions
Ankit Vani <a@nevitus.org>
parents:
36710
diff
changeset
|
531 | ); |
|
313d07370a7b
Use the protocol factory interface functions
Ankit Vani <a@nevitus.org>
parents:
36710
diff
changeset
|
532 | |
|
313d07370a7b
Use the protocol factory interface functions
Ankit Vani <a@nevitus.org>
parents:
36710
diff
changeset
|
533 | g_return_val_if_fail(wb != NULL, NULL); |
|
313d07370a7b
Use the protocol factory interface functions
Ankit Vani <a@nevitus.org>
parents:
36710
diff
changeset
|
534 | |
|
313d07370a7b
Use the protocol factory interface functions
Ankit Vani <a@nevitus.org>
parents:
36710
diff
changeset
|
535 | return wb; |
|
34939
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
536 | } |