Fri, 11 Oct 2013 15:31:04 +0530
Cleaned up properties and added g_object_notify calls for everything else
| 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; |
|
35013
4718438d053b
Cleaned up properties and added g_object_notify calls for everything else
Ankit Vani <a@nevitus.org>
parents:
34986
diff
changeset
|
116 | |
|
4718438d053b
Cleaned up properties and added g_object_notify calls for everything else
Ankit Vani <a@nevitus.org>
parents:
34986
diff
changeset
|
117 | g_object_notify(G_OBJECT(wb), "state"); |
|
32285
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
118 | } |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
119 | |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
120 | 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
|
121 | { |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
122 | 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
|
123 | |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
124 | g_return_val_if_fail(priv != NULL, -1); |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
125 | |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
126 | return priv->state; |
|
32285
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
127 | } |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
128 | |
| 15884 | 129 | void purple_whiteboard_start(PurpleWhiteboard *wb) |
| 11475 | 130 | { |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
131 | /* Create frontend for whiteboard */ |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
132 | if(whiteboard_ui_ops && whiteboard_ui_ops->create) |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
133 | whiteboard_ui_ops->create(wb); |
| 11475 | 134 | } |
| 135 | ||
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
136 | /* 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
|
137 | * usernames 'me' and 'who'. Returns a pointer to a matching whiteboard |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
138 | * session; if none match, it returns NULL. |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
139 | */ |
| 15884 | 140 | PurpleWhiteboard *purple_whiteboard_get_session(const PurpleAccount *account, const char *who) |
| 11475 | 141 | { |
| 15884 | 142 | PurpleWhiteboard *wb; |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
143 | PurpleWhiteboardPrivate *priv; |
|
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 | GList *l = wbList; |
|
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 | /* 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
|
148 | */ |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
149 | while(l != NULL) |
| 11475 | 150 | { |
| 151 | wb = l->data; | |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
152 | priv = PURPLE_WHITEBOARD_GET_PRIVATE(wb); |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
153 | |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
154 | if(priv->account == account && purple_strequal(priv->who, who)) |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
155 | return wb; |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
156 | |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
157 | l = l->next; |
| 11475 | 158 | } |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
159 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
160 | return NULL; |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
161 | } |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
162 | |
| 15884 | 163 | void purple_whiteboard_draw_list_destroy(GList *draw_list) |
|
12022
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
164 | { |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
13419
diff
changeset
|
165 | g_list_free(draw_list); |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
166 | } |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
167 | |
| 15884 | 168 | 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
|
169 | { |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
170 | PurpleWhiteboardPrivate *priv = PURPLE_WHITEBOARD_GET_PRIVATE(wb); |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
171 | PurpleWhiteboardPrplOps *prpl_ops; |
|
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 | g_return_val_if_fail(priv != NULL, FALSE); |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
174 | |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
175 | prpl_ops = priv->prpl_ops; |
|
12022
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 | if (prpl_ops && prpl_ops->get_dimensions) |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
178 | { |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
179 | prpl_ops->get_dimensions(wb, width, height); |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
180 | return TRUE; |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
181 | } |
|
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 | return FALSE; |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
184 | } |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
185 | |
| 15884 | 186 | 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
|
187 | { |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
188 | if(whiteboard_ui_ops && whiteboard_ui_ops->set_dimensions) |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
189 | whiteboard_ui_ops->set_dimensions(wb, width, height); |
| 11475 | 190 | } |
| 191 | ||
| 15884 | 192 | 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
|
193 | { |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
194 | PurpleWhiteboardPrivate *priv = PURPLE_WHITEBOARD_GET_PRIVATE(wb); |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
195 | PurpleWhiteboardPrplOps *prpl_ops; |
|
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 | g_return_if_fail(priv != NULL); |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
198 | |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
199 | prpl_ops = priv->prpl_ops; |
|
12022
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
200 | |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
201 | if (prpl_ops && prpl_ops->send_draw_list) |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
202 | prpl_ops->send_draw_list(wb, list); |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
203 | } |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
204 | |
| 15884 | 205 | void purple_whiteboard_draw_point(PurpleWhiteboard *wb, int x, int y, int color, int size) |
| 11475 | 206 | { |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
207 | if(whiteboard_ui_ops && whiteboard_ui_ops->draw_point) |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
208 | whiteboard_ui_ops->draw_point(wb, x, y, color, size); |
| 11475 | 209 | } |
| 210 | ||
| 15884 | 211 | void purple_whiteboard_draw_line(PurpleWhiteboard *wb, int x1, int y1, int x2, int y2, int color, int size) |
| 11475 | 212 | { |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
213 | if(whiteboard_ui_ops && whiteboard_ui_ops->draw_line) |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
214 | whiteboard_ui_ops->draw_line(wb, x1, y1, x2, y2, color, size); |
| 11475 | 215 | } |
| 216 | ||
| 15884 | 217 | void purple_whiteboard_clear(PurpleWhiteboard *wb) |
| 11475 | 218 | { |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
219 | if(whiteboard_ui_ops && whiteboard_ui_ops->clear) |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
220 | whiteboard_ui_ops->clear(wb); |
| 11475 | 221 | } |
| 222 | ||
| 15884 | 223 | void purple_whiteboard_send_clear(PurpleWhiteboard *wb) |
|
12022
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
224 | { |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
225 | PurpleWhiteboardPrivate *priv = PURPLE_WHITEBOARD_GET_PRIVATE(wb); |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
226 | PurpleWhiteboardPrplOps *prpl_ops; |
|
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 | g_return_if_fail(priv != NULL); |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
229 | |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
230 | prpl_ops = priv->prpl_ops; |
|
12022
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
231 | |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
232 | if (prpl_ops && prpl_ops->clear) |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
233 | prpl_ops->clear(wb); |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
234 | } |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
235 | |
| 15884 | 236 | 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
|
237 | { |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
238 | PurpleWhiteboardPrivate *priv = PURPLE_WHITEBOARD_GET_PRIVATE(wb); |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
239 | PurpleWhiteboardPrplOps *prpl_ops; |
|
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 | g_return_if_fail(priv != NULL); |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
242 | |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
243 | prpl_ops = priv->prpl_ops; |
|
12022
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
244 | |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
245 | if (prpl_ops && prpl_ops->set_brush) |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
246 | prpl_ops->set_brush(wb, size, color); |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
247 | } |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
248 | |
| 15884 | 249 | 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
|
250 | { |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
251 | PurpleWhiteboardPrivate *priv = PURPLE_WHITEBOARD_GET_PRIVATE(wb); |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
252 | PurpleWhiteboardPrplOps *prpl_ops; |
|
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 | g_return_val_if_fail(priv != NULL, FALSE); |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
255 | |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
256 | prpl_ops = priv->prpl_ops; |
|
12022
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 | if (prpl_ops && prpl_ops->get_brush) |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
259 | { |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
260 | prpl_ops->get_brush(wb, size, color); |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
261 | return TRUE; |
|
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 | return FALSE; |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
264 | } |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
265 | |
| 15884 | 266 | 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
|
267 | { |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
268 | if (whiteboard_ui_ops && whiteboard_ui_ops->set_brush) |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
269 | whiteboard_ui_ops->set_brush(wb, size, color); |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
270 | } |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
271 | |
|
32285
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
272 | 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
|
273 | { |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
274 | 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
|
275 | |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
276 | g_return_val_if_fail(priv != NULL, NULL); |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
277 | |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
278 | return priv->draw_list; |
|
32285
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
279 | } |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
280 | |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
281 | 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
|
282 | { |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
283 | 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
|
284 | |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
285 | g_return_if_fail(priv != NULL); |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
286 | |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
287 | 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
|
288 | |
|
4718438d053b
Cleaned up properties and added g_object_notify calls for everything else
Ankit Vani <a@nevitus.org>
parents:
34986
diff
changeset
|
289 | g_object_notify(G_OBJECT(wb), "draw-list"); |
|
32285
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
290 | } |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
291 | |
|
32282
c3df9b7a5160
Added protocol_data and ui_data accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
28981
diff
changeset
|
292 | 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
|
293 | { |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
294 | 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
|
295 | |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
296 | g_return_if_fail(priv != NULL); |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
297 | |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
298 | 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
|
299 | } |
|
c3df9b7a5160
Added protocol_data and ui_data accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
28981
diff
changeset
|
300 | |
|
c3df9b7a5160
Added protocol_data and ui_data accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
28981
diff
changeset
|
301 | 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
|
302 | { |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
303 | 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
|
304 | |
|
34936
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
305 | g_return_val_if_fail(priv != NULL, NULL); |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
306 | |
|
3c03564af436
Started GObjectification of PurpleWhiteboard
Ankit Vani <a@nevitus.org>
parents:
32708
diff
changeset
|
307 | 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
|
308 | } |
|
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 | 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
|
311 | { |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34939
diff
changeset
|
312 | 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
|
313 | |
|
c3df9b7a5160
Added protocol_data and ui_data accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
28981
diff
changeset
|
314 | 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
|
315 | } |
|
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 | 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
|
318 | { |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34939
diff
changeset
|
319 | 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
|
320 | |
|
c3df9b7a5160
Added protocol_data and ui_data accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
28981
diff
changeset
|
321 | 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
|
322 | } |
|
34939
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
323 | |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
324 | /****************************************************************************** |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
325 | * GObject code |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
326 | *****************************************************************************/ |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
327 | /* Set method for GObject properties */ |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
328 | static void |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
329 | 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
|
330 | GParamSpec *pspec) |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
331 | { |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
332 | PurpleWhiteboard *wb = PURPLE_WHITEBOARD(obj); |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
333 | PurpleWhiteboardPrivate *priv = PURPLE_WHITEBOARD_GET_PRIVATE(wb); |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
334 | |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
335 | switch (param_id) { |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
336 | case PROP_STATE: |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
337 | 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
|
338 | break; |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
339 | case PROP_ACCOUNT: |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
340 | priv->account = g_value_get_object(value); |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
341 | break; |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
342 | case PROP_WHO: |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
343 | 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
|
344 | break; |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
345 | case PROP_DRAW_LIST: |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
346 | 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
|
347 | break; |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
348 | default: |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
349 | 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
|
350 | break; |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
351 | } |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
352 | } |
|
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 | /* Get method for GObject properties */ |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
355 | static void |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
356 | 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
|
357 | GParamSpec *pspec) |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
358 | { |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
359 | PurpleWhiteboard *wb = PURPLE_WHITEBOARD(obj); |
|
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 | switch (param_id) { |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
362 | case PROP_STATE: |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
363 | 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
|
364 | break; |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
365 | case PROP_ACCOUNT: |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
366 | 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
|
367 | break; |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
368 | case PROP_WHO: |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
369 | 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
|
370 | break; |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
371 | case PROP_DRAW_LIST: |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
372 | 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
|
373 | break; |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
374 | default: |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
375 | 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
|
376 | break; |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
377 | } |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
378 | } |
|
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 | /* Called when done constructing */ |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
381 | static void |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
382 | purple_whiteboard_constructed(GObject *object) |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
383 | { |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
384 | PurpleWhiteboard *wb = PURPLE_WHITEBOARD(object); |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
385 | PurpleWhiteboardPrivate *priv = PURPLE_WHITEBOARD_GET_PRIVATE(wb); |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
386 | PurplePluginProtocolInfo *prpl_info; |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
387 | |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
388 | parent_class->constructed(object); |
|
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 | 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
|
391 | purple_account_get_connection(priv->account))); |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
392 | 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
|
393 | |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
394 | /* Start up protocol specifics */ |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
395 | if(priv->prpl_ops && priv->prpl_ops->start) |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
396 | priv->prpl_ops->start(wb); |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
397 | |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
398 | wbList = g_list_append(wbList, 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 | |
|
34986
894c29e33300
Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents:
34983
diff
changeset
|
401 | /* GObject finalize function */ |
|
34939
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
402 | 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
|
403 | purple_whiteboard_finalize(GObject *object) |
|
34939
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
404 | { |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
405 | PurpleWhiteboard *wb = PURPLE_WHITEBOARD(object); |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
406 | PurpleWhiteboardPrivate *priv = PURPLE_WHITEBOARD_GET_PRIVATE(wb); |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
407 | |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
408 | if(wb->ui_data) |
|
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 | /* Destroy frontend */ |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
411 | if(whiteboard_ui_ops && whiteboard_ui_ops->destroy) |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
412 | whiteboard_ui_ops->destroy(wb); |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
413 | } |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
414 | |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
415 | /* Do protocol specific session ending procedures */ |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
416 | if(priv->prpl_ops && priv->prpl_ops->end) |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
417 | priv->prpl_ops->end(wb); |
|
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 | wbList = g_list_remove(wbList, 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 | g_free(priv->who); |
|
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->finalize(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 | /* Class initializer 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_class_init(PurpleWhiteboardClass *klass) |
|
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 | GObjectClass *obj_class = G_OBJECT_CLASS(klass); |
|
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 | parent_class = g_type_class_peek_parent(klass); |
|
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 | obj_class->finalize = purple_whiteboard_finalize; |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
435 | obj_class->constructed = purple_whiteboard_constructed; |
|
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 | /* Setup properties */ |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
438 | obj_class->get_property = purple_whiteboard_get_property; |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
439 | obj_class->set_property = purple_whiteboard_set_property; |
|
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 | g_object_class_install_property(obj_class, PROP_STATE, |
|
35013
4718438d053b
Cleaned up properties and added g_object_notify calls for everything else
Ankit Vani <a@nevitus.org>
parents:
34986
diff
changeset
|
442 | g_param_spec_int("state", _("State"), |
|
34939
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
443 | _("State of the whiteboard."), |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
444 | G_MININT, G_MAXINT, 0, |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
445 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT) |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
446 | ); |
|
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 | g_object_class_install_property(obj_class, PROP_ACCOUNT, |
|
35013
4718438d053b
Cleaned up properties and added g_object_notify calls for everything else
Ankit Vani <a@nevitus.org>
parents:
34986
diff
changeset
|
449 | g_param_spec_object("account", _("Account"), |
|
34939
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
450 | _("The whiteboard's account."), PURPLE_TYPE_ACCOUNT, |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
451 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY) |
|
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 | |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
454 | g_object_class_install_property(obj_class, PROP_WHO, |
|
35013
4718438d053b
Cleaned up properties and added g_object_notify calls for everything else
Ankit Vani <a@nevitus.org>
parents:
34986
diff
changeset
|
455 | g_param_spec_string("who", _("Who"), |
|
34939
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
456 | _("Who you're drawing with."), NULL, |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
457 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY) |
|
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_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
|
461 | g_param_spec_pointer("draw-list", _("Draw list"), |
|
34939
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
462 | _("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
|
463 | G_PARAM_READWRITE) |
|
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_type_class_add_private(klass, sizeof(PurpleWhiteboardPrivate)); |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
467 | } |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
468 | |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
469 | GType |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
470 | purple_whiteboard_get_type(void) |
|
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 | static GType type = 0; |
|
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 | if(type == 0) { |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
475 | static const GTypeInfo info = { |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
476 | sizeof(PurpleWhiteboardClass), |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
477 | NULL, |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
478 | NULL, |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
479 | (GClassInitFunc)purple_whiteboard_class_init, |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
480 | NULL, |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
481 | NULL, |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
482 | sizeof(PurpleWhiteboard), |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
483 | 0, |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
484 | NULL, |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
485 | NULL, |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
486 | }; |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
487 | |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
488 | 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
|
489 | &info, 0); |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
490 | } |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
491 | |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
492 | return type; |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
493 | } |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
494 | |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
495 | 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
|
496 | { |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34939
diff
changeset
|
497 | 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
|
498 | 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
|
499 | |
|
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
500 | return g_object_new(PURPLE_TYPE_WHITEBOARD, |
|
35013
4718438d053b
Cleaned up properties and added g_object_notify calls for everything else
Ankit Vani <a@nevitus.org>
parents:
34986
diff
changeset
|
501 | "account", account, |
|
4718438d053b
Cleaned up properties and added g_object_notify calls for everything else
Ankit Vani <a@nevitus.org>
parents:
34986
diff
changeset
|
502 | "who", who, |
|
4718438d053b
Cleaned up properties and added g_object_notify calls for everything else
Ankit Vani <a@nevitus.org>
parents:
34986
diff
changeset
|
503 | "state", state, |
|
34939
e093c956c5e5
Added GObject code to whiteboard.c
Ankit Vani <a@nevitus.org>
parents:
34937
diff
changeset
|
504 | NULL |
|
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 | } |