soc.2009.vulture: b9aa17b2: Show buddy icon at startup.

gdick at soc.pidgin.im gdick at soc.pidgin.im
Fri Aug 14 17:36:35 EDT 2009


-----------------------------------------------------------------
Revision: b9aa17b2032926bc1f97e16d746bab52e56023c9
Ancestor: 8aaab5ecfd3fb6a9aca6f396c9a64127290589a0
Author: gdick at soc.pidgin.im
Date: 2009-08-14T14:29:21
Branch: im.pidgin.soc.2009.vulture
URL: http://d.pidgin.im/viewmtn/revision/info/b9aa17b2032926bc1f97e16d746bab52e56023c9

Modified files:
        vulture/purplebicon.c vulture/purplebicon.h
        vulture/purplemain.c vulture/purplequeue.c
        vulture/purplequeue.h vulture/vulture.c
        vulture/vultureblist.c

ChangeLog: 

Show buddy icon at startup.

-------------- next part --------------
============================================================
--- vulture/purplebicon.c	40a3abcb7c8a529a3feb4f80220cb0e3cdbbc279
+++ vulture/purplebicon.c	281da5f34d45437233f89bd182d637cbff4582f1
@@ -427,7 +427,6 @@ static void SetGlobalBuddyIcon(const gch
 static void SetGlobalBuddyIcon(const gchar *szFilename)
 {
 	GList *lpglistAccounts;
-	PurpleStoredImage *lpstoredimg;
 
 	for(lpglistAccounts = purple_accounts_get_all(); lpglistAccounts; lpglistAccounts = lpglistAccounts->next)
 	{
@@ -458,20 +457,7 @@ static void SetGlobalBuddyIcon(const gch
 		}
 	}
 
-	if(szFilename)
-	{
-		/* Make an HBITMAP and send it back to the UI for display in
-		 * the main window.
-		 */
-		if((lpstoredimg = purple_imgstore_new_from_file(szFilename)))
-		{
-			HBITMAP hbmIcon = GetBuddyIcon(purple_imgstore_get_data(lpstoredimg), purple_imgstore_get_size(lpstoredimg), 0, 0);
-			VulturePostUIMessage(VUIMSG_NEWGLOBALBICON, hbmIcon);
-			purple_imgstore_unref(lpstoredimg);
-		}
-	}
-	else
-		VulturePostUIMessage(VUIMSG_NEWGLOBALBICON, NULL);
+	PurpleRefreshBuddyIcon(szFilename);
 }
 
 
@@ -490,3 +476,26 @@ void PurpleGlobalBuddyIconPrefChanged(co
 	UNREFERENCED_PARAMETER(lpvData);
 	SetGlobalBuddyIcon(lpvValue);
 }
+
+
+/**
+ * Posts a new HBITMAP to the UI to display as the buddy icon.
+ *
+ * @param	szFilename	Filename of buddy icon. May be NULL.
+ */
+void PurpleRefreshBuddyIcon(const gchar *szFilename)
+{
+	PurpleStoredImage *lpstoredimg;
+
+	if(szFilename && (lpstoredimg = purple_imgstore_new_from_file(szFilename)))
+	{
+		/* Make an HBITMAP and send it back to the UI for display in
+		 * the main window.
+		 */
+		HBITMAP hbmIcon = GetBuddyIcon(purple_imgstore_get_data(lpstoredimg), purple_imgstore_get_size(lpstoredimg), 0, 0);
+		VulturePostUIMessage(VUIMSG_NEWGLOBALBICON, hbmIcon);
+		purple_imgstore_unref(lpstoredimg);
+	}
+	else
+		VulturePostUIMessage(VUIMSG_NEWGLOBALBICON, NULL);
+}
============================================================
--- vulture/purplebicon.h	fb88563160f2a5847c33cf19aabb7e5a107c82d1
+++ vulture/purplebicon.h	7615e4f4f3a62d690002e779687abe0f20a8e36b
@@ -32,6 +32,7 @@ void PurpleGlobalBuddyIconPrefChanged(co
 HBITMAP PurpleGetIMBuddyIcon(PurpleConversation *lpconv, int cxMax, int cyMax);
 HBITMAP PurpleGetBlistNodeIcon(PurpleBlistNode *lpblistnode, int cxMax, int cyMax);
 void PurpleGlobalBuddyIconPrefChanged(const char *szName, PurplePrefType preftype, gconstpointer lpvValue, gpointer lpvData);
+void PurpleRefreshBuddyIcon(const gchar *szFilename);
 
 
 #endif
============================================================
--- vulture/purplemain.c	966a55819a18db2e46a1df71291294f355c5288a
+++ vulture/purplemain.c	cd628f412923f382404c36c7767eff0b28871321
@@ -77,8 +77,6 @@ void VultureInitLibpurple(HANDLE *lphthr
  */
 void VultureInitLibpurple(HANDLE *lphthread)
 {
-	VulturePurpleInitQueue();
-
 	*lphthread = (HANDLE)_beginthreadex(NULL, 0, PurpleThread, NULL, 0, NULL);
 }
 
============================================================
--- vulture/purplequeue.c	1298af63d37b82bc9a75ff52630fa68d343da8be
+++ vulture/purplequeue.c	bb0ae45b7790eea107512830c66dc8c3e1988ee0
@@ -453,6 +453,10 @@ static void DispatchPurpleCall(PURPLE_CA
 
 		break;
 
+	case PC_REFRESHGLOBALBICON:
+		PurpleRefreshBuddyIcon(purple_prefs_get_path(VULTURE_PREFS_ROOT "/accounts/buddyicon"));
+		break;
+
 	case PC_QUIT:
 		purple_core_quit();
 		g_main_loop_quit(g_lpgmainloop);
============================================================
--- vulture/purplequeue.h	dfd8e22f3d026cfbe4e52c003d53c9060732fc3f
+++ vulture/purplequeue.h	145dd4289a5102cefea92a285ecc4a9795fdab38
@@ -132,6 +132,8 @@ enum PURPLE_CALL_ID
 
 	/* (LPTSTR) Icon filename. */
 	PC_SETGLOBALBICON,
+
+	PC_REFRESHGLOBALBICON,
 };
 
 
============================================================
--- vulture/vulture.c	262cf079fcb75236b313d1a1d4df2b7e0f8413e7
+++ vulture/vulture.c	2b2161d17f992d10257d427cdab9b018d7ac233b
@@ -82,6 +82,8 @@ int WINAPI WinMain(HINSTANCE hinst, HINS
 
 	g_thread_init(NULL);
 
+	VulturePurpleInitQueue();
+
 	VultureParseCommandLine();
 
 	if(VultureRegisterConvContainerWindowClass() != 0)
============================================================
--- vulture/vultureblist.c	0ed8d48df54645a70195293f7854a6b4d19bb1fc
+++ vulture/vultureblist.c	40d91262893a47e2a0015a640e1d5cf411e4732b
@@ -577,6 +577,10 @@ static INT_PTR CALLBACK StatusDlgProc(HW
 			 */
 			SendDlgItemMessage(hwndDlg, IDC_CBEX_STATUS, CBEM_SETIMAGELIST, 0, (LPARAM)g_himlStatusIcons);
 			SetWindowPos(GetDlgItem(hwndDlg, IDC_CBEX_STATUS), NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED);
+
+			/* Let the core send us the buddy icon in its own time.
+			 */
+			VultureEnqueueAsyncPurpleCall(PC_REFRESHGLOBALBICON, NULL);
 		}
 
 		/* Let the system set the focus. */


More information about the Commits mailing list