diff 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
line wrap: on
line diff
--- a/src/conversation.c	Thu Jun 10 20:57:52 2004 +0000
+++ b/src/conversation.c	Fri Jun 11 00:08:29 2004 +0000
@@ -422,6 +422,22 @@
 	ops->flash(win);
 }
 
+gboolean
+gaim_conv_window_has_focus(GaimConvWindow *win)
+{
+	gboolean ret = FALSE;
+	GaimConvWindowUiOps *ops;
+
+	g_return_val_if_fail(win != NULL, FALSE);
+
+	ops = gaim_conv_window_get_ui_ops(win);
+
+	if (ops != NULL && ops->has_focus != NULL)
+		ret = ops->has_focus(win);
+
+	return ret;
+}
+
 void
 gaim_conv_window_set_ui_ops(GaimConvWindow *win, GaimConvWindowUiOps *ops)
 {
@@ -1487,6 +1503,27 @@
 		ops->update_progress(conv, percent);
 }
 
+gboolean
+gaim_conversation_has_focus(GaimConversation *conv)
+{
+	gboolean ret = FALSE;
+	GaimConvWindow *win;
+	GaimConversationUiOps *ops;
+
+	g_return_val_if_fail(conv != NULL, FALSE);
+
+	win = gaim_conversation_get_window(conv);
+	if (gaim_conv_window_get_active_conversation(win) != conv)
+		return FALSE;
+
+	ops = gaim_conversation_get_ui_ops(conv);
+
+	if (ops != NULL && ops->has_focus != NULL)
+		ret = ops->has_focus(conv);
+
+	return ret;
+}
+
 /*
  * TODO: Need to make sure calls to this function happen in the core
  * instead of the UI.  That way UIs have less work to do, and the