comparison src/gtkstatusbox.c @ 11755:50496ebef401

[gaim-migrate @ 14046] This change allows text input in the gtkstatusbox whenever you select a status that has a "message" attribute on any of your enabled accounts. This allows you to enter available messages from AIM and Bonjour. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sun, 23 Oct 2005 16:28:31 +0000
parents 59ae71ae0b7c
children f54c680d835c
comparison
equal deleted inserted replaced
11754:55052a685da6 11755:50496ebef401
206 pixbuf = status_box->typing_pixbufs[status_box->typing_index]; 206 pixbuf = status_box->typing_pixbufs[status_box->typing_index];
207 else 207 else
208 pixbuf = status_box->pixbuf; 208 pixbuf = status_box->pixbuf;
209 209
210 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? */ 211 TYPE_COLUMN, -1, /* This field is not used in this list store */
212 ICON_COLUMN, pixbuf, 212 ICON_COLUMN, pixbuf,
213 TEXT_COLUMN, text, 213 TEXT_COLUMN, text,
214 TITLE_COLUMN, title, 214 TITLE_COLUMN, title,
215 DESC_COLUMN, status_box->desc, 215 DESC_COLUMN, status_box->desc,
216 -1); 216 -1);
237 * TODO: Find a way to fallback to the GaimStatusPrimitive 237 * TODO: Find a way to fallback to the GaimStatusPrimitive
238 * if an icon for this id does not exist. 238 * if an icon for this id does not exist.
239 */ 239 */
240 g_snprintf(basename2, sizeof(basename2), "%s.png", 240 g_snprintf(basename2, sizeof(basename2), "%s.png",
241 basename); 241 basename);
242
243
244 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "icons", 242 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "icons",
245 basename2, NULL); 243 basename2, NULL);
246 pixbuf = gdk_pixbuf_new_from_file(filename, NULL); 244 pixbuf = gdk_pixbuf_new_from_file(filename, NULL);
247 g_free(filename); 245 g_free(filename);
248 246
693 GtkGaimStatusBox *status_box; 691 GtkGaimStatusBox *status_box;
694 GtkTreeIter iter; 692 GtkTreeIter iter;
695 GtkGaimStatusBoxItemType type; 693 GtkGaimStatusBoxItemType type;
696 char *text, *sec_text; 694 char *text, *sec_text;
697 GdkPixbuf *pixbuf; 695 GdkPixbuf *pixbuf;
696 GList *accounts, *node;
698 697
699 status_box = GTK_GAIM_STATUS_BOX(box); 698 status_box = GTK_GAIM_STATUS_BOX(box);
700 699
701 gtk_combo_box_get_active_iter(GTK_COMBO_BOX(status_box), &iter); 700 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, 701 gtk_tree_model_get(GTK_TREE_MODEL(status_box->dropdown_store), &iter,
728 gaim_gtk_status_window_show(); 727 gaim_gtk_status_window_show();
729 return; 728 return;
730 } 729 }
731 730
732 /* 731 /*
733 * TODO: Should show the message box whenever 'type' allows 732 * Show the message box whenever 'type' allows for a
734 * for a message attribute on any protocol that is enabled. 733 * message attribute on any protocol that is enabled.
735 */ 734 */
736 if (type == GAIM_STATUS_AWAY) 735 accounts = gaim_accounts_get_all_active();
737 status_box->imhtml_visible = TRUE; 736 status_box->imhtml_visible = FALSE;
738 else 737 for (node = accounts; node != NULL; node = node->next)
739 status_box->imhtml_visible = FALSE; 738 {
739 GaimAccount *account;
740 GaimStatusType *status_type;
741
742 account = node->data;
743 status_type = gaim_account_get_status_type_with_primitive(account, type);
744 if ((status_type != NULL) &&
745 (gaim_status_type_get_attr(status_type, "message") != NULL))
746 {
747 status_box->imhtml_visible = TRUE;
748 break;
749 }
750 }
751 g_list_free(accounts);
740 752
741 if (status_box->imhtml_visible) 753 if (status_box->imhtml_visible)
742 { 754 {
743 gtk_widget_show_all(status_box->vbox); 755 gtk_widget_show_all(status_box->vbox);
744 status_box->typing = g_timeout_add(3000, (GSourceFunc)remove_typing_cb, status_box); 756 status_box->typing = g_timeout_add(3000, (GSourceFunc)remove_typing_cb, status_box);