soc.2009.vulture: a1ff4c96: Delete buddy-list nodes from keyboard.

gdick at soc.pidgin.im gdick at soc.pidgin.im
Sat Aug 8 16:06:25 EDT 2009


-----------------------------------------------------------------
Revision: a1ff4c967200d258663bf3cbbfcdc15d6a45130a
Ancestor: 6c80539b877d576476d5abfe5bd82c5cc697cec0
Author: gdick at soc.pidgin.im
Date: 2009-08-08T16:23:19
Branch: im.pidgin.soc.2009.vulture
URL: http://d.pidgin.im/viewmtn/revision/info/a1ff4c967200d258663bf3cbbfcdc15d6a45130a

Modified files:
        vulture/vultureblist.c

ChangeLog: 

Delete buddy-list nodes from keyboard.

-------------- next part --------------
============================================================
--- vulture/vultureblist.c	17b209f4e93b1fc419912330ed7daee01203cd51
+++ vulture/vultureblist.c	a626eeb6f0d006ed8c76dd39ed6b53f24d7e7196
@@ -47,7 +47,15 @@ typedef struct _STATUSDLGDATA
 	WNDPROC	wndprocStatusMsgOrig;
 } STATUSDLGDATA;
 
+/* MinGW doesn't have NMTVKEYDOWN. */
+typedef struct _VULTURE_NMTVKEYDOWN
+{
+	NMHDR	hdr;
+	WORD	wVKey;
+	UINT	flags;
+} VULTURE_NMTVKEYDOWN;
 
+
 static LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uiMsg, WPARAM wParam, LPARAM lParam);
 static INT_PTR CALLBACK StatusDlgProc(HWND hwndDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam);
 static INT_PTR CALLBACK BuddyListDlgProc(HWND hwndDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam);
@@ -765,6 +773,29 @@ static INT_PTR CALLBACK BuddyListDlgProc
 
 					break;
 
+				case TVN_KEYDOWN:
+					if(((VULTURE_NMTVKEYDOWN*)lpnmhdr)->wVKey == VK_DELETE)
+					{
+						TVITEM tvitem;
+
+						tvitem.hItem = TreeView_GetSelection(lpnmhdr->hwndFrom);
+						if(tvitem.hItem)
+						{
+							VULTURE_BLIST_NODE *lpvblistnode;
+
+							tvitem.mask = TVIF_PARAM;
+							TreeView_GetItem(lpnmhdr->hwndFrom, &tvitem);
+
+							lpvblistnode = (VULTURE_BLIST_NODE*)tvitem.lParam;
+
+							RemoveNodeRequest(lpnmhdr->hwndFrom, lpvblistnode);
+
+							return TRUE;
+						}
+					}
+
+					break;
+
 				case TVN_ENDLABELEDIT:
 					{
 						/* Label-editing in the buddy-
@@ -1286,6 +1317,8 @@ static void RemoveNodeRequest(HWND hwndB
 	VULTURE_BLIST_NODE_GET_BOOL vblngetbool;
 	BOOL bDelete = TRUE;
 
+	VultureBListNodeAddRef(lpvblistnode);
+
 	vblngetbool.lpvblistnode = lpvblistnode;
 	VultureSingleSyncPurpleCall(PC_BLISTNODEHASCHILDREN, &vblngetbool);
 
@@ -1302,6 +1335,8 @@ static void RemoveNodeRequest(HWND hwndB
 
 	if(bDelete)
 		VultureSingleSyncPurpleCall(PC_REMOVEBLISTNODE, lpvblistnode);
+
+	VultureBListNodeRelease(lpvblistnode);
 }
 
 


More information about the Commits mailing list