comparison src/gtkstatusbox.c @ 11739:a25be0e70a67

[gaim-migrate @ 14030] I changed the GtkStatusBox list stores to use an enum instead of a string to identify the items in the GtkStatusBox. This feels a lot cleaner to me committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sun, 23 Oct 2005 06:46:07 +0000
parents 992d49cf2b92
children 59ae71ae0b7c
comparison
equal deleted inserted replaced
11738:992d49cf2b92 11739:a25be0e70a67
46 46
47 static void (*combo_box_size_request)(GtkWidget *widget, GtkRequisition *requisition); 47 static void (*combo_box_size_request)(GtkWidget *widget, GtkRequisition *requisition);
48 static void (*combo_box_size_allocate)(GtkWidget *widget, GtkAllocation *allocation); 48 static void (*combo_box_size_allocate)(GtkWidget *widget, GtkAllocation *allocation);
49 static gboolean (*combo_box_expose_event)(GtkWidget *widget, GdkEventExpose *event); 49 static gboolean (*combo_box_expose_event)(GtkWidget *widget, GdkEventExpose *event);
50 static void (*combo_box_forall) (GtkContainer *container, gboolean include_internals, GtkCallback callback, gpointer callback_data); 50 static void (*combo_box_forall) (GtkContainer *container, gboolean include_internals, GtkCallback callback, gpointer callback_data);
51
51 enum { 52 enum {
53 TYPE_COLUMN, /* A GtkGaimStatusBoxItemType */
52 ICON_COLUMN, /* This is a GdkPixbuf (the other columns are strings) */ 54 ICON_COLUMN, /* This is a GdkPixbuf (the other columns are strings) */
53 TEXT_COLUMN, /* A string */ 55 TEXT_COLUMN, /* A string */
54 TITLE_COLUMN, /* The plain-English title of this item */ 56 TITLE_COLUMN, /* The plain-English title of this item */
55 DESC_COLUMN, /* A plain-English description of this item */ 57 DESC_COLUMN, /* A plain-English description of this item */
56 TYPE_COLUMN, /* A text description of the GaimStatusPrimitive */
57 NUM_COLUMNS 58 NUM_COLUMNS
58 }; 59 };
59 60
60 enum { 61 enum {
61 PROP_0, 62 PROP_0,
205 pixbuf = status_box->typing_pixbufs[status_box->typing_index]; 206 pixbuf = status_box->typing_pixbufs[status_box->typing_index];
206 else 207 else
207 pixbuf = status_box->pixbuf; 208 pixbuf = status_box->pixbuf;
208 209
209 gtk_list_store_set(status_box->store, &(status_box->iter), 210 gtk_list_store_set(status_box->store, &(status_box->iter),
211 TYPE_COLUMN, -1, /* TODO: Should use something real here? */
210 ICON_COLUMN, pixbuf, 212 ICON_COLUMN, pixbuf,
211 TEXT_COLUMN, text, 213 TEXT_COLUMN, text,
212 TITLE_COLUMN, title, 214 TITLE_COLUMN, title,
213 DESC_COLUMN, status_box->desc, 215 DESC_COLUMN, status_box->desc,
214 TYPE_COLUMN, NULL, -1); 216 -1);
215 path = gtk_tree_path_new_from_string("0"); 217 path = gtk_tree_path_new_from_string("0");
216 gtk_cell_view_set_displayed_row(GTK_CELL_VIEW(status_box->cell_view), path); 218 gtk_cell_view_set_displayed_row(GTK_CELL_VIEW(status_box->cell_view), path);
217 gtk_tree_path_free(path); 219 gtk_tree_path_free(path);
218 220
219 g_free(text); 221 g_free(text);
260 } 262 }
261 263
262 static void 264 static void
263 gtk_gaim_status_box_regenerate(GtkGaimStatusBox *status_box) 265 gtk_gaim_status_box_regenerate(GtkGaimStatusBox *status_box)
264 { 266 {
267 GaimAccount *account;
265 GdkPixbuf *pixbuf, *pixbuf2, *pixbuf3, *pixbuf4; 268 GdkPixbuf *pixbuf, *pixbuf2, *pixbuf3, *pixbuf4;
266 GtkIconSize icon_size; 269 GtkIconSize icon_size;
267 const char *current_savedstatus_name; 270 const char *current_savedstatus_name;
268 GaimSavedStatus *saved_status; 271 GaimSavedStatus *saved_status;
269 272
270
271 icon_size = gtk_icon_size_from_name(GAIM_ICON_SIZE_STATUS); 273 icon_size = gtk_icon_size_from_name(GAIM_ICON_SIZE_STATUS);
272 274
273 gtk_list_store_clear(status_box->dropdown_store); 275 gtk_list_store_clear(status_box->dropdown_store);
274 276
275 if (!(GTK_GAIM_STATUS_BOX(status_box)->account)) { 277 account = GTK_GAIM_STATUS_BOX(status_box)->account;
278 if (account == NULL)
279 {
276 pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box), GAIM_STOCK_STATUS_ONLINE, 280 pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box), GAIM_STOCK_STATUS_ONLINE,
277 icon_size, "GtkGaimStatusBox"); 281 icon_size, "GtkGaimStatusBox");
278 pixbuf2 = gtk_widget_render_icon (GTK_WIDGET(status_box), GAIM_STOCK_STATUS_AWAY, 282 pixbuf2 = gtk_widget_render_icon (GTK_WIDGET(status_box), GAIM_STOCK_STATUS_AWAY,
279 icon_size, "GtkGaimStatusBox"); 283 icon_size, "GtkGaimStatusBox");
280 pixbuf3 = gtk_widget_render_icon (GTK_WIDGET(status_box), GAIM_STOCK_STATUS_OFFLINE, 284 pixbuf3 = gtk_widget_render_icon (GTK_WIDGET(status_box), GAIM_STOCK_STATUS_OFFLINE,
281 icon_size, "GtkGaimStatusBox"); 285 icon_size, "GtkGaimStatusBox");
282 pixbuf4 = gtk_widget_render_icon (GTK_WIDGET(status_box), GAIM_STOCK_STATUS_INVISIBLE, 286 pixbuf4 = gtk_widget_render_icon (GTK_WIDGET(status_box), GAIM_STOCK_STATUS_INVISIBLE,
283 icon_size, "GtkGaimStatusBox"); 287 icon_size, "GtkGaimStatusBox");
284 /* hacks */ 288 /* hacks */
285 gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box), pixbuf, _("Available"), NULL, "available"); 289 gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box), GAIM_STATUS_AVAILABLE, pixbuf, _("Available"), NULL);
286 gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box), pixbuf2, _("Away"), NULL, "away"); 290 gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box), GAIM_STATUS_AWAY, pixbuf2, _("Away"), NULL);
287 gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box), pixbuf4, _("Invisible"), NULL, "invisible"); 291 gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box), GAIM_STATUS_HIDDEN, pixbuf4, _("Invisible"), NULL);
288 gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box), pixbuf3, _("Offline"), NULL, "offline"); 292 gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box), GAIM_STATUS_OFFLINE, pixbuf3, _("Offline"), NULL);
289 gtk_gaim_status_box_add_separator(GTK_GAIM_STATUS_BOX(status_box)); 293 gtk_gaim_status_box_add_separator(GTK_GAIM_STATUS_BOX(status_box));
290 gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box), pixbuf, _("Custom..."), NULL, "custom"); 294 gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box), GTK_GAIM_STATUS_BOX_TYPE_CUSTOM, pixbuf, _("Custom..."), NULL);
291 gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box), pixbuf, _("Saved..."), NULL, "saved"); 295 gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box), GTK_GAIM_STATUS_BOX_TYPE_SAVED, pixbuf, _("Saved..."), NULL);
292 296
293 current_savedstatus_name = gaim_prefs_get_string("/core/status/current"); 297 current_savedstatus_name = gaim_prefs_get_string("/core/status/current");
294 saved_status = gaim_savedstatus_find(current_savedstatus_name); 298 saved_status = gaim_savedstatus_find(current_savedstatus_name);
295 if (saved_status == NULL) 299 if (saved_status == NULL)
296 { 300 {
329 } 333 }
330 334
331 335
332 } else { 336 } else {
333 const GList *l; 337 const GList *l;
334 for (l = gaim_account_get_status_types(GTK_GAIM_STATUS_BOX(status_box)->account); l != NULL; l = l->next) { 338
339 for (l = gaim_account_get_status_types(account); l != NULL; l = l->next)
340 {
335 GaimStatusType *status_type = (GaimStatusType *)l->data; 341 GaimStatusType *status_type = (GaimStatusType *)l->data;
336 342
337 if (!gaim_status_type_is_user_settable(status_type)) 343 if (!gaim_status_type_is_user_settable(status_type))
338 continue; 344 continue;
339 345
340 gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box), load_icon(gaim_status_type_get_id(status_type)), 346 gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box),
341 gaim_status_type_get_name(status_type), 347 gaim_status_type_get_primitive(status_type),
342 NULL, 348 load_icon(gaim_status_type_get_id(status_type)),
343 gaim_status_type_get_id(status_type)); 349 gaim_status_type_get_name(status_type),
344 350 NULL);
345 } 351 }
346 } 352 }
347 353
348 } 354 }
349 355
350 static gboolean 356 static gboolean
351 dropdown_store_row_separator_func(GtkTreeModel *model, 357 dropdown_store_row_separator_func(GtkTreeModel *model,
352 GtkTreeIter *iter, gpointer data) 358 GtkTreeIter *iter, gpointer data)
353 { 359 {
360 GtkGaimStatusBoxItemType type;
354 GdkPixbuf *pixbuf; 361 GdkPixbuf *pixbuf;
355 gchar *text, *title, *description, *status_type_id; 362 gchar *text, *title, *description;
356 363
357 gtk_tree_model_get(model, iter, 364 gtk_tree_model_get(model, iter,
365 TYPE_COLUMN, &type,
358 ICON_COLUMN, &pixbuf, 366 ICON_COLUMN, &pixbuf,
359 TEXT_COLUMN, &text, 367 TEXT_COLUMN, &text,
360 TITLE_COLUMN, &title, 368 TITLE_COLUMN, &title,
361 DESC_COLUMN, &description, 369 DESC_COLUMN, &description,
362 TYPE_COLUMN, &status_type_id,
363 -1); 370 -1);
364 371
365 if ((pixbuf == NULL) && (text == NULL) && (title == NULL) && 372 if (type == GTK_GAIM_STATUS_BOX_TYPE_SEPARATOR)
366 (description == NULL) && (status_type_id != NULL) &&
367 !strcmp(status_type_id, "separator"))
368 {
369 return TRUE; 373 return TRUE;
370 }
371 374
372 return FALSE; 375 return FALSE;
373 } 376 }
374 377
375 static void 378 static void
412 status_box->title = NULL; 415 status_box->title = NULL;
413 status_box->pixbuf = NULL; 416 status_box->pixbuf = NULL;
414 status_box->cell_view = gtk_cell_view_new(); 417 status_box->cell_view = gtk_cell_view_new();
415 gtk_widget_show (status_box->cell_view); 418 gtk_widget_show (status_box->cell_view);
416 419
417 status_box->store = gtk_list_store_new(NUM_COLUMNS, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING); 420 status_box->store = gtk_list_store_new(NUM_COLUMNS, G_TYPE_INT, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
418 status_box->dropdown_store = gtk_list_store_new(NUM_COLUMNS, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING); 421 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);
419 gtk_combo_box_set_row_separator_func(GTK_COMBO_BOX(status_box), dropdown_store_row_separator_func, NULL, NULL); 422 gtk_combo_box_set_row_separator_func(GTK_COMBO_BOX(status_box), dropdown_store_row_separator_func, NULL, NULL);
420 gtk_combo_box_set_model(GTK_COMBO_BOX(status_box), GTK_TREE_MODEL(status_box->dropdown_store)); 423 gtk_combo_box_set_model(GTK_COMBO_BOX(status_box), GTK_TREE_MODEL(status_box->dropdown_store));
421 gtk_cell_view_set_model(GTK_CELL_VIEW(status_box->cell_view), GTK_TREE_MODEL(status_box->store)); 424 gtk_cell_view_set_model(GTK_CELL_VIEW(status_box->cell_view), GTK_TREE_MODEL(status_box->store));
422 gtk_combo_box_set_wrap_width(GTK_COMBO_BOX(status_box), 0); 425 gtk_combo_box_set_wrap_width(GTK_COMBO_BOX(status_box), 0);
423 gtk_list_store_append(status_box->store, &(status_box->iter)); 426 gtk_list_store_append(status_box->store, &(status_box->iter));
535 { 538 {
536 return g_object_new(GTK_GAIM_TYPE_STATUS_BOX, "account", account, NULL); 539 return g_object_new(GTK_GAIM_TYPE_STATUS_BOX, "account", account, NULL);
537 } 540 }
538 541
539 void 542 void
540 gtk_gaim_status_box_add(GtkGaimStatusBox *status_box, GdkPixbuf *pixbuf, const char *text, const char *sec_text, const char *edit) 543 gtk_gaim_status_box_add(GtkGaimStatusBox *status_box, GtkGaimStatusBoxItemType type, GdkPixbuf *pixbuf, const char *text, const char *sec_text)
541 { 544 {
542 GtkTreeIter iter; 545 GtkTreeIter iter;
543 char *t; 546 char *t;
544 547
545 if (sec_text) { 548 if (sec_text) {
554 t = g_strdup(text); 557 t = g_strdup(text);
555 } 558 }
556 559
557 gtk_list_store_append(status_box->dropdown_store, &iter); 560 gtk_list_store_append(status_box->dropdown_store, &iter);
558 gtk_list_store_set(status_box->dropdown_store, &iter, 561 gtk_list_store_set(status_box->dropdown_store, &iter,
562 TYPE_COLUMN, type,
559 ICON_COLUMN, pixbuf, 563 ICON_COLUMN, pixbuf,
560 TEXT_COLUMN, t, 564 TEXT_COLUMN, t,
561 TITLE_COLUMN, text, 565 TITLE_COLUMN, text,
562 DESC_COLUMN, sec_text, 566 DESC_COLUMN, sec_text,
563 TYPE_COLUMN, edit, -1); 567 -1);
564 g_free(t); 568 g_free(t);
565 } 569 }
566 570
567 void 571 void
568 gtk_gaim_status_box_add_separator(GtkGaimStatusBox *status_box) 572 gtk_gaim_status_box_add_separator(GtkGaimStatusBox *status_box)
569 { 573 {
570 GtkTreeIter iter; 574 GtkTreeIter iter;
571 575
572 gtk_list_store_append(status_box->dropdown_store, &iter); 576 gtk_list_store_append(status_box->dropdown_store, &iter);
573 gtk_list_store_set(status_box->dropdown_store, &iter, 577 gtk_list_store_set(status_box->dropdown_store, &iter,
574 ICON_COLUMN, NULL, 578 TYPE_COLUMN, GTK_GAIM_STATUS_BOX_TYPE_SEPARATOR,
575 TEXT_COLUMN, NULL, 579 -1);
576 TITLE_COLUMN, NULL,
577 DESC_COLUMN, NULL,
578 TYPE_COLUMN, "separator", -1);
579 } 580 }
580 581
581 void 582 void
582 gtk_gaim_status_box_set_error(GtkGaimStatusBox *status_box, const gchar *error) 583 gtk_gaim_status_box_set_error(GtkGaimStatusBox *status_box, const gchar *error)
583 { 584 {
619 } 620 }
620 621
621 static void 622 static void
622 activate_currently_selected_status(GtkGaimStatusBox *status_box) 623 activate_currently_selected_status(GtkGaimStatusBox *status_box)
623 { 624 {
624 gchar *status_type_id, *title; 625 GtkGaimStatusBoxItemType type;
626 gchar *title;
625 GList *l; 627 GList *l;
626 GtkTreeIter iter; 628 GtkTreeIter iter;
627 GaimStatusPrimitive primitive;
628 char *message; 629 char *message;
629 GaimSavedStatus *saved_status; 630 GaimSavedStatus *saved_status;
630 int active_row;
631 631
632 gtk_combo_box_get_active_iter(GTK_COMBO_BOX(status_box), &iter); 632 gtk_combo_box_get_active_iter(GTK_COMBO_BOX(status_box), &iter);
633 gtk_tree_model_get(GTK_TREE_MODEL(status_box->dropdown_store), &iter, 633 gtk_tree_model_get(GTK_TREE_MODEL(status_box->dropdown_store), &iter,
634 TYPE_COLUMN, &status_type_id, 634 TYPE_COLUMN, &type,
635 TITLE_COLUMN, &title, -1); 635 TITLE_COLUMN, &title, -1);
636 message = gtk_gaim_status_box_get_message(status_box); 636 message = gtk_gaim_status_box_get_message(status_box);
637 active_row = gtk_combo_box_get_active(GTK_COMBO_BOX(status_box)); 637
638 if (active_row == 0) 638 /*
639 primitive = GAIM_STATUS_AVAILABLE; 639 * If the currently selected status is "Custom..." or
640 else if (active_row == 1) 640 * "Saved..." then do nothing.
641 primitive = GAIM_STATUS_AWAY; 641 */
642 else if (active_row == 2) 642 if ((type < 0) || (type >= GAIM_STATUS_NUM_PRIMITIVES))
643 primitive = GAIM_STATUS_HIDDEN; 643 return;
644 else if (active_row == 3)
645 primitive = GAIM_STATUS_OFFLINE;
646 else
647 primitive = GAIM_STATUS_AVAILABLE;
648 644
649 /* TODO: Should save the previous status as a transient status? */ 645 /* TODO: Should save the previous status as a transient status? */
650 646
651 /* Save the newly selected status to prefs.xml and status.xml */ 647 /* Save the newly selected status to prefs.xml and status.xml */
652 saved_status = gaim_savedstatus_find(_("Default")); 648 saved_status = gaim_savedstatus_find(_("Default"));
653 if (saved_status == NULL) 649 if (saved_status == NULL)
654 saved_status = gaim_savedstatus_new(_("Default"), primitive); 650 saved_status = gaim_savedstatus_new(_("Default"), type);
655 gaim_savedstatus_set_type(saved_status, primitive); 651 gaim_savedstatus_set_type(saved_status, type);
656 gaim_savedstatus_set_message(saved_status, message); 652 gaim_savedstatus_set_message(saved_status, message);
657 gaim_prefs_set_string("/core/status/current", _("Default")); 653 gaim_prefs_set_string("/core/status/current", _("Default"));
658 654
659 /* Set the status for each account */ 655 /* Set the status for each account */
660 for (l = gaim_accounts_get_all(); l != NULL; l = l->next) 656 for (l = gaim_accounts_get_all(); l != NULL; l = l->next)
663 GaimStatusType *status_type; 659 GaimStatusType *status_type;
664 660
665 if (!gaim_account_get_enabled(account, GAIM_GTK_UI)) 661 if (!gaim_account_get_enabled(account, GAIM_GTK_UI))
666 continue; 662 continue;
667 663
668 status_type = gaim_account_get_status_type(account, status_type_id); 664 status_type = gaim_account_get_status_type_with_primitive(account, type);
669 665
670 if (status_type == NULL) 666 if (status_type == NULL)
671 continue; 667 continue;
672 668
673 gaim_account_set_status(account, status_type_id, TRUE, 669 gaim_account_set_status(account,
674 "message", message, NULL); 670 gaim_status_type_get_id(status_type),
675 } 671 TRUE, "message", message, NULL);
676 672 }
677 g_free(status_type_id); 673
678 g_free(title); 674 g_free(title);
679 g_free(message); 675 g_free(message);
680 } 676 }
681 677
682 static void remove_typing_cb(GtkGaimStatusBox *status_box) 678 static void remove_typing_cb(GtkGaimStatusBox *status_box)
690 686
691 static void gtk_gaim_status_box_changed(GtkComboBox *box) 687 static void gtk_gaim_status_box_changed(GtkComboBox *box)
692 { 688 {
693 GtkGaimStatusBox *status_box; 689 GtkGaimStatusBox *status_box;
694 GtkTreeIter iter; 690 GtkTreeIter iter;
691 GtkGaimStatusBoxItemType type;
695 char *text, *sec_text; 692 char *text, *sec_text;
696 GdkPixbuf *pixbuf; 693 GdkPixbuf *pixbuf;
697 gchar *status_type_id;
698 694
699 status_box = GTK_GAIM_STATUS_BOX(box); 695 status_box = GTK_GAIM_STATUS_BOX(box);
700 696
701 gtk_combo_box_get_active_iter(GTK_COMBO_BOX(status_box), &iter); 697 gtk_combo_box_get_active_iter(GTK_COMBO_BOX(status_box), &iter);
702 gtk_tree_model_get(GTK_TREE_MODEL(status_box->dropdown_store), &iter, TITLE_COLUMN, &text, 698 gtk_tree_model_get(GTK_TREE_MODEL(status_box->dropdown_store), &iter,
699 TYPE_COLUMN, &type,
700 TITLE_COLUMN, &text,
703 DESC_COLUMN, &sec_text, ICON_COLUMN, &pixbuf, 701 DESC_COLUMN, &sec_text, ICON_COLUMN, &pixbuf,
704 TYPE_COLUMN, &status_type_id, -1); 702 -1);
705 if (status_box->title) 703 if (status_box->title)
706 g_free(status_box->title); 704 g_free(status_box->title);
707 status_box->title = text; 705 status_box->title = text;
708 if (status_box->desc && sec_text) 706 if (status_box->desc && sec_text)
709 g_free(status_box->desc); 707 g_free(status_box->desc);
713 status_box->pixbuf = pixbuf; 711 status_box->pixbuf = pixbuf;
714 if (status_box->typing) 712 if (status_box->typing)
715 g_source_remove(status_box->typing); 713 g_source_remove(status_box->typing);
716 status_box->typing = 0; 714 status_box->typing = 0;
717 715
718 if (!strcmp(status_type_id, "custom")) 716 if (type == GTK_GAIM_STATUS_BOX_TYPE_CUSTOM)
719 { 717 {
720 gaim_gtk_status_editor_show(NULL); 718 gaim_gtk_status_editor_show(NULL);
721 return; 719 return;
722 } 720 }
723 721
724 if (!strcmp(status_type_id, "saved")) 722 if (type == GTK_GAIM_STATUS_BOX_TYPE_SAVED)
725 { 723 {
726 gaim_gtk_status_window_show(); 724 gaim_gtk_status_window_show();
727 return; 725 return;
728 } 726 }
729 727
730 /* 728 /*
731 * TODO: Should show the message box whenever status_type_id allows 729 * TODO: Should show the message box whenever 'type' allows
732 * for a message attribute on any protocol that is enabled. 730 * for a message attribute on any protocol that is enabled.
733 */ 731 */
734 if (!strcmp(status_type_id, "away")) 732 if (type == GAIM_STATUS_AWAY)
735 status_box->imhtml_visible = TRUE; 733 status_box->imhtml_visible = TRUE;
736 else 734 else
737 status_box->imhtml_visible = FALSE; 735 status_box->imhtml_visible = FALSE;
738 736
739 if (status_box->imhtml_visible) 737 if (status_box->imhtml_visible)
746 else 744 else
747 { 745 {
748 gtk_widget_hide_all(status_box->vbox); 746 gtk_widget_hide_all(status_box->vbox);
749 activate_currently_selected_status(status_box); 747 activate_currently_selected_status(status_box);
750 } 748 }
751 g_free(status_type_id);
752 gtk_gaim_status_box_refresh(status_box); 749 gtk_gaim_status_box_refresh(status_box);
753 } 750 }
754 751
755 static void imhtml_changed_cb(GtkTextBuffer *buffer, void *data) 752 static void imhtml_changed_cb(GtkTextBuffer *buffer, void *data)
756 { 753 {
761 } 758 }
762 box->typing = g_timeout_add(3000, (GSourceFunc)remove_typing_cb, box); 759 box->typing = g_timeout_add(3000, (GSourceFunc)remove_typing_cb, box);
763 gtk_gaim_status_box_refresh(box); 760 gtk_gaim_status_box_refresh(box);
764 } 761 }
765 762
766 char *gtk_gaim_status_box_get_active_type(GtkGaimStatusBox *status_box) 763 GtkGaimStatusBoxItemType gtk_gaim_status_box_get_active_type(GtkGaimStatusBox *status_box)
767 { 764 {
768 GtkTreeIter iter; 765 GtkTreeIter iter;
769 char *type; 766 GtkGaimStatusBoxItemType type;
770 gtk_combo_box_get_active_iter(GTK_COMBO_BOX(status_box), &iter); 767 gtk_combo_box_get_active_iter(GTK_COMBO_BOX(status_box), &iter);
771 gtk_tree_model_get(GTK_TREE_MODEL(status_box->dropdown_store), &iter, 768 gtk_tree_model_get(GTK_TREE_MODEL(status_box->dropdown_store), &iter,
772 TYPE_COLUMN, &type, -1); 769 TYPE_COLUMN, &type, -1);
773 return type; 770 return type;
774 } 771 }