Mercurial > pidgin
annotate src/gtkstatusbox.c @ 11981:053bb5ad040b
[gaim-migrate @ 14274]
continuing with my baby step #if 0'd commits, now you can actually
change your status via the individual selectors.
committer: Tailor Script <tailor@pidgin.im>
author | Tim Ringenbach <marv@pidgin.im> |
---|---|
date | Sat, 05 Nov 2005 02:32:36 +0000 |
parents | 225e1b274033 |
children | 39f2aa4350d8 |
rev | line source |
---|---|
10643 | 1 /* |
2 * @file gtkstatusbox.c GTK+ Status Selection Widget | |
3 * @ingroup gtkui | |
4 * | |
5 * gaim | |
6 * | |
7 * Gaim is the legal property of its developers, whose names are too numerous | |
8 * to list here. Please refer to the COPYRIGHT file distributed with this | |
9 * source distribution. | |
10 * | |
11 * This program is free software; you can redistribute it and/or modify | |
12 * it under the terms of the GNU General Public License as published by | |
13 * the Free Software Foundation; either version 2 of the License, or | |
14 * (at your option) any later version. | |
15 * | |
16 * This program is distributed in the hope that it will be useful, | |
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 * GNU General Public License for more details. | |
20 * | |
21 * You should have received a copy of the GNU General Public License | |
22 * along with this program; if not, write to the Free Software | |
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
24 */ | |
25 | |
11627 | 26 #include "account.h" |
10643 | 27 #include "internal.h" |
11627 | 28 #include "savedstatuses.h" |
10643 | 29 #include "status.h" |
11732 | 30 #include "debug.h" |
11627 | 31 |
10643 | 32 #include "gtkgaim.h" |
11729 | 33 #include "gtksavedstatuses.h" |
10643 | 34 #include "gtkstock.h" |
35 #include "gtkstatusbox.h" | |
36 | |
37 static void imhtml_changed_cb(GtkTextBuffer *buffer, void *data); | |
11562 | 38 static void remove_typing_cb(GtkGaimStatusBox *box); |
10643 | 39 |
11967 | 40 static void gtk_gaim_status_box_refresh(GtkGaimStatusBox *status_box); |
11732 | 41 static void gtk_gaim_status_box_regenerate(GtkGaimStatusBox *status_box); |
10643 | 42 static void gtk_gaim_status_box_changed(GtkComboBox *box); |
43 static void gtk_gaim_status_box_size_request (GtkWidget *widget, GtkRequisition *requisition); | |
44 static void gtk_gaim_status_box_size_allocate (GtkWidget *widget, GtkAllocation *allocation); | |
45 static gboolean gtk_gaim_status_box_expose_event (GtkWidget *widget, GdkEventExpose *event); | |
46 static void gtk_gaim_status_box_forall (GtkContainer *container, gboolean include_internals, GtkCallback callback, gpointer callback_data); | |
47 | |
48 static void (*combo_box_size_request)(GtkWidget *widget, GtkRequisition *requisition); | |
49 static void (*combo_box_size_allocate)(GtkWidget *widget, GtkAllocation *allocation); | |
50 static gboolean (*combo_box_expose_event)(GtkWidget *widget, GdkEventExpose *event); | |
51 static void (*combo_box_forall) (GtkContainer *container, gboolean include_internals, GtkCallback callback, gpointer callback_data); | |
11739 | 52 |
10643 | 53 enum { |
11739 | 54 TYPE_COLUMN, /* A GtkGaimStatusBoxItemType */ |
11738 | 55 ICON_COLUMN, /* This is a GdkPixbuf (the other columns are strings) */ |
56 TEXT_COLUMN, /* A string */ | |
57 TITLE_COLUMN, /* The plain-English title of this item */ | |
58 DESC_COLUMN, /* A plain-English description of this item */ | |
10643 | 59 NUM_COLUMNS |
60 }; | |
61 | |
11499 | 62 enum { |
63 PROP_0, | |
64 PROP_ACCOUNT | |
65 }; | |
66 | |
10643 | 67 static void gtk_gaim_status_box_class_init (GtkGaimStatusBoxClass *klass); |
68 static void gtk_gaim_status_box_init (GtkGaimStatusBox *status_box); | |
69 | |
70 GType | |
71 gtk_gaim_status_box_get_type (void) | |
72 { | |
10861 | 73 static GType status_box_type = 0; |
10643 | 74 |
10861 | 75 if (!status_box_type) |
76 { | |
77 static const GTypeInfo status_box_info = | |
78 { | |
79 sizeof (GtkGaimStatusBoxClass), | |
80 NULL, /* base_init */ | |
81 NULL, /* base_finalize */ | |
82 (GClassInitFunc) gtk_gaim_status_box_class_init, | |
83 NULL, /* class_finalize */ | |
84 NULL, /* class_data */ | |
85 sizeof (GtkGaimStatusBox), | |
86 0, | |
87 (GInstanceInitFunc) gtk_gaim_status_box_init | |
88 }; | |
10643 | 89 |
10861 | 90 status_box_type = g_type_register_static(GTK_TYPE_COMBO_BOX, |
91 "GtkGaimStatusBox", | |
92 &status_box_info, | |
93 0); | |
94 } | |
10643 | 95 |
10861 | 96 return status_box_type; |
10643 | 97 } |
98 | |
99 static void | |
11499 | 100 gtk_gaim_status_box_get_property(GObject *object, guint param_id, |
101 GValue *value, GParamSpec *psec) | |
102 { | |
103 GtkGaimStatusBox *statusbox = GTK_GAIM_STATUS_BOX(object); | |
104 | |
105 switch (param_id) { | |
106 case PROP_ACCOUNT: | |
107 g_value_set_pointer(value, statusbox->account); | |
108 break; | |
109 default: | |
110 G_OBJECT_WARN_INVALID_PROPERTY_ID(object, param_id, psec); | |
111 break; | |
112 } | |
113 } | |
114 | |
115 static void | |
11967 | 116 update_to_reflect_account_status(GtkGaimStatusBox *status_box, GaimAccount *account, GaimStatus *newstatus) |
11960 | 117 { |
11967 | 118 const GList *l; |
119 int status_no = -1; | |
120 const GaimStatusType *statustype = NULL; | |
121 | |
122 statustype = gaim_status_type_find_with_id((GList *)gaim_account_get_status_types(account), | |
123 (char *)gaim_status_type_get_id(gaim_status_get_type(newstatus))); | |
124 | |
125 for (l = gaim_account_get_status_types(account); l != NULL; l = l->next) { | |
126 GaimStatusType *status_type = (GaimStatusType *)l->data; | |
127 | |
128 if (!gaim_status_type_is_user_settable(status_type)) | |
129 continue; | |
130 status_no++; | |
131 if (statustype == status_type) | |
132 break; | |
133 } | |
134 | |
135 if (status_no != -1) { | |
136 gtk_widget_set_sensitive(GTK_WIDGET(status_box), FALSE); | |
137 gtk_combo_box_set_active(GTK_COMBO_BOX(status_box), status_no); | |
138 gtk_gaim_status_box_refresh(status_box); | |
139 gtk_widget_set_sensitive(GTK_WIDGET(status_box), TRUE); | |
140 } | |
141 | |
142 } | |
143 | |
144 static void | |
145 account_status_changed_cb(GaimAccount *account, GaimStatus *oldstatus, GaimStatus *newstatus, GtkGaimStatusBox *status_box) | |
146 { | |
147 if (status_box->account == account) | |
148 update_to_reflect_account_status(status_box, account, newstatus); | |
11960 | 149 } |
150 | |
151 static void | |
11499 | 152 gtk_gaim_status_box_set_property(GObject *object, guint param_id, |
153 const GValue *value, GParamSpec *pspec) | |
154 { | |
155 GtkGaimStatusBox *statusbox = GTK_GAIM_STATUS_BOX(object); | |
156 | |
157 switch (param_id) { | |
158 case PROP_ACCOUNT: | |
159 statusbox->account = g_value_get_pointer(value); | |
11960 | 160 |
161 /* FIXME: call this in the destroy function too, if we had one */ | |
11967 | 162 if (statusbox->status_changed_signal) { |
163 gaim_signal_disconnect(gaim_accounts_get_handle(), "account-status-changed", | |
164 statusbox, GAIM_CALLBACK(account_status_changed_cb)); | |
165 statusbox->status_changed_signal = 0; | |
166 } | |
11960 | 167 if (statusbox->account) |
11967 | 168 statusbox->status_changed_signal = gaim_signal_connect(gaim_accounts_get_handle(), "account-status-changed", |
11960 | 169 statusbox, GAIM_CALLBACK(account_status_changed_cb), |
170 statusbox); | |
11732 | 171 gtk_gaim_status_box_regenerate(statusbox); |
11499 | 172 break; |
173 default: | |
174 G_OBJECT_WARN_INVALID_PROPERTY_ID(object, param_id, pspec); | |
175 break; | |
176 } | |
177 } | |
178 | |
179 | |
180 static void | |
10643 | 181 gtk_gaim_status_box_class_init (GtkGaimStatusBoxClass *klass) |
182 { | |
10861 | 183 GObjectClass *object_class; |
184 GtkWidgetClass *widget_class; | |
185 GtkComboBoxClass *parent_class = (GtkComboBoxClass*)klass; | |
186 GtkContainerClass *container_class = (GtkContainerClass*)klass; | |
10643 | 187 |
10861 | 188 parent_class->changed = gtk_gaim_status_box_changed; |
189 widget_class = (GtkWidgetClass*)klass; | |
190 combo_box_size_request = widget_class->size_request; | |
191 widget_class->size_request = gtk_gaim_status_box_size_request; | |
192 combo_box_size_allocate = widget_class->size_allocate; | |
193 widget_class->size_allocate = gtk_gaim_status_box_size_allocate; | |
194 combo_box_expose_event = widget_class->expose_event; | |
195 widget_class->expose_event = gtk_gaim_status_box_expose_event; | |
10643 | 196 |
10861 | 197 combo_box_forall = container_class->forall; |
198 container_class->forall = gtk_gaim_status_box_forall; | |
199 | |
200 object_class = (GObjectClass *)klass; | |
11499 | 201 |
202 object_class->get_property = gtk_gaim_status_box_get_property; | |
203 object_class->set_property = gtk_gaim_status_box_set_property; | |
204 | |
205 g_object_class_install_property(object_class, | |
206 PROP_ACCOUNT, | |
207 g_param_spec_pointer("account", | |
208 "Account", | |
209 "The account, or NULL for all accounts", | |
210 G_PARAM_READWRITE | |
211 ) | |
212 ); | |
10643 | 213 } |
214 | |
215 static void | |
216 gtk_gaim_status_box_refresh(GtkGaimStatusBox *status_box) | |
217 { | |
10672
0925c898b73c
[gaim-migrate @ 12212]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10661
diff
changeset
|
218 char *text, *title; |
10643 | 219 char aa_color[8]; |
220 GdkPixbuf *pixbuf; | |
10702 | 221 GtkTreePath *path; |
11870 | 222 GtkStyle *style; |
10643 | 223 |
11870 | 224 style = gtk_widget_get_style(GTK_WIDGET(status_box)); |
10643 | 225 snprintf(aa_color, sizeof(aa_color), "#%02x%02x%02x", |
226 style->text_aa[GTK_STATE_NORMAL].red >> 8, | |
227 style->text_aa[GTK_STATE_NORMAL].green >> 8, | |
228 style->text_aa[GTK_STATE_NORMAL].blue >> 8); | |
10672
0925c898b73c
[gaim-migrate @ 12212]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10661
diff
changeset
|
229 |
0925c898b73c
[gaim-migrate @ 12212]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10661
diff
changeset
|
230 title = status_box->title; |
0925c898b73c
[gaim-migrate @ 12212]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10661
diff
changeset
|
231 if (!title) |
0925c898b73c
[gaim-migrate @ 12212]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10661
diff
changeset
|
232 title = ""; |
0925c898b73c
[gaim-migrate @ 12212]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10661
diff
changeset
|
233 |
11960 | 234 |
10643 | 235 if (status_box->error) { |
11499 | 236 text = g_strdup_printf("%s\n<span size=\"smaller\" weight=\"bold\" color=\"red\">%s</span>", |
10861 | 237 title, status_box->error); |
10643 | 238 } else if (status_box->typing) { |
10861 | 239 text = g_strdup_printf("%s\n<span size=\"smaller\" color=\"%s\">%s</span>", |
240 title, aa_color, _("Typing")); | |
10643 | 241 } else if (status_box->connecting) { |
10861 | 242 text = g_strdup_printf("%s\n<span size=\"smaller\" color=\"%s\">%s</span>", |
243 title, aa_color, _("Connecting")); | |
244 } else if (status_box->desc) { | |
245 text = g_strdup_printf("%s\n<span size=\"smaller\" color=\"%s\">%s</span>", | |
246 title, aa_color, status_box->desc); | |
10643 | 247 } else { |
10672
0925c898b73c
[gaim-migrate @ 12212]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10661
diff
changeset
|
248 text = g_strdup_printf("%s", title); |
10643 | 249 } |
10861 | 250 |
11960 | 251 if (status_box->account) { |
252 char *text2 = g_strdup_printf("%s\n<span size=\"smaller\">%s</span>", gaim_account_get_username(status_box->account), text); | |
253 g_free(text); | |
254 text = text2; | |
255 } | |
256 | |
257 | |
11523 | 258 if (status_box->connecting) |
259 pixbuf = status_box->connecting_pixbufs[status_box->connecting_index]; | |
260 else if (status_box->error) | |
10643 | 261 pixbuf = status_box->error_pixbuf; |
262 else if (status_box->typing) | |
263 pixbuf = status_box->typing_pixbufs[status_box->typing_index]; | |
264 else | |
265 pixbuf = status_box->pixbuf; | |
266 | |
267 gtk_list_store_set(status_box->store, &(status_box->iter), | |
11755 | 268 TYPE_COLUMN, -1, /* This field is not used in this list store */ |
10643 | 269 ICON_COLUMN, pixbuf, |
10861 | 270 TEXT_COLUMN, text, |
10672
0925c898b73c
[gaim-migrate @ 12212]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10661
diff
changeset
|
271 TITLE_COLUMN, title, |
10861 | 272 DESC_COLUMN, status_box->desc, |
11739 | 273 -1); |
10702 | 274 path = gtk_tree_path_new_from_string("0"); |
275 gtk_cell_view_set_displayed_row(GTK_CELL_VIEW(status_box->cell_view), path); | |
276 gtk_tree_path_free(path); | |
10643 | 277 |
278 g_free(text); | |
279 } | |
280 | |
11732 | 281 static GdkPixbuf * |
282 load_icon(const char *basename) | |
283 { | |
284 char basename2[BUFSIZ]; | |
285 char *filename; | |
286 GdkPixbuf *pixbuf, *scale = NULL; | |
287 | |
288 if (!strcmp(basename, "available")) | |
289 basename = "online"; | |
290 else if (!strcmp(basename, "hidden")) | |
291 basename = "invisible"; | |
292 | |
293 /* | |
294 * TODO: Find a way to fallback to the GaimStatusPrimitive | |
295 * if an icon for this id does not exist. | |
296 */ | |
297 g_snprintf(basename2, sizeof(basename2), "%s.png", | |
298 basename); | |
299 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "icons", | |
300 basename2, NULL); | |
301 pixbuf = gdk_pixbuf_new_from_file(filename, NULL); | |
302 g_free(filename); | |
303 | |
304 if (pixbuf != NULL) { | |
305 scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16, | |
306 GDK_INTERP_BILINEAR); | |
307 | |
308 g_object_unref(G_OBJECT(pixbuf)); | |
309 } else { | |
310 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", | |
311 "default", basename, NULL); | |
312 scale = gdk_pixbuf_new_from_file(filename, NULL); | |
313 g_free(filename); | |
314 } | |
315 | |
316 return scale; | |
317 } | |
318 | |
11870 | 319 /** |
320 * This updates the GtkTreeView so that it correctly shows the state | |
321 * we are currently using. It is used when the current state is | |
322 * updated from somewhere other than the GtkStatusBox (from a plugin, | |
323 * or when signing on with the "-n" option, for example). It is | |
324 * also used when the user selects the "Custom..." option. | |
325 * | |
326 * Maybe we could accomplish this by triggering off the mouse and | |
327 * keyboard signals instead of the changed signal? | |
328 */ | |
329 static void | |
330 update_to_reflect_current_status(GtkGaimStatusBox *status_box) | |
331 { | |
332 const char *current_savedstatus_name; | |
333 GaimSavedStatus *saved_status; | |
334 | |
335 current_savedstatus_name = gaim_prefs_get_string("/core/status/current"); | |
336 saved_status = gaim_savedstatus_find(current_savedstatus_name); | |
11951 | 337 |
338 /* | |
339 * Suppress the "changed" signal because the status | |
340 * was changed programmatically. | |
341 */ | |
342 gtk_widget_set_sensitive(GTK_WIDGET(status_box), FALSE); | |
343 | |
11870 | 344 if (saved_status == NULL) |
345 { | |
346 /* Default to "available" */ | |
347 gtk_combo_box_set_active(GTK_COMBO_BOX(status_box), 0); | |
348 } | |
349 else | |
350 { | |
351 GaimStatusPrimitive primitive; | |
352 const char *message; | |
353 | |
354 primitive = gaim_savedstatus_get_type(saved_status); | |
355 if (gaim_savedstatus_has_substatuses(saved_status) || | |
356 ((primitive != GAIM_STATUS_AVAILABLE) && | |
357 (primitive != GAIM_STATUS_OFFLINE) && | |
358 (primitive != GAIM_STATUS_AWAY) && | |
359 (primitive != GAIM_STATUS_HIDDEN))) | |
360 { | |
361 gtk_combo_box_set_active(GTK_COMBO_BOX(status_box), 4); | |
362 } | |
363 else | |
364 { | |
365 if (primitive == GAIM_STATUS_AVAILABLE) | |
366 gtk_combo_box_set_active(GTK_COMBO_BOX(status_box), 0); | |
367 if (primitive == GAIM_STATUS_OFFLINE) | |
368 gtk_combo_box_set_active(GTK_COMBO_BOX(status_box), 3); | |
369 else if (primitive == GAIM_STATUS_AWAY) | |
370 gtk_combo_box_set_active(GTK_COMBO_BOX(status_box), 1); | |
371 else if (primitive == GAIM_STATUS_HIDDEN) | |
372 gtk_combo_box_set_active(GTK_COMBO_BOX(status_box), 2); | |
373 } | |
374 | |
375 message = gaim_savedstatus_get_message(saved_status); | |
11954 | 376 if (message == NULL) |
11951 | 377 { |
11954 | 378 status_box->imhtml_visible = FALSE; |
379 } | |
380 else | |
381 { | |
382 status_box->imhtml_visible = TRUE; | |
383 | |
11951 | 384 /* |
385 * Suppress the "changed" signal because the status | |
386 * was changed programmatically. | |
387 */ | |
388 gtk_widget_set_sensitive(GTK_WIDGET(status_box->imhtml), FALSE); | |
11954 | 389 |
390 gtk_imhtml_clear(GTK_IMHTML(status_box->imhtml)); | |
11870 | 391 gtk_imhtml_append_text(GTK_IMHTML(status_box->imhtml), message, 0); |
11951 | 392 gtk_widget_set_sensitive(GTK_WIDGET(status_box->imhtml), TRUE); |
393 } | |
11870 | 394 } |
11951 | 395 |
396 /* Stop suppressing the "changed" signal. */ | |
397 gtk_widget_set_sensitive(GTK_WIDGET(status_box), TRUE); | |
11870 | 398 } |
399 | |
11732 | 400 static void |
401 gtk_gaim_status_box_regenerate(GtkGaimStatusBox *status_box) | |
402 { | |
11739 | 403 GaimAccount *account; |
11732 | 404 GdkPixbuf *pixbuf, *pixbuf2, *pixbuf3, *pixbuf4; |
405 GtkIconSize icon_size; | |
406 | |
407 icon_size = gtk_icon_size_from_name(GAIM_ICON_SIZE_STATUS); | |
408 | |
409 gtk_list_store_clear(status_box->dropdown_store); | |
410 | |
11739 | 411 account = GTK_GAIM_STATUS_BOX(status_box)->account; |
412 if (account == NULL) | |
413 { | |
11756 | 414 pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), GAIM_STOCK_STATUS_ONLINE, |
11732 | 415 icon_size, "GtkGaimStatusBox"); |
11756 | 416 pixbuf2 = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), GAIM_STOCK_STATUS_AWAY, |
11732 | 417 icon_size, "GtkGaimStatusBox"); |
11756 | 418 pixbuf3 = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), GAIM_STOCK_STATUS_OFFLINE, |
11732 | 419 icon_size, "GtkGaimStatusBox"); |
11756 | 420 pixbuf4 = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), GAIM_STOCK_STATUS_INVISIBLE, |
11732 | 421 icon_size, "GtkGaimStatusBox"); |
422 /* hacks */ | |
11739 | 423 gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box), GAIM_STATUS_AVAILABLE, pixbuf, _("Available"), NULL); |
424 gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box), GAIM_STATUS_AWAY, pixbuf2, _("Away"), NULL); | |
425 gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box), GAIM_STATUS_HIDDEN, pixbuf4, _("Invisible"), NULL); | |
426 gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box), GAIM_STATUS_OFFLINE, pixbuf3, _("Offline"), NULL); | |
11738 | 427 gtk_gaim_status_box_add_separator(GTK_GAIM_STATUS_BOX(status_box)); |
11739 | 428 gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box), GTK_GAIM_STATUS_BOX_TYPE_CUSTOM, pixbuf, _("Custom..."), NULL); |
429 gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box), GTK_GAIM_STATUS_BOX_TYPE_SAVED, pixbuf, _("Saved..."), NULL); | |
11732 | 430 |
11870 | 431 update_to_reflect_current_status(status_box); |
11732 | 432 |
433 } else { | |
434 const GList *l; | |
11739 | 435 |
436 for (l = gaim_account_get_status_types(account); l != NULL; l = l->next) | |
437 { | |
11732 | 438 GaimStatusType *status_type = (GaimStatusType *)l->data; |
439 | |
440 if (!gaim_status_type_is_user_settable(status_type)) | |
441 continue; | |
442 | |
11739 | 443 gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box), |
444 gaim_status_type_get_primitive(status_type), | |
445 load_icon(gaim_status_type_get_id(status_type)), | |
446 gaim_status_type_get_name(status_type), | |
447 NULL); | |
11732 | 448 } |
11967 | 449 update_to_reflect_account_status(status_box, account, gaim_account_get_active_status(account)); |
11732 | 450 } |
451 | |
452 } | |
453 | |
11753 | 454 #if GTK_CHECK_VERSION(2,6,0) |
11738 | 455 static gboolean |
456 dropdown_store_row_separator_func(GtkTreeModel *model, | |
457 GtkTreeIter *iter, gpointer data) | |
458 { | |
11739 | 459 GtkGaimStatusBoxItemType type; |
11738 | 460 |
11885 | 461 gtk_tree_model_get(model, iter, TYPE_COLUMN, &type, -1); |
11738 | 462 |
11739 | 463 if (type == GTK_GAIM_STATUS_BOX_TYPE_SEPARATOR) |
11738 | 464 return TRUE; |
465 | |
466 return FALSE; | |
467 } | |
11753 | 468 #endif |
11738 | 469 |
10643 | 470 static void |
11954 | 471 current_status_pref_changed_cb(const char *name, GaimPrefType type, |
472 gpointer val, gpointer data) | |
473 { | |
474 update_to_reflect_current_status(data); | |
475 } | |
476 | |
477 static void | |
10643 | 478 gtk_gaim_status_box_init (GtkGaimStatusBox *status_box) |
479 { | |
11400 | 480 GtkCellRenderer *text_rend; |
481 GtkCellRenderer *icon_rend; | |
10643 | 482 GtkTextBuffer *buffer; |
11732 | 483 GtkTreePath *path; |
11400 | 484 GtkIconSize icon_size; |
485 | |
486 text_rend = gtk_cell_renderer_text_new(); | |
487 icon_rend = gtk_cell_renderer_pixbuf_new(); | |
488 icon_size = gtk_icon_size_from_name(GAIM_ICON_SIZE_STATUS); | |
10643 | 489 |
490 status_box->imhtml_visible = FALSE; | |
491 status_box->connecting = FALSE; | |
492 status_box->typing = FALSE; | |
493 status_box->title = NULL; | |
10861 | 494 status_box->pixbuf = NULL; |
10643 | 495 status_box->cell_view = gtk_cell_view_new(); |
496 gtk_widget_show (status_box->cell_view); | |
10861 | 497 |
11739 | 498 status_box->store = gtk_list_store_new(NUM_COLUMNS, G_TYPE_INT, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING); |
499 status_box->dropdown_store = gtk_list_store_new(NUM_COLUMNS, G_TYPE_INT, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING); | |
10643 | 500 gtk_combo_box_set_model(GTK_COMBO_BOX(status_box), GTK_TREE_MODEL(status_box->dropdown_store)); |
501 gtk_cell_view_set_model(GTK_CELL_VIEW(status_box->cell_view), GTK_TREE_MODEL(status_box->store)); | |
502 gtk_combo_box_set_wrap_width(GTK_COMBO_BOX(status_box), 0); | |
503 gtk_list_store_append(status_box->store, &(status_box->iter)); | |
504 gtk_gaim_status_box_refresh(status_box); | |
11593
4b7fb30b8926
[gaim-migrate @ 13863]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11562
diff
changeset
|
505 path = gtk_tree_path_new_from_string("0"); |
4b7fb30b8926
[gaim-migrate @ 13863]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11562
diff
changeset
|
506 gtk_cell_view_set_displayed_row(GTK_CELL_VIEW(status_box->cell_view), path); |
4b7fb30b8926
[gaim-migrate @ 13863]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11562
diff
changeset
|
507 gtk_tree_path_free(path); |
10643 | 508 gtk_container_add(GTK_CONTAINER(status_box), status_box->cell_view); |
10861 | 509 |
10643 | 510 status_box->icon_rend = gtk_cell_renderer_pixbuf_new(); |
511 status_box->text_rend = gtk_cell_renderer_text_new(); | |
512 | |
513 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(status_box), icon_rend, FALSE); | |
10861 | 514 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(status_box), text_rend, TRUE); |
10643 | 515 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(status_box), icon_rend, "pixbuf", ICON_COLUMN, NULL); |
516 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(status_box), text_rend, "markup", TEXT_COLUMN, NULL); | |
517 | |
518 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(status_box->cell_view), status_box->icon_rend, FALSE); | |
11499 | 519 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(status_box->cell_view), status_box->text_rend, TRUE); |
10643 | 520 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(status_box->cell_view), status_box->icon_rend, "pixbuf", ICON_COLUMN, NULL); |
521 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(status_box->cell_view), status_box->text_rend, "markup", TEXT_COLUMN, NULL); | |
522 | |
523 status_box->vbox = gtk_vbox_new(0, FALSE); | |
524 status_box->imhtml = gtk_imhtml_new(NULL, NULL); | |
525 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(status_box->imhtml)); | |
526 g_signal_connect(G_OBJECT(buffer), "changed", G_CALLBACK(imhtml_changed_cb), status_box); | |
11562 | 527 g_signal_connect_swapped(G_OBJECT(status_box->imhtml), "message_send", G_CALLBACK(remove_typing_cb), status_box); |
10643 | 528 gtk_imhtml_set_editable(GTK_IMHTML(status_box->imhtml), TRUE); |
529 gtk_widget_set_parent(status_box->vbox, GTK_WIDGET(status_box)); | |
530 status_box->sw = gtk_scrolled_window_new(NULL, NULL); | |
531 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(status_box->sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); | |
532 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(status_box->sw), GTK_SHADOW_IN); | |
533 gtk_container_add(GTK_CONTAINER(status_box->sw), status_box->imhtml); | |
534 gtk_box_pack_start(GTK_BOX(status_box->vbox), status_box->sw, TRUE, TRUE, 0); | |
11654 | 535 |
11850 | 536 |
537 #if GTK_CHECK_VERSION(2,6,0) | |
538 gtk_combo_box_set_row_separator_func(GTK_COMBO_BOX(status_box), dropdown_store_row_separator_func, NULL, NULL); | |
539 #endif | |
540 | |
11756 | 541 status_box->error_pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), GAIM_STOCK_STATUS_OFFLINE, |
542 icon_size, "GtkGaimStatusBox"); | |
543 status_box->connecting_index = 0; | |
544 status_box->connecting_pixbufs[0] = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), GAIM_STOCK_STATUS_CONNECT0, | |
545 icon_size, "GtkGaimStatusBox"); | |
546 status_box->connecting_pixbufs[1] = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), GAIM_STOCK_STATUS_CONNECT1, | |
547 icon_size, "GtkGaimStatusBox"); | |
548 status_box->connecting_pixbufs[2] = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), GAIM_STOCK_STATUS_CONNECT2, | |
549 icon_size, "GtkGaimStatusBox"); | |
550 status_box->connecting_pixbufs[3] = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), GAIM_STOCK_STATUS_CONNECT3, | |
551 icon_size, "GtkGaimStatusBox"); | |
552 | |
553 status_box->typing_index = 0; | |
554 status_box->typing_pixbufs[0] = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), GAIM_STOCK_STATUS_TYPING0, | |
555 icon_size, "GtkGaimStatusBox"); | |
556 status_box->typing_pixbufs[1] = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), GAIM_STOCK_STATUS_TYPING1, | |
557 icon_size, "GtkGaimStatusBox"); | |
558 status_box->typing_pixbufs[2] = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), GAIM_STOCK_STATUS_TYPING2, | |
559 icon_size, "GtkGaimStatusBox"); | |
560 status_box->typing_pixbufs[3] = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), GAIM_STOCK_STATUS_TYPING3, | |
561 icon_size, "GtkGaimStatusBox"); | |
562 | |
11732 | 563 gtk_gaim_status_box_regenerate(status_box); |
11954 | 564 |
565 /* Monitor changes in the "/core/status/current" preference */ | |
566 gaim_prefs_connect_callback(status_box, "/core/status/current", | |
567 current_status_pref_changed_cb, status_box); | |
568 | |
569 /* TODO: Need to override the destroy method for this object and put the following line in it */ | |
570 /* gaim_prefs_disconnect_by_handle(status_box); */ | |
10643 | 571 } |
572 | |
573 static void | |
10861 | 574 gtk_gaim_status_box_size_request(GtkWidget *widget, |
575 GtkRequisition *requisition) | |
10643 | 576 { |
577 GtkRequisition box_req; | |
578 combo_box_size_request(widget, requisition); | |
10861 | 579 |
10643 | 580 gtk_widget_size_request(GTK_GAIM_STATUS_BOX(widget)->vbox, &box_req); |
581 if (box_req.height > 1) | |
582 requisition->height = requisition->height + box_req.height + 6; | |
10861 | 583 |
10643 | 584 requisition->width = 1; |
585 | |
586 } | |
587 | |
588 static void | |
10861 | 589 gtk_gaim_status_box_size_allocate(GtkWidget *widget, |
590 GtkAllocation *allocation) | |
10643 | 591 { |
592 GtkRequisition req = {0,0}; | |
11400 | 593 GtkAllocation parent_alc, box_alc; |
594 | |
595 parent_alc = *allocation; | |
596 box_alc = *allocation; | |
10643 | 597 combo_box_size_request(widget, &req); |
10861 | 598 |
10643 | 599 /* EVIL XXX */ |
10861 | 600 box_alc.height = 80; |
601 /* box_alc.height = MAX(1,box_alc.height - req.height - 6); */ | |
602 | |
10643 | 603 box_alc.y = box_alc.y + req.height + 6; |
604 gtk_widget_size_allocate((GTK_GAIM_STATUS_BOX(widget))->vbox, &box_alc); | |
10861 | 605 |
10643 | 606 parent_alc.height = MAX(1,req.height); |
607 combo_box_size_allocate(widget, &parent_alc); | |
608 widget->allocation = *allocation; | |
609 } | |
610 | |
611 | |
612 static gboolean | |
10861 | 613 gtk_gaim_status_box_expose_event(GtkWidget *widget, |
614 GdkEventExpose *event) | |
10643 | 615 { |
10861 | 616 GtkGaimStatusBox *status_box = GTK_GAIM_STATUS_BOX(widget); |
617 combo_box_expose_event(widget, event); | |
10643 | 618 |
10861 | 619 gtk_container_propagate_expose(GTK_CONTAINER(widget), |
620 status_box->vbox, event); | |
621 return FALSE; | |
10643 | 622 } |
623 | |
624 static void | |
10861 | 625 gtk_gaim_status_box_forall(GtkContainer *container, |
626 gboolean include_internals, | |
627 GtkCallback callback, | |
628 gpointer callback_data) | |
10643 | 629 { |
10861 | 630 GtkGaimStatusBox *status_box = GTK_GAIM_STATUS_BOX (container); |
10643 | 631 |
10861 | 632 if (include_internals) |
633 { | |
634 (* callback) (status_box->vbox, callback_data); | |
635 } | |
10643 | 636 |
10861 | 637 combo_box_forall(container, include_internals, callback, callback_data); |
10643 | 638 } |
639 | |
640 GtkWidget * | |
641 gtk_gaim_status_box_new() | |
642 { | |
643 return g_object_new(GTK_GAIM_TYPE_STATUS_BOX, NULL); | |
644 } | |
645 | |
11499 | 646 GtkWidget * |
647 gtk_gaim_status_box_new_with_account(GaimAccount *account) | |
648 { | |
649 return g_object_new(GTK_GAIM_TYPE_STATUS_BOX, "account", account, NULL); | |
650 } | |
10643 | 651 |
652 void | |
11739 | 653 gtk_gaim_status_box_add(GtkGaimStatusBox *status_box, GtkGaimStatusBoxItemType type, GdkPixbuf *pixbuf, const char *text, const char *sec_text) |
10643 | 654 { |
655 GtkTreeIter iter; | |
656 char *t; | |
10861 | 657 |
10643 | 658 if (sec_text) { |
659 char aa_color[8]; | |
660 GtkStyle *style = gtk_widget_get_style(GTK_WIDGET(status_box)); | |
661 snprintf(aa_color, sizeof(aa_color), "#%02x%02x%02x", | |
662 style->text_aa[GTK_STATE_NORMAL].red >> 8, | |
663 style->text_aa[GTK_STATE_NORMAL].green >> 8, | |
10861 | 664 style->text_aa[GTK_STATE_NORMAL].blue >> 8); |
10643 | 665 t = g_strdup_printf("%s\n<span color=\"%s\">%s</span>", text, aa_color, sec_text); |
666 } else { | |
667 t = g_strdup(text); | |
668 } | |
10861 | 669 |
10643 | 670 gtk_list_store_append(status_box->dropdown_store, &iter); |
671 gtk_list_store_set(status_box->dropdown_store, &iter, | |
11739 | 672 TYPE_COLUMN, type, |
10643 | 673 ICON_COLUMN, pixbuf, |
10861 | 674 TEXT_COLUMN, t, |
10643 | 675 TITLE_COLUMN, text, |
10861 | 676 DESC_COLUMN, sec_text, |
11739 | 677 -1); |
11638 | 678 g_free(t); |
10643 | 679 } |
680 | |
681 void | |
11738 | 682 gtk_gaim_status_box_add_separator(GtkGaimStatusBox *status_box) |
683 { | |
11756 | 684 /* Don't do anything unless GTK actually supports |
685 * gtk_combo_box_set_row_separator_func */ | |
686 #if GTK_CHECK_VERSION(2,6,0) | |
11738 | 687 GtkTreeIter iter; |
688 | |
689 gtk_list_store_append(status_box->dropdown_store, &iter); | |
690 gtk_list_store_set(status_box->dropdown_store, &iter, | |
11739 | 691 TYPE_COLUMN, GTK_GAIM_STATUS_BOX_TYPE_SEPARATOR, |
692 -1); | |
11756 | 693 #endif |
11738 | 694 } |
695 | |
696 void | |
10643 | 697 gtk_gaim_status_box_set_error(GtkGaimStatusBox *status_box, const gchar *error) |
698 { | |
11523 | 699 if (status_box->error) |
700 g_free(status_box->error); | |
11891 | 701 status_box->error = NULL; |
702 if (error != NULL) | |
703 status_box->error = g_strdup(error); | |
10643 | 704 gtk_gaim_status_box_refresh(status_box); |
705 } | |
706 | |
707 void | |
708 gtk_gaim_status_box_set_connecting(GtkGaimStatusBox *status_box, gboolean connecting) | |
709 { | |
710 if (!status_box) | |
711 return; | |
712 status_box->connecting = connecting; | |
713 gtk_gaim_status_box_refresh(status_box); | |
714 } | |
715 | |
716 void | |
717 gtk_gaim_status_box_pulse_connecting(GtkGaimStatusBox *status_box) | |
718 { | |
719 if (!status_box) | |
720 return; | |
721 if (status_box->connecting_index == 3) | |
722 status_box->connecting_index = 0; | |
10861 | 723 else |
10643 | 724 status_box->connecting_index++; |
725 gtk_gaim_status_box_refresh(status_box); | |
726 } | |
727 | |
728 void | |
729 gtk_gaim_status_box_pulse_typing(GtkGaimStatusBox *status_box) | |
730 { | |
731 if (status_box->typing_index == 3) | |
732 status_box->typing_index = 0; | |
10861 | 733 else |
10643 | 734 status_box->typing_index++; |
735 gtk_gaim_status_box_refresh(status_box); | |
736 } | |
737 | |
11654 | 738 static void |
739 activate_currently_selected_status(GtkGaimStatusBox *status_box) | |
10643 | 740 { |
11739 | 741 GtkGaimStatusBoxItemType type; |
742 gchar *title; | |
10643 | 743 GtkTreeIter iter; |
11654 | 744 char *message; |
745 GaimSavedStatus *saved_status; | |
10643 | 746 |
11951 | 747 if (!gtk_combo_box_get_active_iter(GTK_COMBO_BOX(status_box), &iter)) |
748 return; | |
11654 | 749 gtk_tree_model_get(GTK_TREE_MODEL(status_box->dropdown_store), &iter, |
11739 | 750 TYPE_COLUMN, &type, |
11638 | 751 TITLE_COLUMN, &title, -1); |
11654 | 752 message = gtk_gaim_status_box_get_message(status_box); |
11739 | 753 |
754 /* | |
755 * If the currently selected status is "Custom..." or | |
11954 | 756 * "Saved..." then do nothing. Custom statuses are |
757 * activated elsewhere, and we update the status_box | |
758 * accordingly by monitoring the preference | |
759 * "/core/status/current" and then calling | |
760 * update_to_reflect_current_status() | |
11739 | 761 */ |
762 if ((type < 0) || (type >= GAIM_STATUS_NUM_PRIMITIVES)) | |
763 return; | |
11654 | 764 |
765 /* TODO: Should save the previous status as a transient status? */ | |
766 | |
11981 | 767 if (status_box->account) { |
768 const GList *l = gaim_account_get_status_types(status_box->account); | |
769 gint active; | |
770 GaimStatusType *status_type; | |
771 | |
772 g_object_get(G_OBJECT(status_box), "active", &active, NULL); | |
11654 | 773 |
11981 | 774 status_type = g_list_nth_data((GList *)l, active); |
775 if (message) | |
776 gaim_account_set_status(status_box->account, gaim_status_type_get_id(status_type), | |
777 TRUE, "message", message, NULL); | |
778 else | |
779 gaim_account_set_status(status_box->account, gaim_status_type_get_id(status_type), | |
780 TRUE, NULL); | |
781 | |
782 } else { | |
783 /* Save the newly selected status to prefs.xml and status.xml */ | |
784 /* TODO: This should be saved as transient. */ | |
785 saved_status = gaim_savedstatus_find(_("Default")); | |
786 if (saved_status == NULL) | |
787 saved_status = gaim_savedstatus_new(_("Default"), type); | |
788 gaim_savedstatus_set_type(saved_status, type); | |
789 gaim_savedstatus_set_message(saved_status, message); | |
790 gaim_prefs_set_string("/core/status/current", _("Default")); | |
791 | |
792 /* Set the status for each account */ | |
793 gaim_savedstatus_activate(saved_status); | |
794 } | |
11627 | 795 |
11638 | 796 g_free(title); |
11654 | 797 g_free(message); |
798 } | |
799 | |
800 static void remove_typing_cb(GtkGaimStatusBox *status_box) | |
801 { | |
802 activate_currently_selected_status(status_box); | |
803 | |
804 g_source_remove(status_box->typing); | |
805 status_box->typing = 0; | |
806 gtk_gaim_status_box_refresh(status_box); | |
10643 | 807 } |
808 | |
809 static void gtk_gaim_status_box_changed(GtkComboBox *box) | |
810 { | |
11400 | 811 GtkGaimStatusBox *status_box; |
10643 | 812 GtkTreeIter iter; |
11739 | 813 GtkGaimStatusBoxItemType type; |
10643 | 814 char *text, *sec_text; |
815 GdkPixbuf *pixbuf; | |
11960 | 816 GList *accounts = NULL, *node; |
10643 | 817 |
11400 | 818 status_box = GTK_GAIM_STATUS_BOX(box); |
819 | |
10643 | 820 gtk_combo_box_get_active_iter(GTK_COMBO_BOX(status_box), &iter); |
11739 | 821 gtk_tree_model_get(GTK_TREE_MODEL(status_box->dropdown_store), &iter, |
822 TYPE_COLUMN, &type, | |
823 TITLE_COLUMN, &text, | |
10861 | 824 DESC_COLUMN, &sec_text, ICON_COLUMN, &pixbuf, |
11739 | 825 -1); |
10643 | 826 if (status_box->title) |
827 g_free(status_box->title); | |
11638 | 828 status_box->title = text; |
10643 | 829 if (status_box->desc && sec_text) |
11638 | 830 g_free(status_box->desc); |
831 status_box->desc = sec_text; | |
10643 | 832 if (status_box->pixbuf) |
833 g_object_unref(status_box->pixbuf); | |
834 status_box->pixbuf = pixbuf; | |
11638 | 835 if (status_box->typing) |
836 g_source_remove(status_box->typing); | |
837 status_box->typing = 0; | |
10861 | 838 |
11951 | 839 if (GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(status_box))) |
11729 | 840 { |
11951 | 841 if (type == GTK_GAIM_STATUS_BOX_TYPE_CUSTOM) |
842 { | |
843 gaim_gtk_status_editor_show(NULL); | |
844 update_to_reflect_current_status(status_box); | |
845 return; | |
846 } | |
11729 | 847 |
11951 | 848 if (type == GTK_GAIM_STATUS_BOX_TYPE_SAVED) |
849 { | |
850 gaim_gtk_status_window_show(); | |
851 update_to_reflect_current_status(status_box); | |
852 return; | |
853 } | |
11729 | 854 } |
855 | |
11654 | 856 /* |
11755 | 857 * Show the message box whenever 'type' allows for a |
11960 | 858 * message attribute on any protocol that is enabled, |
859 * or our protocol, if we have account set | |
11654 | 860 */ |
11960 | 861 if (status_box->account) |
862 accounts = g_list_prepend(accounts, status_box->account); | |
863 else | |
864 accounts = gaim_accounts_get_all_active(); | |
11755 | 865 status_box->imhtml_visible = FALSE; |
866 for (node = accounts; node != NULL; node = node->next) | |
867 { | |
868 GaimAccount *account; | |
869 GaimStatusType *status_type; | |
870 | |
871 account = node->data; | |
872 status_type = gaim_account_get_status_type_with_primitive(account, type); | |
873 if ((status_type != NULL) && | |
874 (gaim_status_type_get_attr(status_type, "message") != NULL)) | |
875 { | |
876 status_box->imhtml_visible = TRUE; | |
877 break; | |
878 } | |
879 } | |
880 g_list_free(accounts); | |
11654 | 881 |
882 if (status_box->imhtml_visible) | |
883 { | |
10643 | 884 gtk_widget_show_all(status_box->vbox); |
11951 | 885 if (GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(status_box))) |
886 status_box->typing = g_timeout_add(3000, (GSourceFunc)remove_typing_cb, status_box); | |
10643 | 887 gtk_imhtml_clear(GTK_IMHTML(status_box->imhtml)); |
888 gtk_widget_grab_focus(status_box->imhtml); | |
11654 | 889 } |
890 else | |
891 { | |
10643 | 892 gtk_widget_hide_all(status_box->vbox); |
11951 | 893 if (GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(status_box))) |
11981 | 894 activate_currently_selected_status(status_box); /* This is where we actually set the status */ |
10643 | 895 } |
896 gtk_gaim_status_box_refresh(status_box); | |
897 } | |
898 | |
899 static void imhtml_changed_cb(GtkTextBuffer *buffer, void *data) | |
900 { | |
901 GtkGaimStatusBox *box = (GtkGaimStatusBox*)data; | |
11951 | 902 if (GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(box))) |
903 { | |
904 if (box->typing) { | |
905 gtk_gaim_status_box_pulse_typing(box); | |
906 g_source_remove(box->typing); | |
907 } | |
908 box->typing = g_timeout_add(3000, (GSourceFunc)remove_typing_cb, box); | |
10861 | 909 } |
10643 | 910 gtk_gaim_status_box_refresh(box); |
911 } | |
10649 | 912 |
11739 | 913 GtkGaimStatusBoxItemType gtk_gaim_status_box_get_active_type(GtkGaimStatusBox *status_box) |
10649 | 914 { |
915 GtkTreeIter iter; | |
11739 | 916 GtkGaimStatusBoxItemType type; |
10649 | 917 gtk_combo_box_get_active_iter(GTK_COMBO_BOX(status_box), &iter); |
10861 | 918 gtk_tree_model_get(GTK_TREE_MODEL(status_box->dropdown_store), &iter, |
10649 | 919 TYPE_COLUMN, &type, -1); |
920 return type; | |
921 } | |
922 | |
11638 | 923 char *gtk_gaim_status_box_get_message(GtkGaimStatusBox *status_box) |
10649 | 924 { |
925 if (status_box->imhtml_visible) | |
926 return gtk_imhtml_get_markup(GTK_IMHTML(status_box->imhtml)); | |
927 else | |
928 return NULL; | |
929 } |