changeset 7082:25a616f16b6c

[gaim-migrate @ 7647] Added more core wrappers for the glib mainloops, and replaced the last GTK+ code in OSCAR with them. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Tue, 30 Sep 2003 22:55:22 +0000
parents 73da9c3ad9ac
children 3100a6e03644
files src/core.c src/core.h src/protocols/oscar/oscar.c
diffstat 3 files changed, 26 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/core.c	Tue Sep 30 22:49:00 2003 +0000
+++ b/src/core.c	Tue Sep 30 22:55:22 2003 +0000
@@ -150,12 +150,25 @@
 	return VERSION;
 }
 
+gboolean
+gaim_core_mainloop_events_pending(void)
+{
+	return g_main_context_pending(g_main_context_default());
+}
+
 void
 gaim_core_mainloop_iteration(void)
 {
 	g_main_context_iteration(g_main_context_default(), FALSE);
 }
 
+void
+gaim_core_mainloop_finish_events(void)
+{
+	while (gaim_core_mainloop_events_pending())
+		gaim_core_mainloop_iteration();
+}
+
 const char *
 gaim_core_get_ui(void)
 {
--- a/src/core.h	Tue Sep 30 22:49:00 2003 +0000
+++ b/src/core.h	Tue Sep 30 22:55:22 2003 +0000
@@ -64,6 +64,13 @@
 const char *gaim_core_get_version(void);
 
 /**
+ * Returns whether or not there are any mainloop events pending.
+ *
+ * @return TRUE if there are mainloop events pending. FALSE otherwise.
+ */
+gboolean gaim_core_mainloop_events_pending(void);
+
+/**
  * Iterates once through the gaim mainloop.
  *
  * This is in actuality a wrapper around glib's mainloop iteration
@@ -74,6 +81,11 @@
 void gaim_core_mainloop_iteration(void);
 
 /**
+ * Iterates through all remaining events in the mainloop.
+ */
+void gaim_core_mainloop_finish_events(void);
+
+/**
  * Returns the ID of the UI that is using the core.
  *
  * @return The ID of the UI that is currently using the core.
--- a/src/protocols/oscar/oscar.c	Tue Sep 30 22:49:00 2003 +0000
+++ b/src/protocols/oscar/oscar.c	Tue Sep 30 22:55:22 2003 +0000
@@ -5600,8 +5600,7 @@
 		dim->watcher = 0;
 	}
 	/* XXX is this really necessary? */
-	while (gtk_events_pending())
-		gtk_main_iteration();
+	gaim_core_mainloop_finish_events();
 
 	c = gaim_find_conversation_with_account(sn, gaim_connection_get_account(gc));
 	if (c != NULL)