changeset 12097:d0662345799b

[gaim-migrate @ 14394] sf patch #1352658, from Evan Schoenberg "This simple patch adds a needed signal, buddy-icon-changed." And I removed buddy-icon-cached because I think this new signal is better. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Tue, 15 Nov 2005 01:04:15 +0000
parents ab9fc699a543
children a726740ce86e
files plugins/ChangeLog.API plugins/signals-test.c src/blist.c src/buddyicon.c
diffstat 4 files changed, 24 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/ChangeLog.API	Tue Nov 15 00:36:42 2005 +0000
+++ b/plugins/ChangeLog.API	Tue Nov 15 01:04:15 2005 +0000
@@ -189,7 +189,7 @@
 	* "buddy-status-changed": A buddy changed status; see Doxygen docs for full details.
 	* "buddy-idle-changed": A buddy's idle status changed; see Doxygen docs for full details.
 		See Doxygen docs for details.
-	* "buddy-icon-cached": A buddy icon was cached; see Doxygen docs for full details.
+	* "buddy-icon-changed": See Doxygen docs for details.
 	* "gtkblist-hiding": See Doxygen docs for details.
 	* "gtkblist-unhiding": See Doxygen docs for details.
 
@@ -200,6 +200,7 @@
 	* "buddy-back": replaced by buddy-status-changed
 	* "buddy-idle": replaced by buddy-idle-changed
 	* "buddy-unidle": replaced by buddy-idle-changed
+	* "buddy-icon-cached": replaced by buddy-icon-changed
 
 version 1.5.0 (8/11/2005):
 	* Added: gaim_xfer_conversation_write
--- a/plugins/signals-test.c	Tue Nov 15 00:36:42 2005 +0000
+++ b/plugins/signals-test.c	Tue Nov 15 01:04:15 2005 +0000
@@ -71,11 +71,10 @@
  * Buddy Icons signal callbacks
  **************************************************************************/
 static void
-buddy_icon_cached_cb(GaimBuddyIcon *icon, GaimBuddy *buddy,
-		     const char *filename, const char *old_icon)
+buddy_icon_cchanged_cb(GaimBuddyIcon *icon, GaimBuddy *buddy)
 {
-	gaim_debug_misc("signals test", "buddy icon cached (%s, %s, %s)\n",
-					gaim_buddy_get_name(buddy), filename, old_icon);
+	gaim_debug_misc("signals test", "buddy icon cached (%s)\n",
+					gaim_buddy_get_name(buddy));
 }
 
 /**************************************************************************
@@ -573,10 +572,6 @@
 	gaim_signal_connect(accounts_handle, "account-status-changed",
 						plugin, GAIM_CALLBACK(account_status_changed), NULL);
 
-	/* Buddy Icon subsystem signals */
-	gaim_signal_connect(buddy_icons_handle, "buddy-icon-cached",
-						plugin, GAIM_CALLBACK(buddy_icon_cached_cb), NULL);
-
 	/* Buddy List subsystem signals */
 	gaim_signal_connect(blist_handle, "buddy-status-changed",
 						plugin, GAIM_CALLBACK(buddy_status_changed_cb), NULL);
@@ -590,6 +585,8 @@
 						plugin, GAIM_CALLBACK(buddy_added_cb), NULL);
 	gaim_signal_connect(blist_handle, "blist-removed",
 						plugin, GAIM_CALLBACK(buddy_removed_cb), NULL);
