comparison src/gtkstatusbox.c @ 10861:42c16b293867

[gaim-migrate @ 12544] White McSpacen committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sun, 24 Apr 2005 19:52:29 +0000
parents 3839df4f7074
children c072be05e7ba
comparison
equal deleted inserted replaced
10860:d01d81de94d8 10861:42c16b293867
55 static void gtk_gaim_status_box_init (GtkGaimStatusBox *status_box); 55 static void gtk_gaim_status_box_init (GtkGaimStatusBox *status_box);
56 56
57 GType 57 GType
58 gtk_gaim_status_box_get_type (void) 58 gtk_gaim_status_box_get_type (void)
59 { 59 {
60 static GType status_box_type = 0; 60 static GType status_box_type = 0;
61 61
62 if (!status_box_type) 62 if (!status_box_type)
63 { 63 {
64 static const GTypeInfo status_box_info = 64 static const GTypeInfo status_box_info =
65 { 65 {
66 sizeof (GtkGaimStatusBoxClass), 66 sizeof (GtkGaimStatusBoxClass),
67 NULL, /* base_init */ 67 NULL, /* base_init */
68 NULL, /* base_finalize */ 68 NULL, /* base_finalize */
69 (GClassInitFunc) gtk_gaim_status_box_class_init, 69 (GClassInitFunc) gtk_gaim_status_box_class_init,
70 NULL, /* class_finalize */ 70 NULL, /* class_finalize */
71 NULL, /* class_data */ 71 NULL, /* class_data */
72 sizeof (GtkGaimStatusBox), 72 sizeof (GtkGaimStatusBox),
73 0, 73 0,
74 (GInstanceInitFunc) gtk_gaim_status_box_init 74 (GInstanceInitFunc) gtk_gaim_status_box_init
75 }; 75 };
76 76
77 status_box_type = g_type_register_static (GTK_TYPE_COMBO_BOX, 77 status_box_type = g_type_register_static(GTK_TYPE_COMBO_BOX,
78 "GtkGaimStatusBox", 78 "GtkGaimStatusBox",
79 &status_box_info, 79 &status_box_info,
80 0); 80 0);
81 } 81 }
82 82
83 return status_box_type; 83 return status_box_type;
84 } 84 }
85 85
86 static void 86 static void
87 gtk_gaim_status_box_class_init (GtkGaimStatusBoxClass *klass) 87 gtk_gaim_status_box_class_init (GtkGaimStatusBoxClass *klass)
88 { 88 {
89 GObjectClass *object_class; 89 GObjectClass *object_class;
90 GtkWidgetClass *widget_class; 90 GtkWidgetClass *widget_class;
91 GtkComboBoxClass *parent_class = (GtkComboBoxClass*)klass; 91 GtkComboBoxClass *parent_class = (GtkComboBoxClass*)klass;
92 GtkContainerClass *container_class = (GtkContainerClass*)klass; 92 GtkContainerClass *container_class = (GtkContainerClass*)klass;
93 93
94 parent_class->changed = gtk_gaim_status_box_changed; 94 parent_class->changed = gtk_gaim_status_box_changed;
95 widget_class = (GtkWidgetClass*)klass; 95 widget_class = (GtkWidgetClass*)klass;
96 combo_box_size_request = widget_class->size_request; 96 combo_box_size_request = widget_class->size_request;
97 widget_class->size_request = gtk_gaim_status_box_size_request; 97 widget_class->size_request = gtk_gaim_status_box_size_request;
98 combo_box_size_allocate = widget_class->size_allocate; 98 combo_box_size_allocate = widget_class->size_allocate;
99 widget_class->size_allocate = gtk_gaim_status_box_size_allocate; 99 widget_class->size_allocate = gtk_gaim_status_box_size_allocate;
100 combo_box_expose_event = widget_class->expose_event; 100 combo_box_expose_event = widget_class->expose_event;
101 widget_class->expose_event = gtk_gaim_status_box_expose_event; 101 widget_class->expose_event = gtk_gaim_status_box_expose_event;
102 102
103 combo_box_forall = container_class->forall; 103 combo_box_forall = container_class->forall;
104 container_class->forall = gtk_gaim_status_box_forall; 104 container_class->forall = gtk_gaim_status_box_forall;
105 105
106 object_class = (GObjectClass *)klass; 106 object_class = (GObjectClass *)klass;
107 } 107 }
108 108
109 static void 109 static void
110 gtk_gaim_status_box_refresh(GtkGaimStatusBox *status_box) 110 gtk_gaim_status_box_refresh(GtkGaimStatusBox *status_box)
111 { 111 {
124 if (!title) 124 if (!title)
125 title = ""; 125 title = "";
126 126
127 if (status_box->error) { 127 if (status_box->error) {
128 text = g_strdup_printf("%s\n<span size=\"smaller\" weight=\"bold\" color=\"red\">%s</span>", 128 text = g_strdup_printf("%s\n<span size=\"smaller\" weight=\"bold\" color=\"red\">%s</span>",
129 title, status_box->error); 129 title, status_box->error);
130 } else if (status_box->typing) { 130 } else if (status_box->typing) {
131 text = g_strdup_printf("%s\n<span size=\"smaller\" color=\"%s\">%s</span>", 131 text = g_strdup_printf("%s\n<span size=\"smaller\" color=\"%s\">%s</span>",
132 title, 132 title, aa_color, _("Typing"));
133 aa_color,
134 _("Typing"));
135 } else if (status_box->connecting) { 133 } else if (status_box->connecting) {
136 text = g_strdup_printf("%s\n<span size=\"smaller\" color=\"%s\">%s</span>", 134 text = g_strdup_printf("%s\n<span size=\"smaller\" color=\"%s\">%s</span>",
137 title, 135 title, aa_color, _("Connecting"));
138 aa_color, 136 } else if (status_box->desc) {
139 _("Connecting")); 137 text = g_strdup_printf("%s\n<span size=\"smaller\" color=\"%s\">%s</span>",
140 } else if (status_box->desc) { 138 title, aa_color, status_box->desc);
141 text = g_strdup_printf("%s\n<span size=\"smaller\" color=\"%s\">%s</span>",
142 title, aa_color, status_box->desc);
143 } else { 139 } else {
144 text = g_strdup_printf("%s", title); 140 text = g_strdup_printf("%s", title);
145 } 141 }
146 142
147 if (status_box->error) 143 if (status_box->error)
148 pixbuf = status_box->error_pixbuf; 144 pixbuf = status_box->error_pixbuf;
149 else if (status_box->typing) 145 else if (status_box->typing)
150 pixbuf = status_box->typing_pixbufs[status_box->typing_index]; 146 pixbuf = status_box->typing_pixbufs[status_box->typing_index];
151 else if (status_box->connecting) 147 else if (status_box->connecting)
152 pixbuf = status_box->connecting_pixbufs[status_box->connecting_index]; 148 pixbuf = status_box->connecting_pixbufs[status_box->connecting_index];
153 else 149 else
154 pixbuf = status_box->pixbuf; 150 pixbuf = status_box->pixbuf;
155 151
156 gtk_list_store_set(status_box->store, &(status_box->iter), 152 gtk_list_store_set(status_box->store, &(status_box->iter),
157 ICON_COLUMN, pixbuf, 153 ICON_COLUMN, pixbuf,
158 TEXT_COLUMN, text, 154 TEXT_COLUMN, text,
159 TITLE_COLUMN, title, 155 TITLE_COLUMN, title,
160 DESC_COLUMN, status_box->desc, 156 DESC_COLUMN, status_box->desc,
161 TYPE_COLUMN, NULL, -1); 157 TYPE_COLUMN, NULL, -1);
162 path = gtk_tree_path_new_from_string("0"); 158 path = gtk_tree_path_new_from_string("0");
163 gtk_cell_view_set_displayed_row(GTK_CELL_VIEW(status_box->cell_view), path); 159 gtk_cell_view_set_displayed_row(GTK_CELL_VIEW(status_box->cell_view), path);
164 gtk_tree_path_free(path); 160 gtk_tree_path_free(path);
165 161
177 173
178 status_box->imhtml_visible = FALSE; 174 status_box->imhtml_visible = FALSE;
179 status_box->error_pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box), GAIM_STOCK_STATUS_OFFLINE, 175 status_box->error_pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box), GAIM_STOCK_STATUS_OFFLINE,
180 icon_size, "GtkGaimStatusBox"); 176 icon_size, "GtkGaimStatusBox");
181 status_box->connecting_index = 0; 177 status_box->connecting_index = 0;
182 status_box->connecting_pixbufs[0] = gtk_widget_render_icon (GTK_WIDGET(status_box), GAIM_STOCK_STATUS_CONNECT0, 178 status_box->connecting_pixbufs[0] = gtk_widget_render_icon (GTK_WIDGET(status_box), GAIM_STOCK_STATUS_CONNECT0,
183 icon_size, "GtkGaimStatusBox"); 179 icon_size, "GtkGaimStatusBox");
184 status_box->connecting_pixbufs[1] = gtk_widget_render_icon (GTK_WIDGET(status_box), GAIM_STOCK_STATUS_CONNECT1, 180 status_box->connecting_pixbufs[1] = gtk_widget_render_icon (GTK_WIDGET(status_box), GAIM_STOCK_STATUS_CONNECT1,
185 icon_size, "GtkGaimStatusBox"); 181 icon_size, "GtkGaimStatusBox");
186 status_box->connecting_pixbufs[2] = gtk_widget_render_icon (GTK_WIDGET(status_box), GAIM_STOCK_STATUS_CONNECT2, 182 status_box->connecting_pixbufs[2] = gtk_widget_render_icon (GTK_WIDGET(status_box), GAIM_STOCK_STATUS_CONNECT2,
187 icon_size, "GtkGaimStatusBox"); 183 icon_size, "GtkGaimStatusBox");
188 status_box->connecting_pixbufs[3] = gtk_widget_render_icon (GTK_WIDGET(status_box), GAIM_STOCK_STATUS_CONNECT3, 184 status_box->connecting_pixbufs[3] = gtk_widget_render_icon (GTK_WIDGET(status_box), GAIM_STOCK_STATUS_CONNECT3,
189 icon_size, "GtkGaimStatusBox"); 185 icon_size, "GtkGaimStatusBox");
190 186
191 status_box->typing_index = 0; 187 status_box->typing_index = 0;
192 status_box->typing_pixbufs[0] = gtk_widget_render_icon (GTK_WIDGET(status_box), GAIM_STOCK_STATUS_TYPING0, 188 status_box->typing_pixbufs[0] = gtk_widget_render_icon (GTK_WIDGET(status_box), GAIM_STOCK_STATUS_TYPING0,
193 icon_size, "GtkGaimStatusBox"); 189 icon_size, "GtkGaimStatusBox");
198 status_box->typing_pixbufs[3] = gtk_widget_render_icon (GTK_WIDGET(status_box), GAIM_STOCK_STATUS_TYPING3, 194 status_box->typing_pixbufs[3] = gtk_widget_render_icon (GTK_WIDGET(status_box), GAIM_STOCK_STATUS_TYPING3,
199 icon_size, "GtkGaimStatusBox"); 195 icon_size, "GtkGaimStatusBox");
200 status_box->connecting = FALSE; 196 status_box->connecting = FALSE;
201 status_box->typing = FALSE; 197 status_box->typing = FALSE;
202 status_box->title = NULL; 198 status_box->title = NULL;
203 status_box->pixbuf = NULL; 199 status_box->pixbuf = NULL;
204 status_box->cell_view = gtk_cell_view_new(); 200 status_box->cell_view = gtk_cell_view_new();
205 gtk_widget_show (status_box->cell_view); 201 gtk_widget_show (status_box->cell_view);
206 202
207 status_box->store = gtk_list_store_new(NUM_COLUMNS, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING); 203 status_box->store = gtk_list_store_new(NUM_COLUMNS, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
208 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); 204 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);
209 gtk_combo_box_set_model(GTK_COMBO_BOX(status_box), GTK_TREE_MODEL(status_box->dropdown_store)); 205 gtk_combo_box_set_model(GTK_COMBO_BOX(status_box), GTK_TREE_MODEL(status_box->dropdown_store));
210 gtk_cell_view_set_model(GTK_CELL_VIEW(status_box->cell_view), GTK_TREE_MODEL(status_box->store)); 206 gtk_cell_view_set_model(GTK_CELL_VIEW(status_box->cell_view), GTK_TREE_MODEL(status_box->store));
211 gtk_combo_box_set_wrap_width(GTK_COMBO_BOX(status_box), 0); 207 gtk_combo_box_set_wrap_width(GTK_COMBO_BOX(status_box), 0);
212 gtk_list_store_append(status_box->store, &(status_box->iter)); 208 gtk_list_store_append(status_box->store, &(status_box->iter));
213 gtk_gaim_status_box_refresh(status_box); 209 gtk_gaim_status_box_refresh(status_box);
214 gtk_cell_view_set_displayed_row(GTK_CELL_VIEW(status_box->cell_view), gtk_tree_path_new_from_string("0")); 210 gtk_cell_view_set_displayed_row(GTK_CELL_VIEW(status_box->cell_view), gtk_tree_path_new_from_string("0"));
215 gtk_container_add(GTK_CONTAINER(status_box), status_box->cell_view); 211 gtk_container_add(GTK_CONTAINER(status_box), status_box->cell_view);
216 212
217 status_box->icon_rend = gtk_cell_renderer_pixbuf_new(); 213 status_box->icon_rend = gtk_cell_renderer_pixbuf_new();
218 status_box->text_rend = gtk_cell_renderer_text_new(); 214 status_box->text_rend = gtk_cell_renderer_text_new();
219 215
220 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(status_box), icon_rend, FALSE); 216 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(status_box), icon_rend, FALSE);
221 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(status_box), text_rend, TRUE); 217 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(status_box), text_rend, TRUE);
222 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(status_box), icon_rend, "pixbuf", ICON_COLUMN, NULL); 218 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(status_box), icon_rend, "pixbuf", ICON_COLUMN, NULL);
223 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(status_box), text_rend, "markup", TEXT_COLUMN, NULL); 219 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(status_box), text_rend, "markup", TEXT_COLUMN, NULL);
224 220
225 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(status_box->cell_view), status_box->icon_rend, FALSE); 221 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(status_box->cell_view), status_box->icon_rend, FALSE);
226 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(status_box->cell_view), status_box->text_rend, TRUE); 222 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(status_box->cell_view), status_box->text_rend, TRUE);
255 251
256 } 252 }
257 253
258 254
259 static void 255 static void
260 gtk_gaim_status_box_size_request (GtkWidget *widget, 256 gtk_gaim_status_box_size_request(GtkWidget *widget,
261 GtkRequisition *requisition) 257 GtkRequisition *requisition)
262 { 258 {
263 GtkRequisition box_req; 259 GtkRequisition box_req;
264 combo_box_size_request(widget, requisition); 260 combo_box_size_request(widget, requisition);
265 261
266 gtk_widget_size_request(GTK_GAIM_STATUS_BOX(widget)->vbox, &box_req); 262 gtk_widget_size_request(GTK_GAIM_STATUS_BOX(widget)->vbox, &box_req);
267 if (box_req.height > 1) 263 if (box_req.height > 1)
268 requisition->height = requisition->height + box_req.height + 6; 264 requisition->height = requisition->height + box_req.height + 6;
269 265
270 requisition->width = 1; 266 requisition->width = 1;
271 267
272 } 268 }
273 269
274 static void 270 static void
275 gtk_gaim_status_box_size_allocate (GtkWidget *widget, 271 gtk_gaim_status_box_size_allocate(GtkWidget *widget,
276 GtkAllocation *allocation) 272 GtkAllocation *allocation)
277 { 273 {
278 GtkRequisition req = {0,0}; 274 GtkRequisition req = {0,0};
279 GtkAllocation parent_alc = *allocation, box_alc = *allocation ; 275 GtkAllocation parent_alc = *allocation, box_alc = *allocation ;
280 combo_box_size_request(widget, &req); 276 combo_box_size_request(widget, &req);
281 277
282 /* EVIL XXX */ 278 /* EVIL XXX */
283 box_alc.height = 80;//MAX(1,box_alc.height - req.height - 6); 279 box_alc.height = 80;
284 280 /* box_alc.height = MAX(1,box_alc.height - req.height - 6); */
281
285 box_alc.y = box_alc.y + req.height + 6; 282 box_alc.y = box_alc.y + req.height + 6;
286 gtk_widget_size_allocate((GTK_GAIM_STATUS_BOX(widget))->vbox, &box_alc); 283 gtk_widget_size_allocate((GTK_GAIM_STATUS_BOX(widget))->vbox, &box_alc);
287 284
288 parent_alc.height = MAX(1,req.height); 285 parent_alc.height = MAX(1,req.height);
289 combo_box_size_allocate(widget, &parent_alc); 286 combo_box_size_allocate(widget, &parent_alc);
290 widget->allocation = *allocation; 287 widget->allocation = *allocation;
291 } 288 }
292 289
293 290
294 static gboolean 291 static gboolean
295 gtk_gaim_status_box_expose_event (GtkWidget *widget, 292 gtk_gaim_status_box_expose_event(GtkWidget *widget,
296 GdkEventExpose *event) 293 GdkEventExpose *event)
297 { 294 {
298 295 GtkGaimStatusBox *status_box = GTK_GAIM_STATUS_BOX(widget);
299 GtkGaimStatusBox *status_box = GTK_GAIM_STATUS_BOX (widget); 296 combo_box_expose_event(widget, event);
300 combo_box_expose_event(widget, event); 297
301 298 gtk_container_propagate_expose(GTK_CONTAINER(widget),
302 gtk_container_propagate_expose (GTK_CONTAINER (widget), 299 status_box->vbox, event);
303 status_box->vbox, event); 300 return FALSE;
304 return FALSE;
305 } 301 }
306 302
307 static void 303 static void
308 gtk_gaim_status_box_forall (GtkContainer *container, 304 gtk_gaim_status_box_forall(GtkContainer *container,
309 gboolean include_internals, 305 gboolean include_internals,
310 GtkCallback callback, 306 GtkCallback callback,
311 gpointer callback_data) 307 gpointer callback_data)
312 { 308 {
313 GtkGaimStatusBox *status_box = GTK_GAIM_STATUS_BOX (container); 309 GtkGaimStatusBox *status_box = GTK_GAIM_STATUS_BOX (container);
314 310
315 if (include_internals) 311 if (include_internals)
316 { 312 {
317 (* callback) (status_box->vbox, callback_data); 313 (* callback) (status_box->vbox, callback_data);
318 } 314 }
319 315
320 combo_box_forall(container, include_internals, callback, callback_data); 316 combo_box_forall(container, include_internals, callback, callback_data);
321 } 317 }
322 318
323 GtkWidget * 319 GtkWidget *
324 gtk_gaim_status_box_new() 320 gtk_gaim_status_box_new()
325 { 321 {
330 void 326 void
331 gtk_gaim_status_box_add(GtkGaimStatusBox *status_box, GdkPixbuf *pixbuf, const char *text, const char *sec_text, char *edit) 327 gtk_gaim_status_box_add(GtkGaimStatusBox *status_box, GdkPixbuf *pixbuf, const char *text, const char *sec_text, char *edit)
332 { 328 {
333 GtkTreeIter iter; 329 GtkTreeIter iter;
334 char *t; 330 char *t;
335 331
336 if (sec_text) { 332 if (sec_text) {
337 char aa_color[8]; 333 char aa_color[8];
338 GtkStyle *style = gtk_widget_get_style(GTK_WIDGET(status_box)); 334 GtkStyle *style = gtk_widget_get_style(GTK_WIDGET(status_box));
339 snprintf(aa_color, sizeof(aa_color), "#%02x%02x%02x", 335 snprintf(aa_color, sizeof(aa_color), "#%02x%02x%02x",
340 style->text_aa[GTK_STATE_NORMAL].red >> 8, 336 style->text_aa[GTK_STATE_NORMAL].red >> 8,
341 style->text_aa[GTK_STATE_NORMAL].green >> 8, 337 style->text_aa[GTK_STATE_NORMAL].green >> 8,
342 style->text_aa[GTK_STATE_NORMAL].blue >> 8); 338 style->text_aa[GTK_STATE_NORMAL].blue >> 8);
343 t = g_strdup_printf("%s\n<span color=\"%s\">%s</span>", text, aa_color, sec_text); 339 t = g_strdup_printf("%s\n<span color=\"%s\">%s</span>", text, aa_color, sec_text);
344 } else { 340 } else {
345 t = g_strdup(text); 341 t = g_strdup(text);
346 } 342 }
347 343
348 gtk_list_store_append(status_box->dropdown_store, &iter); 344 gtk_list_store_append(status_box->dropdown_store, &iter);
349 gtk_list_store_set(status_box->dropdown_store, &iter, 345 gtk_list_store_set(status_box->dropdown_store, &iter,
350 ICON_COLUMN, pixbuf, 346 ICON_COLUMN, pixbuf,
351 TEXT_COLUMN, t, 347 TEXT_COLUMN, t,
352 TITLE_COLUMN, text, 348 TITLE_COLUMN, text,
353 DESC_COLUMN, sec_text, 349 DESC_COLUMN, sec_text,
354 TYPE_COLUMN, edit, -1); 350 TYPE_COLUMN, edit, -1);
355 } 351 }
356 352
357 void 353 void
358 gtk_gaim_status_box_set_error(GtkGaimStatusBox *status_box, const gchar *error) 354 gtk_gaim_status_box_set_error(GtkGaimStatusBox *status_box, const gchar *error)
375 { 371 {
376 if (!status_box) 372 if (!status_box)
377 return; 373 return;
378 if (status_box->connecting_index == 3) 374 if (status_box->connecting_index == 3)
379 status_box->connecting_index = 0; 375 status_box->connecting_index = 0;
380 else 376 else
381 status_box->connecting_index++; 377 status_box->connecting_index++;
382 gtk_gaim_status_box_refresh(status_box); 378 gtk_gaim_status_box_refresh(status_box);
383 } 379 }
384 380
385 void 381 void
386 gtk_gaim_status_box_pulse_typing(GtkGaimStatusBox *status_box) 382 gtk_gaim_status_box_pulse_typing(GtkGaimStatusBox *status_box)
387 { 383 {
388 if (status_box->typing_index == 3) 384 if (status_box->typing_index == 3)
389 status_box->typing_index = 0; 385 status_box->typing_index = 0;
390 else 386 else
391 status_box->typing_index++; 387 status_box->typing_index++;
392 gtk_gaim_status_box_refresh(status_box); 388 gtk_gaim_status_box_refresh(status_box);
393 } 389 }
394 390
395 static void remove_typing_cb(GtkGaimStatusBox *box) 391 static void remove_typing_cb(GtkGaimStatusBox *box)
401 gtk_combo_box_get_active_iter(GTK_COMBO_BOX(box), &iter); 397 gtk_combo_box_get_active_iter(GTK_COMBO_BOX(box), &iter);
402 gtk_tree_model_get(GTK_TREE_MODEL(box->dropdown_store), &iter, TYPE_COLUMN, &status_type_id, -1); 398 gtk_tree_model_get(GTK_TREE_MODEL(box->dropdown_store), &iter, TYPE_COLUMN, &status_type_id, -1);
403 for (l = gaim_accounts_get_all(); l != NULL; l = l->next) { 399 for (l = gaim_accounts_get_all(); l != NULL; l = l->next) {
404 GaimAccount *account = (GaimAccount*)l->data; 400 GaimAccount *account = (GaimAccount*)l->data;
405 GaimStatusType *status_type; 401 GaimStatusType *status_type;
406 402
407 if (!gaim_account_get_enabled(account, GAIM_GTK_UI)) 403 if (!gaim_account_get_enabled(account, GAIM_GTK_UI))
408 continue; 404 continue;
409 405
410 status_type = gaim_account_get_status_type(account, status_type_id); 406 status_type = gaim_account_get_status_type(account, status_type_id);
411 407
412 if (status_type == NULL) 408 if (status_type == NULL)
413 continue; 409 continue;
414 gaim_account_set_status(account, status_type_id, TRUE, 410 gaim_account_set_status(account, status_type_id, TRUE,
415 "message",gtk_imhtml_get_markup(GTK_IMHTML(box->imhtml)), NULL); 411 "message",gtk_imhtml_get_markup(GTK_IMHTML(box->imhtml)), NULL);
416 } 412 }
417 g_source_remove(box->typing); 413 g_source_remove(box->typing);
418 box->typing = 0; 414 box->typing = 0;
419 gtk_gaim_status_box_refresh(box); 415 gtk_gaim_status_box_refresh(box);
432 gchar *status_type_id; 428 gchar *status_type_id;
433 GList *l; 429 GList *l;
434 430
435 gtk_combo_box_get_active_iter(GTK_COMBO_BOX(status_box), &iter); 431 gtk_combo_box_get_active_iter(GTK_COMBO_BOX(status_box), &iter);
436 gtk_tree_model_get(GTK_TREE_MODEL(status_box->dropdown_store), &iter, TITLE_COLUMN, &text, 432 gtk_tree_model_get(GTK_TREE_MODEL(status_box->dropdown_store), &iter, TITLE_COLUMN, &text,
437 DESC_COLUMN, &sec_text, ICON_COLUMN, &pixbuf, 433 DESC_COLUMN, &sec_text, ICON_COLUMN, &pixbuf,
438 TYPE_COLUMN, &status_type_id, -1); 434 TYPE_COLUMN, &status_type_id, -1);
439 if (status_box->title) 435 if (status_box->title)
440 g_free(status_box->title); 436 g_free(status_box->title);
441 status_box->title = g_strdup(text); 437 status_box->title = g_strdup(text);
442 if (status_box->desc && sec_text) 438 if (status_box->desc && sec_text)
443 g_free(status_box->desc); 439 g_free(status_box->desc);
444 status_box->desc = g_strdup(sec_text); 440 status_box->desc = g_strdup(sec_text);
445 if (status_box->pixbuf) 441 if (status_box->pixbuf)
446 g_object_unref(status_box->pixbuf); 442 g_object_unref(status_box->pixbuf);
447 status_box->pixbuf = pixbuf; 443 status_box->pixbuf = pixbuf;
448 444
449 if (!strcmp(status_type_id, "away")) { 445 if (!strcmp(status_type_id, "away")) {
450 gtk_widget_show_all(status_box->vbox); 446 gtk_widget_show_all(status_box->vbox);
451 status_box->typing = g_timeout_add(3000, (GSourceFunc)remove_typing_cb, status_box); 447 status_box->typing = g_timeout_add(3000, (GSourceFunc)remove_typing_cb, status_box);
452 gtk_imhtml_clear(GTK_IMHTML(status_box->imhtml)); 448 gtk_imhtml_clear(GTK_IMHTML(status_box->imhtml));
453 gtk_widget_grab_focus(status_box->imhtml); 449 gtk_widget_grab_focus(status_box->imhtml);
478 { 474 {
479 GtkGaimStatusBox *box = (GtkGaimStatusBox*)data; 475 GtkGaimStatusBox *box = (GtkGaimStatusBox*)data;
480 if (box->typing) { 476 if (box->typing) {
481 gtk_gaim_status_box_pulse_typing(box); 477 gtk_gaim_status_box_pulse_typing(box);
482 g_source_remove(box->typing); 478 g_source_remove(box->typing);
483 } 479 }
484 box->typing = g_timeout_add(3000, (GSourceFunc)remove_typing_cb, box); 480 box->typing = g_timeout_add(3000, (GSourceFunc)remove_typing_cb, box);
485 gtk_gaim_status_box_refresh(box); 481 gtk_gaim_status_box_refresh(box);
486 } 482 }
487 483
488 const char *gtk_gaim_status_box_get_active_type(GtkGaimStatusBox *status_box) 484 const char *gtk_gaim_status_box_get_active_type(GtkGaimStatusBox *status_box)
489 { 485 {
490 GtkTreeIter iter; 486 GtkTreeIter iter;
491 char *type; 487 char *type;
492 gtk_combo_box_get_active_iter(GTK_COMBO_BOX(status_box), &iter); 488 gtk_combo_box_get_active_iter(GTK_COMBO_BOX(status_box), &iter);
493 gtk_tree_model_get(GTK_TREE_MODEL(status_box->dropdown_store), &iter, 489 gtk_tree_model_get(GTK_TREE_MODEL(status_box->dropdown_store), &iter,
494 TYPE_COLUMN, &type, -1); 490 TYPE_COLUMN, &type, -1);
495 return type; 491 return type;
496 } 492 }
497 493
498 const char *gtk_gaim_status_box_get_message(GtkGaimStatusBox *status_box) 494 const char *gtk_gaim_status_box_get_message(GtkGaimStatusBox *status_box)