Sat, 07 Sep 2013 02:30:39 +0530
Added GObject code to whiteboard.c
| 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" |
| 11475 | 25 | #include "whiteboard.h" |
| 26 | #include "prpl.h" | |
| 27 | ||
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
28 | #define PURPLE_WHITEBOARD_GET_PRIVATE(obj) \ |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
29 | (G_TYPE_INSTANCE_GET_PRIVATE((obj), PURPLE_TYPE_WHITEBOARD, PurpleWhiteboardPrivate)) |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
30 | |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
31 | /** @copydoc _PurpleWhiteboardPrivate */ |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
32 | typedef struct _PurpleWhiteboardPrivate PurpleWhiteboardPrivate; |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
33 | |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
34 | /** Private data for a whiteboard */ |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
35 | struct _PurpleWhiteboardPrivate |
|
32708
e275f5e7b257
Hide struct PurpleWhiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32285
diff
changeset
|
36 | { |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
37 | int state; /**< State of whiteboard session */ |
|
32708
e275f5e7b257
Hide struct PurpleWhiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32285
diff
changeset
|
38 | |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
39 | PurpleAccount *account; /**< Account associated with this session */ |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
40 | char *who; /**< Name of the remote user */ |
|
32708
e275f5e7b257
Hide struct PurpleWhiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32285
diff
changeset
|
41 | |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
42 | void *proto_data; /**< Protocol specific data |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
43 | TODO Remove this, and use |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
44 | protocol-specific subclasses */ |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
45 | PurpleWhiteboardPrplOps *prpl_ops; /**< Protocol-plugin operations */ |
|
32708
e275f5e7b257
Hide struct PurpleWhiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32285
diff
changeset
|
46 | |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
47 | GList *draw_list; /**< List of drawing elements/deltas to |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
48 | send */ |
|
32708
e275f5e7b257
Hide struct PurpleWhiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32285
diff
changeset
|
49 | }; |
|
e275f5e7b257
Hide struct PurpleWhiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32285
diff
changeset
|
50 | |
|
34939
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
51 | /* GObject Property enums */ |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
52 | enum |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
53 | { |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
54 | PROP_0, |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
55 | PROP_STATE, |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
56 | PROP_ACCOUNT, |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
57 | PROP_WHO, |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
58 | PROP_DRAW_LIST, |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
59 | PROP_LAST |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
60 | }; |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
61 | |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
62 | /****************************************************************************** |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
63 | * Globals |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
64 | *****************************************************************************/ |
|
34939
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
65 | static GObjectClass *parent_class; |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
66 | |
| 15884 | 67 | static PurpleWhiteboardUiOps *whiteboard_ui_ops = NULL; |
| 68 | /* static PurpleWhiteboardPrplOps *whiteboard_prpl_ops = NULL; */ | |
| 11475 | 69 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
70 | static GList *wbList = NULL; |
| 11475 | 71 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
72 | /*static gboolean auto_accept = TRUE; */ |
| 11475 | 73 | |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
74 | /****************************************************************************** |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
75 | * API |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
76 | *****************************************************************************/ |
| 15884 | 77 | void purple_whiteboard_set_ui_ops(PurpleWhiteboardUiOps *ops) |
| 11475 | 78 | { |
| 79 | whiteboard_ui_ops = ops; | |
| 80 | } | |
| 81 | ||
| 15884 | 82 | void purple_whiteboard_set_prpl_ops(PurpleWhiteboard *wb, PurpleWhiteboardPrplOps *ops) |
| 11475 | 83 | { |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
84 | PurpleWhiteboardPrivate *priv = PURPLE_WHITEBOARD_GET_PRIVATE(wb); |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
85 | |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
86 | g_return_if_fail(priv != NULL); |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
87 | |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
88 | priv->prpl_ops = ops; |
| 11475 | 89 | } |
| 90 | ||
|
32285
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
91 | PurpleAccount *purple_whiteboard_get_account(const PurpleWhiteboard *wb) |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
92 | { |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
93 | PurpleWhiteboardPrivate *priv = PURPLE_WHITEBOARD_GET_PRIVATE(wb); |
|
32285
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
94 | |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
95 | g_return_val_if_fail(priv != NULL, NULL); |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
96 | |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
97 | return priv->account; |
|
32285
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
98 | } |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
99 | |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
100 | const char *purple_whiteboard_get_who(const PurpleWhiteboard *wb) |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
101 | { |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
102 | PurpleWhiteboardPrivate *priv = PURPLE_WHITEBOARD_GET_PRIVATE(wb); |
|
32285
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
103 | |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
104 | g_return_val_if_fail(priv != NULL, NULL); |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
105 | |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
106 | return priv->who; |
|
32285
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
107 | } |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
108 | |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
109 | 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
|
110 | { |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
111 | PurpleWhiteboardPrivate *priv = PURPLE_WHITEBOARD_GET_PRIVATE(wb); |
|
32285
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
112 | |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
113 | g_return_if_fail(priv != NULL); |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
114 | |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
115 | priv->state = state; |
|
32285
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
116 | } |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
117 | |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
118 | int purple_whiteboard_get_state(const PurpleWhiteboard *wb) |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
119 | { |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
120 | PurpleWhiteboardPrivate *priv = PURPLE_WHITEBOARD_GET_PRIVATE(wb); |
|
32285
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
121 | |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
122 | g_return_val_if_fail(priv != NULL, -1); |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
123 | |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
124 | return priv->state; |
|
32285
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
125 | } |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
126 | |
| 15884 | 127 | void purple_whiteboard_start(PurpleWhiteboard *wb) |
| 11475 | 128 | { |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
129 | /* Create frontend for whiteboard */ |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
130 | if(whiteboard_ui_ops && whiteboard_ui_ops->create) |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
131 | whiteboard_ui_ops->create(wb); |
| 11475 | 132 | } |
| 133 | ||
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
134 | /* 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
|
135 | * usernames 'me' and 'who'. Returns a pointer to a matching whiteboard |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
136 | * session; if none match, it returns NULL. |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
137 | */ |
| 15884 | 138 | PurpleWhiteboard *purple_whiteboard_get_session(const PurpleAccount *account, const char *who) |
| 11475 | 139 | { |
| 15884 | 140 | PurpleWhiteboard *wb; |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
141 | PurpleWhiteboardPrivate *priv; |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
142 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
143 | GList *l = wbList; |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
144 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
145 | /* 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
|
146 | */ |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
147 | while(l != NULL) |
| 11475 | 148 | { |
| 149 | wb = l->data; | |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
150 | priv = PURPLE_WHITEBOARD_GET_PRIVATE(wb); |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
151 | |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
152 | if(priv->account == account && purple_strequal(priv->who, who)) |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
153 | return wb; |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
154 | |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
155 | l = l->next; |
| 11475 | 156 | } |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
157 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
158 | return NULL; |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
159 | } |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
160 | |
| 15884 | 161 | void purple_whiteboard_draw_list_destroy(GList *draw_list) |
|
12022
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
162 | { |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
13419
diff
changeset
|
163 | g_list_free(draw_list); |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
164 | } |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
165 | |
| 15884 | 166 | gboolean purple_whiteboard_get_dimensions(const PurpleWhiteboard *wb, int *width, int *height) |
|
12022
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
167 | { |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
168 | PurpleWhiteboardPrivate *priv = PURPLE_WHITEBOARD_GET_PRIVATE(wb); |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
169 | PurpleWhiteboardPrplOps *prpl_ops; |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
170 | |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
171 | g_return_val_if_fail(priv != NULL, FALSE); |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
172 | |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
173 | prpl_ops = priv->prpl_ops; |
|
12022
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
174 | |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
175 | if (prpl_ops && prpl_ops->get_dimensions) |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
176 | { |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
177 | prpl_ops->get_dimensions(wb, width, height); |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
178 | return TRUE; |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
179 | } |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
180 | |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
181 | return FALSE; |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
182 | } |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
183 | |
| 15884 | 184 | 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
|
185 | { |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
186 | if(whiteboard_ui_ops && whiteboard_ui_ops->set_dimensions) |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
187 | whiteboard_ui_ops->set_dimensions(wb, width, height); |
| 11475 | 188 | } |
| 189 | ||
| 15884 | 190 | 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
|
191 | { |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
192 | PurpleWhiteboardPrivate *priv = PURPLE_WHITEBOARD_GET_PRIVATE(wb); |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
193 | PurpleWhiteboardPrplOps *prpl_ops; |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
194 | |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
195 | g_return_if_fail(priv != NULL); |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
196 | |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
197 | prpl_ops = priv->prpl_ops; |
|
12022
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
198 | |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
199 | if (prpl_ops && prpl_ops->send_draw_list) |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
200 | prpl_ops->send_draw_list(wb, list); |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
201 | } |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
202 | |
| 15884 | 203 | void purple_whiteboard_draw_point(PurpleWhiteboard *wb, int x, int y, int color, int size) |
| 11475 | 204 | { |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
205 | if(whiteboard_ui_ops && whiteboard_ui_ops->draw_point) |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
206 | whiteboard_ui_ops->draw_point(wb, x, y, color, size); |
| 11475 | 207 | } |
| 208 | ||
| 15884 | 209 | void purple_whiteboard_draw_line(PurpleWhiteboard *wb, int x1, int y1, int x2, int y2, int color, int size) |
| 11475 | 210 | { |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
211 | if(whiteboard_ui_ops && whiteboard_ui_ops->draw_line) |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
212 | whiteboard_ui_ops->draw_line(wb, x1, y1, x2, y2, color, size); |
| 11475 | 213 | } |
| 214 | ||
| 15884 | 215 | void purple_whiteboard_clear(PurpleWhiteboard *wb) |
| 11475 | 216 | { |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
217 | if(whiteboard_ui_ops && whiteboard_ui_ops->clear) |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
218 | whiteboard_ui_ops->clear(wb); |
| 11475 | 219 | } |
| 220 | ||
| 15884 | 221 | void purple_whiteboard_send_clear(PurpleWhiteboard *wb) |
|
12022
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
222 | { |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
223 | PurpleWhiteboardPrivate *priv = PURPLE_WHITEBOARD_GET_PRIVATE(wb); |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
224 | PurpleWhiteboardPrplOps *prpl_ops; |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
225 | |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
226 | g_return_if_fail(priv != NULL); |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
227 | |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
228 | prpl_ops = priv->prpl_ops; |
|
12022
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
229 | |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
230 | if (prpl_ops && prpl_ops->clear) |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
231 | prpl_ops->clear(wb); |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
232 | } |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
233 | |
| 15884 | 234 | 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
|
235 | { |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
236 | PurpleWhiteboardPrivate *priv = PURPLE_WHITEBOARD_GET_PRIVATE(wb); |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
237 | PurpleWhiteboardPrplOps *prpl_ops; |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
238 | |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
239 | g_return_if_fail(priv != NULL); |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
240 | |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
241 | prpl_ops = priv->prpl_ops; |
|
12022
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
242 | |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
243 | if (prpl_ops && prpl_ops->set_brush) |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
244 | prpl_ops->set_brush(wb, size, color); |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
245 | } |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
246 | |
| 15884 | 247 | gboolean purple_whiteboard_get_brush(const PurpleWhiteboard *wb, int *size, int *color) |
|
12022
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
248 | { |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
249 | PurpleWhiteboardPrivate *priv = PURPLE_WHITEBOARD_GET_PRIVATE(wb); |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
250 | PurpleWhiteboardPrplOps *prpl_ops; |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
251 | |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
252 | g_return_val_if_fail(priv != NULL, FALSE); |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
253 | |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
254 | prpl_ops = priv->prpl_ops; |
|
12022
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
255 | |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
256 | if (prpl_ops && prpl_ops->get_brush) |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
257 | { |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
258 | prpl_ops->get_brush(wb, size, color); |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
259 | return TRUE; |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
260 | } |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
261 | return FALSE; |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
262 | } |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
263 | |
| 15884 | 264 | 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
|
265 | { |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
266 | if (whiteboard_ui_ops && whiteboard_ui_ops->set_brush) |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
267 | whiteboard_ui_ops->set_brush(wb, size, color); |
|
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 | |
|
32285
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
270 | GList *purple_whiteboard_get_draw_list(const PurpleWhiteboard *wb) |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
271 | { |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
272 | PurpleWhiteboardPrivate *priv = PURPLE_WHITEBOARD_GET_PRIVATE(wb); |
|
32285
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
273 | |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
274 | g_return_val_if_fail(priv != NULL, NULL); |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
275 | |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
276 | return priv->draw_list; |
|
32285
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
277 | } |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
278 | |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
279 | 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
|
280 | { |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
281 | PurpleWhiteboardPrivate *priv = PURPLE_WHITEBOARD_GET_PRIVATE(wb); |
|
32285
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
282 | |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
283 | g_return_if_fail(priv != NULL); |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
284 | |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
285 | priv->draw_list = draw_list; |
|
32285
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
286 | } |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
287 | |
|
32282
c3df9b7a5160
Added protocol_data and ui_data accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
28981
diff
changeset
|
288 | 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
|
289 | { |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
290 | PurpleWhiteboardPrivate *priv = PURPLE_WHITEBOARD_GET_PRIVATE(wb); |
|
32282
c3df9b7a5160
Added protocol_data and ui_data accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
28981
diff
changeset
|
291 | |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
292 | g_return_if_fail(priv != NULL); |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
293 | |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
294 | 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
|
295 | } |
|
c3df9b7a5160
Added protocol_data and ui_data accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
28981
diff
changeset
|
296 | |
|
c3df9b7a5160
Added protocol_data and ui_data accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
28981
diff
changeset
|
297 | gpointer purple_whiteboard_get_protocol_data(const PurpleWhiteboard *wb) |
|
c3df9b7a5160
Added protocol_data and ui_data accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
28981
diff
changeset
|
298 | { |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
299 | PurpleWhiteboardPrivate *priv = PURPLE_WHITEBOARD_GET_PRIVATE(wb); |
|
32282
c3df9b7a5160
Added protocol_data and ui_data accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
28981
diff
changeset
|
300 | |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
301 | g_return_val_if_fail(priv != NULL, NULL); |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
302 | |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
303 | 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
|
304 | } |
|
c3df9b7a5160
Added protocol_data and ui_data accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
28981
diff
changeset
|
305 | |
|
c3df9b7a5160
Added protocol_data and ui_data accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
28981
diff
changeset
|
306 | 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
|
307 | { |
|
c3df9b7a5160
Added protocol_data and ui_data accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
28981
diff
changeset
|
308 | g_return_if_fail(wb != NULL); |
|
c3df9b7a5160
Added protocol_data and ui_data accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
28981
diff
changeset
|
309 | |
|
c3df9b7a5160
Added protocol_data and ui_data accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
28981
diff
changeset
|
310 | 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
|
311 | } |
|
c3df9b7a5160
Added protocol_data and ui_data accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
28981
diff
changeset
|
312 | |
|
c3df9b7a5160
Added protocol_data and ui_data accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
28981
diff
changeset
|
313 | gpointer purple_whiteboard_get_ui_data(const PurpleWhiteboard *wb) |
|
c3df9b7a5160
Added protocol_data and ui_data accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
28981
diff
changeset
|
314 | { |
|
c3df9b7a5160
Added protocol_data and ui_data accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
28981
diff
changeset
|
315 | g_return_val_if_fail(wb != NULL, NULL); |
|
c3df9b7a5160
Added protocol_data and ui_data accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
28981
diff
changeset
|
316 | |
|
c3df9b7a5160
Added protocol_data and ui_data accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
28981
diff
changeset
|
317 | 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
|
318 | } |
|
34939
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
319 | |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
320 | /****************************************************************************** |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
321 | * GObject code |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
322 | *****************************************************************************/ |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
323 | /* GObject Property names */ |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
324 | #define PROP_STATE_S "state" |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
325 | #define PROP_ACCOUNT_S "account" |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
326 | #define PROP_WHO_S "who" |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
327 | #define PROP_DRAW_LIST_S "draw-list" |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
328 | |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
329 | /* Set method for GObject properties */ |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
330 | static void |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
331 | 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
|
332 | GParamSpec *pspec) |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
333 | { |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
334 | PurpleWhiteboard *wb = PURPLE_WHITEBOARD(obj); |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
335 | PurpleWhiteboardPrivate *priv = PURPLE_WHITEBOARD_GET_PRIVATE(wb); |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
336 | |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
337 | switch (param_id) { |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
338 | case PROP_STATE: |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
339 | 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
|
340 | break; |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
341 | case PROP_ACCOUNT: |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
342 | priv->account = g_value_get_object(value); |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
343 | break; |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
344 | case PROP_WHO: |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
345 | priv->who = g_strdup(g_value_get_string(value)); |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
346 | break; |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
347 | case PROP_DRAW_LIST: |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
348 | 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
|
349 | break; |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
350 | default: |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
351 | 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
|
352 | break; |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
353 | } |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
354 | } |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
355 | |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
356 | /* Get method for GObject properties */ |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
357 | static void |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
358 | 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
|
359 | GParamSpec *pspec) |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
360 | { |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
361 | PurpleWhiteboard *wb = PURPLE_WHITEBOARD(obj); |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
362 | |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
363 | switch (param_id) { |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
364 | case PROP_STATE: |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
365 | 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
|
366 | break; |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
367 | case PROP_ACCOUNT: |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
368 | 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
|
369 | break; |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
370 | case PROP_WHO: |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
371 | 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
|
372 | break; |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
373 | case PROP_DRAW_LIST: |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
374 | 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
|
375 | break; |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
376 | default: |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
377 | 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
|
378 | break; |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
379 | } |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
380 | } |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
381 | |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
382 | /* Called when done constructing */ |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
383 | static void |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
384 | purple_whiteboard_constructed(GObject *object) |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
385 | { |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
386 | PurpleWhiteboard *wb = PURPLE_WHITEBOARD(object); |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
387 | PurpleWhiteboardPrivate *priv = PURPLE_WHITEBOARD_GET_PRIVATE(wb); |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
388 | PurplePluginProtocolInfo *prpl_info; |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
389 | |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
390 | parent_class->constructed(object); |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
391 | |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
392 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl( |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
393 | purple_account_get_connection(priv->account))); |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
394 | purple_whiteboard_set_prpl_ops(wb, prpl_info->whiteboard_prpl_ops); |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
395 | |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
396 | /* Start up protocol specifics */ |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
397 | if(priv->prpl_ops && priv->prpl_ops->start) |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
398 | priv->prpl_ops->start(wb); |
|
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 | wbList = g_list_append(wbList, wb); |
|
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 | |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
403 | /* GObject dispose function */ |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
404 | static void |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
405 | purple_whiteboard_dispose(GObject *object) |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
406 | { |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
407 | PurpleWhiteboard *wb = PURPLE_WHITEBOARD(object); |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
408 | PurpleWhiteboardPrivate *priv = PURPLE_WHITEBOARD_GET_PRIVATE(wb); |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
409 | |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
410 | if(wb->ui_data) |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
411 | { |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
412 | /* Destroy frontend */ |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
413 | if(whiteboard_ui_ops && whiteboard_ui_ops->destroy) |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
414 | whiteboard_ui_ops->destroy(wb); |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
415 | } |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
416 | |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
417 | /* Do protocol specific session ending procedures */ |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
418 | if(priv->prpl_ops && priv->prpl_ops->end) |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
419 | priv->prpl_ops->end(wb); |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
420 | |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
421 | wbList = g_list_remove(wbList, wb); |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
422 | |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
423 | parent_class->dispose(object); |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
424 | } |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
425 | |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
426 | /* GObject finalize function */ |
|
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_finalize(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 | PurpleWhiteboardPrivate *priv = PURPLE_WHITEBOARD_GET_PRIVATE(object); |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
431 | |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
432 | g_free(priv->who); |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
433 | |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
434 | parent_class->finalize(object); |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
435 | } |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
436 | |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
437 | /* Class initializer function */ |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
438 | static void |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
439 | purple_whiteboard_class_init(PurpleWhiteboardClass *klass) |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
440 | { |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
441 | GObjectClass *obj_class = G_OBJECT_CLASS(klass); |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
442 | |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
443 | parent_class = g_type_class_peek_parent(klass); |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
444 | |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
445 | obj_class->dispose = purple_whiteboard_dispose; |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
446 | obj_class->finalize = purple_whiteboard_finalize; |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
447 | obj_class->constructed = purple_whiteboard_constructed; |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
448 | |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
449 | /* Setup properties */ |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
450 | obj_class->get_property = purple_whiteboard_get_property; |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
451 | obj_class->set_property = purple_whiteboard_set_property; |
|
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 | g_object_class_install_property(obj_class, PROP_STATE, |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
454 | g_param_spec_int(PROP_STATE_S, _("State"), |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
455 | _("State of the whiteboard."), |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
456 | G_MININT, G_MAXINT, 0, |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
457 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT) |
|
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 | |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
460 | g_object_class_install_property(obj_class, PROP_ACCOUNT, |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
461 | g_param_spec_object(PROP_ACCOUNT_S, _("Account"), |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
462 | _("The whiteboard's account."), PURPLE_TYPE_ACCOUNT, |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
463 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY) |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
464 | ); |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
465 | |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
466 | g_object_class_install_property(obj_class, PROP_WHO, |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
467 | g_param_spec_string(PROP_WHO_S, _("Who"), |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
468 | _("Who you're drawing with."), NULL, |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
469 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY) |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
470 | ); |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
471 | |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
472 | g_object_class_install_property(obj_class, PROP_DRAW_LIST, |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
473 | g_param_spec_pointer(PROP_DRAW_LIST_S, _("Draw list"), |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
474 | _("A list of points to draw to the buddy."), |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
475 | G_PARAM_READWRITE) |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
476 | ); |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
477 | |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
478 | g_type_class_add_private(klass, sizeof(PurpleWhiteboardPrivate)); |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
479 | } |
|
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 | GType |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
482 | purple_whiteboard_get_type(void) |
|
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 | static GType type = 0; |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
485 | |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
486 | if(type == 0) { |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
487 | static const GTypeInfo info = { |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
488 | sizeof(PurpleWhiteboardClass), |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
489 | NULL, |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
490 | NULL, |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
491 | (GClassInitFunc)purple_whiteboard_class_init, |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
492 | NULL, |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
493 | NULL, |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
494 | sizeof(PurpleWhiteboard), |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
495 | 0, |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
496 | NULL, |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
497 | NULL, |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
498 | }; |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
499 | |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
500 | type = g_type_register_static(G_TYPE_OBJECT, "PurpleWhiteboard", |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
501 | &info, 0); |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
502 | } |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
503 | |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
504 | return type; |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
505 | } |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
506 | |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
507 | 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
|
508 | { |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
509 | g_return_val_if_fail(account != NULL, NULL); |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
510 | g_return_val_if_fail(who != NULL, NULL); |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
511 | |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
512 | return g_object_new(PURPLE_TYPE_WHITEBOARD, |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
513 | PROP_ACCOUNT_S, account, |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
514 | PROP_WHO_S, who, |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
515 | PROP_STATE_S, state, |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
516 | NULL |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
517 | ); |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
518 | } |