changeset 18137:323272a9bb65

Fix #1574. (Pidgin and Finch show each other's pounces, interact in strange ways)
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sun, 17 Jun 2007 01:07:25 +0000
parents 00cec200ec58
children c6ee57944335
files ChangeLog.API finch/gntpounce.c libpurple/pounce.c libpurple/pounce.h pidgin/gtkpounce.c
diffstat 5 files changed, 38 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog.API	Sun Jun 17 00:19:12 2007 +0000
+++ b/ChangeLog.API	Sun Jun 17 01:07:25 2007 +0000
@@ -13,8 +13,6 @@
 		    UIs can now use better scheduling for whole-second timers.  For
 		    example, clients based on the glib event loop can now use
 		    g_timeout_add_seconds.
-		* gtk_imhtml_setup_entry
-		* pidgin_create_window
 		* purple_blist_node_get_type
 		* purple_conversation_do_command
 		* purple_conversation_get_extended_menu
@@ -22,8 +20,6 @@
 		    This is for UIs to use to ensure only one copy is running.
 		* purple_dbus_is_owner
 		* purple_image_data_calculate_filename
-		* pidgin_retrieve_user_info, shows immediate feedback when getting
-		  information about a user.
 		* purple_timeout_add_seconds
 		    Callers should prefer this to purple_timeout_add for timers
 		    longer than 1 second away.  Be aware of the rounding, though.
@@ -31,8 +27,7 @@
 		    Callers should prefer this to purple_timeout_add for timers
 		    longer than 1 second away.  Be aware of the rounding, though.
 		* purple_xfer_get_remote_user
-		* gtk_imhtml_animation_new
-		    Can be used for inserting an animated image into an IMHTML.
+		* purple_pounces_get_all_for_ui
 
 		Changed:
 		* The documentation of the following functions now properly
@@ -68,6 +63,14 @@
 		  GLists.  The passed list is still not modified or freed.
 
 	Pidgin:
+		Added:
+		* gtk_imhtml_setup_entry
+		* pidgin_create_window
+		* pidgin_retrieve_user_info, shows immediate feedback when getting
+		  information about a user.
+		* gtk_imhtml_animation_new
+		    Can be used for inserting an animated image into an IMHTML.
+
 		Changed:
 		* pidgin_append_menu_action returns the menuitem added to the menu.
 		* pidgin_separator returns the separator added to the menu.
--- a/finch/gntpounce.c	Sun Jun 17 00:19:12 2007 +0000
+++ b/finch/gntpounce.c	Sun Jun 17 01:07:25 2007 +0000
@@ -141,8 +141,8 @@
 
 	gnt_tree_remove_all(GNT_TREE(dialog->tree));
 
-	for (pounces = purple_pounces_get_all(); pounces != NULL;
-			pounces = g_list_next(pounces))
+	for (pounces = purple_pounces_get_all_for_ui(FINCH_UI); pounces != NULL;
+			pounces = g_list_delete_link(pounces, pounces))
 	{
 		add_pounce_to_treeview(GNT_TREE(dialog->tree), pounces->data);
 	}
--- a/libpurple/pounce.c	Sun Jun 17 00:19:12 2007 +0000
+++ b/libpurple/pounce.c	Sun Jun 17 01:07:25 2007 +0000
@@ -1014,6 +1014,20 @@
 	return pounces;
 }
 
+GList *purple_pounces_get_all_for_ui(const char *ui)
+{
+	GList *list = NULL, *iter;
+	g_return_val_if_fail(ui != NULL, NULL);
+
+	for (iter = pounces; iter; iter = iter->next) {
+		PurplePounce *pounce = iter->data;
+		if (pounce->ui_type && strcmp(pounce->ui_type, ui) == 0)
+			list = g_list_prepend(list, pounce);
+	}
+	list = g_list_reverse(list);
+	return list;
+}
+
 static void
 free_pounce_handler(gpointer user_data)
 {
--- a/libpurple/pounce.h	Sun Jun 17 00:19:12 2007 +0000
+++ b/libpurple/pounce.h	Sun Jun 17 01:07:25 2007 +0000
@@ -343,6 +343,17 @@
 GList *purple_pounces_get_all(void);
 
 /**
+ * Returns a list of registered buddy pounces for the ui-type.
+ *
+ * @param ui  The ID of the UI using the core.
+ *
+ * @return The list of buddy pounces. The list should be freed by
+ *         the caller when it's no longer used.
+ * @since  2.1.0
+ */
+GList *purple_pounces_get_all_for_ui(const char *ui);
+
+/**
  * Returns the buddy pounce subsystem handle.
  *
  * @return The subsystem handle.
--- a/pidgin/gtkpounce.c	Sun Jun 17 00:19:12 2007 +0000
+++ b/pidgin/gtkpounce.c	Sun Jun 17 01:07:25 2007 +0000
@@ -215,8 +215,8 @@
 
 	gtk_list_store_clear(dialog->model);
 
-	for (pounces = purple_pounces_get_all(); pounces != NULL;
-			pounces = g_list_next(pounces))
+	for (pounces = purple_pounces_get_all_for_ui(PIDGIN_UI); pounces != NULL;
+			pounces = g_list_delete_link(pounces, pounces))
 	{
 		add_pounce_to_treeview(dialog->model, pounces->data);
 	}