comparison src/conversation.c @ 9260:947876140943

[gaim-migrate @ 10059] Patch by Stu Tomlinson to add gaim_conversation_has_focus() and gaim_conv_window_has_focus(), and the (optional) UI ops. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Fri, 11 Jun 2004 00:08:29 +0000
parents 45d2ad4ac1c1
children 77fdeb4c459f
comparison
equal deleted inserted replaced
9259:f5f7482678d2 9260:947876140943
420 return; 420 return;
421 421
422 ops->flash(win); 422 ops->flash(win);
423 } 423 }
424 424
425 gboolean
426 gaim_conv_window_has_focus(GaimConvWindow *win)
427 {
428 gboolean ret = FALSE;
429 GaimConvWindowUiOps *ops;
430
431 g_return_val_if_fail(win != NULL, FALSE);
432
433 ops = gaim_conv_window_get_ui_ops(win);
434
435 if (ops != NULL && ops->has_focus != NULL)
436 ret = ops->has_focus(win);
437
438 return ret;
439 }
440
425 void 441 void
426 gaim_conv_window_set_ui_ops(GaimConvWindow *win, GaimConvWindowUiOps *ops) 442 gaim_conv_window_set_ui_ops(GaimConvWindow *win, GaimConvWindowUiOps *ops)
427 { 443 {
428 GaimConversationUiOps *conv_ops = NULL; 444 GaimConversationUiOps *conv_ops = NULL;
429 GList *l; 445 GList *l;
1485 1501
1486 if (ops != NULL && ops->update_progress != NULL) 1502 if (ops != NULL && ops->update_progress != NULL)
1487 ops->update_progress(conv, percent); 1503 ops->update_progress(conv, percent);
1488 } 1504 }
1489 1505
1506 gboolean
1507 gaim_conversation_has_focus(GaimConversation *conv)
1508 {
1509 gboolean ret = FALSE;
1510 GaimConvWindow *win;
1511 GaimConversationUiOps *ops;
1512
1513 g_return_val_if_fail(conv != NULL, FALSE);
1514
1515 win = gaim_conversation_get_window(conv);
1516 if (gaim_conv_window_get_active_conversation(win) != conv)
1517 return FALSE;
1518
1519 ops = gaim_conversation_get_ui_ops(conv);
1520
1521 if (ops != NULL && ops->has_focus != NULL)
1522 ret = ops->has_focus(conv);
1523
1524 return ret;
1525 }
1526
1490 /* 1527 /*
1491 * TODO: Need to make sure calls to this function happen in the core 1528 * TODO: Need to make sure calls to this function happen in the core
1492 * instead of the UI. That way UIs have less work to do, and the 1529 * instead of the UI. That way UIs have less work to do, and the
1493 * core/UI split is cleaner. Also need to make sure this is called 1530 * core/UI split is cleaner. Also need to make sure this is called
1494 * when chats are added/removed from the blist. 1531 * when chats are added/removed from the blist.