+	gaim_signal_connect(blist_handle, "buddy-icon-changed",
+						plugin, GAIM_CALLBACK(buddy_icon_changed_cb), NULL);
 	gaim_signal_connect(blist_handle, "blist-node-aliased",
 						plugin, GAIM_CALLBACK(blist_node_aliased), NULL);
 	gaim_signal_connect(blist_handle, "blist-node-extended-menu",
--- a/src/blist.c	Tue Nov 15 00:36:42 2005 +0000
+++ b/src/blist.c	Tue Nov 15 01:04:15 2005 +0000
@@ -1061,13 +1061,14 @@
 {
 	g_return_if_fail(buddy != NULL);
 
-	if (buddy->icon != icon)
-	{
-		if (buddy->icon != NULL)
-			gaim_buddy_icon_unref(buddy->icon);
-
-		buddy->icon = (icon == NULL ? NULL : gaim_buddy_icon_ref(icon));
-	}
+	if (buddy->icon == icon)
+		/* Don't need to do anything */
+		return;
+
+	if (buddy->icon != NULL)
+		gaim_buddy_icon_unref(buddy->icon);
+
+	buddy->icon = (icon != NULL ? gaim_buddy_icon_ref(icon) : NULL);
 
 	if (buddy->icon)
 		gaim_buddy_icon_cache(icon, buddy);
@@ -1076,6 +1077,8 @@
 
 	gaim_blist_schedule_save();
 
+	gaim_signal_emit(gaim_blist_get_handle(), "buddy-icon-changed", buddy);
+
 	gaim_blist_update_buddy_icon(buddy);
 }
 
@@ -2549,9 +2552,9 @@
 	                     gaim_value_new(GAIM_TYPE_SUBTYPE,
 	                                    GAIM_SUBTYPE_BLIST_BUDDY),
 	                     gaim_value_new(GAIM_TYPE_SUBTYPE,
-	                     				GAIM_SUBTYPE_STATUS),
+										GAIM_SUBTYPE_STATUS),
 	                     gaim_value_new(GAIM_TYPE_SUBTYPE,
-	                     				GAIM_SUBTYPE_STATUS));
+										GAIM_SUBTYPE_STATUS));
 
 	gaim_signal_register(handle, "buddy-idle-changed",
 	                     gaim_marshal_VOID__POINTER_INT_INT, NULL,
@@ -2582,6 +2585,11 @@
 						 gaim_value_new(GAIM_TYPE_SUBTYPE,
 										GAIM_SUBTYPE_BLIST_BUDDY));
 
+	gaim_signal_register(handle, "buddy-icon-changed",
+						 gaim_marshal_VOID__POINTER, NULL, 1,
+						 gaim_value_new(GAIM_TYPE_SUBTYPE,
+										GAIM_SUBTYPE_BLIST_BUDDY));
+
 	gaim_signal_register(handle, "update-idle", gaim_marshal_VOID, NULL, 0);
 
 	gaim_signal_register(handle, "blist-node-extended-menu",
--- a/src/buddyicon.c	Tue Nov 15 00:36:42 2005 +0000
+++ b/src/buddyicon.c	Tue Nov 15 01:04:15 2005 +0000
@@ -264,9 +264,6 @@
 						 filename, strerror(errno));
 	}
 
-	gaim_signal_emit(gaim_buddy_icons_get_handle(), "buddy-icon-cached",
-					 icon, buddy, filename, old_icon);
-
 	g_free(filename);
 
 	if (old_icon != NULL)
@@ -525,15 +522,6 @@
 		NULL, (GFreeFunc)g_hash_table_destroy);
 
 	cache_dir = g_build_filename(gaim_user_dir(), "icons", NULL);
-
-	gaim_signal_register(gaim_buddy_icons_get_handle(), "buddy-icon-cached",
-						 gaim_marshal_VOID__POINTER_POINTER_POINTER_POINTER, NULL, 4,
-						 gaim_value_new(GAIM_TYPE_SUBTYPE,
-										GAIM_SUBTYPE_BUDDY_ICON),
-						 gaim_value_new(GAIM_TYPE_SUBTYPE,
-										GAIM_SUBTYPE_BLIST_BUDDY),
-						 gaim_value_new(GAIM_TYPE_STRING),
-						 gaim_value_new(GAIM_TYPE_STRING));
 }
 
 void