soc.2009.vulture: bc6948cc: Beginnings of first page in accounts pro...

gdick at soc.pidgin.im gdick at soc.pidgin.im
Sat Aug 29 12:26:02 EDT 2009


-----------------------------------------------------------------
Revision: bc6948cc0c971dede313d00b996c0ef0eb9b239a
Ancestor: 53229963f2a7c2ed7c7b24658ef394403ed16b4a
Author: gdick at soc.pidgin.im
Date: 2009-08-29T16:21:55
Branch: im.pidgin.soc.2009.vulture
URL: http://d.pidgin.im/viewmtn/revision/info/bc6948cc0c971dede313d00b996c0ef0eb9b239a

Modified files:
        vulture/acctmanager.c vulture/resource.h
        vulture/vulture-res.rc vulture/vultureblist.c

ChangeLog: 

Beginnings of first page in accounts property sheet.

-------------- next part --------------
============================================================
--- vulture/acctmanager.c	bb3849b077ef3517b20f049b694f8ac3463d4d03
+++ vulture/acctmanager.c	60aa32ed92c3eea5fbab784cbe6d3f0c596109c0
@@ -37,11 +37,24 @@ static INT_PTR CALLBACK AccountManagerDl
 
 
 static INT_PTR CALLBACK AccountManagerDlgProc(HWND hwndDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam);
+static void EditAccount(HWND hwndParent, VULTURE_ACCOUNT *lpvac);
+static void EditAccountByIndex(HWND hwndDlg, int iItem);
+static INT_PTR CALLBACK AccountAccountPropPageProc(HWND hwndDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam);
 
 
 #define CCH_ACCMGR_HEADER	64
 
+enum ENUM_ACCOUNT_PROP_PAGES
+{
+	APP_ACCOUNT,
+#if 0
+	APP_PROTO,
+	APP_PROXY,
+#endif
+	APP_COUNT
+};
 
+
 /**
  * Show the account manager dialogue. The list of accounts is updated to
  * reflect the user's changes, but the caller needs to inform libpurple.
@@ -160,10 +173,147 @@ static INT_PTR CALLBACK AccountManagerDl
 		case IDCANCEL:
 			EndDialog(hwndDlg, FALSE);
 			return TRUE;
+
+		case IDC_BTN_ACCOUNT_PROPERTIES:
+			{
+				int iSelected = ListView_GetSelectionMark(GetDlgItem(hwndDlg, IDC_LIST_ACCOUNTS));
+
+				if(iSelected >= 0)
+					EditAccountByIndex(hwndDlg, iSelected);
+			}
+
+			return TRUE;
 		}
 
 		break;
+
+	case WM_NOTIFY:
+		if(((LPNMHDR)lParam)->idFrom == IDC_LIST_ACCOUNTS)
+		{
+			LPNMLISTVIEW lpnmlistview = (LPNMLISTVIEW)lParam;
+
+			switch(lpnmlistview->hdr.code)
+			{
+			case NM_DBLCLK:
+				{
+					LPNMITEMACTIVATE lpnmia = (LPNMITEMACTIVATE)lParam;
+
+					/* User double-clicked an account? */
+					if(lpnmia->iItem >= 0)
+						EditAccountByIndex(hwndDlg, lpnmia->iItem);
+				}
+
+				return TRUE;
+
+			case LVN_ITEMCHANGED:
+				if(lpnmlistview->uChanged & LVIF_STATE)
+				{
+					if(lpnmlistview->uNewState & LVIS_SELECTED)
+					{
+						/* Selection should always be visible. */
+						ListView_EnsureVisible(lpnmlistview->hdr.hwndFrom, lpnmlistview->iItem, FALSE);
+
+						/* Enable the buttons as appropriate. */
+						EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_ACCOUNT_DELETE), TRUE);
+						EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_ACCOUNT_PROPERTIES), TRUE);
+					}
+					else
+					{
+						/* The list view has the focus,
+						 * so this is okay.
+						 */
+						EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_ACCOUNT_DELETE), FALSE);
+						EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_ACCOUNT_PROPERTIES), FALSE);
+					}
+
+					return TRUE;
+				}
+
+				break;
+			}
+		}
+
+		break;
 	}
 
 	return FALSE;
 }
+
+
+
+/**
+ * Shows the property page for an account.
+ *
+ * @param	hwndParent	Parent window handle.
+ * @param	lpvac		Account to edit.
+ */
+static void EditAccount(HWND hwndParent, VULTURE_ACCOUNT *lpvac)
+{
+	PROPSHEETHEADER psh;
+	PROPSHEETPAGE rgpsp[APP_COUNT];
+	TCHAR szTitle[64];
+
+	LoadString(g_hInstance, IDS_ACCOUNT_PP_TITLE, szTitle, NUM_ELEMENTS(szTitle));
+
+	psh.dwSize = sizeof(psh);
+	psh.dwFlags = PSH_NOAPPLYNOW | PSH_NOCONTEXTHELP | PSH_PROPSHEETPAGE | PSH_PROPTITLE;
+	psh.hwndParent = hwndParent;
+	psh.hInstance = g_hInstance;
+	psh.pszCaption = szTitle;
+	psh.nPages = APP_COUNT;
+	psh.nStartPage = APP_ACCOUNT;
+	psh.ppsp = rgpsp;
+
+	rgpsp[APP_ACCOUNT].dwSize = sizeof(PROPSHEETPAGE);
+	rgpsp[APP_ACCOUNT].dwFlags = PSP_DEFAULT;
+	rgpsp[APP_ACCOUNT].hInstance = g_hInstance;
+	rgpsp[APP_ACCOUNT].pfnDlgProc = AccountAccountPropPageProc;
+	rgpsp[APP_ACCOUNT].lParam = (LPARAM)lpvac;
+	rgpsp[APP_ACCOUNT].pszTemplate = MAKEINTRESOURCE(IDD_ACCOUNTPROP_ACCOUNT);
+
+	PropertySheet(&psh);
+}
+
+
+/**
+ * Shows the property page for an account, specified by index into the list
+ * view.
+ *
+ * @param	hwndParent	Parent window handle.
+ * @param	iItem		Index of account to edit.
+ */
+static void EditAccountByIndex(HWND hwndDlg, int iItem)
+{
+	LVITEM lvitem;
+
+	lvitem.iItem = iItem;
+	lvitem.mask = LVIF_PARAM;
+
+	ListView_GetItem(GetDlgItem(hwndDlg, IDC_LIST_ACCOUNTS), &lvitem);
+
+	EditAccount(hwndDlg, (VULTURE_ACCOUNT*)lvitem.lParam);
+}
+
+
+/**
+ * Property-page procedure for 'account' page of accounts property sheet.
+ *
+ * @param	hwndPropPage	Property-page window handle.
+ * @param	uiMsg		Message ID.
+ * @param	wParam		Message-specific.
+ * @param	lParam		Message-specific.
+ *
+ * @return Usually TRUE if message processed and FALSE otherwise. There are
+ * some exceptions for particular messages.
+ */
+static INT_PTR CALLBACK AccountAccountPropPageProc(HWND hwndDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
+{
+	switch(uiMsg)
+	{
+	case WM_INITDIALOG:
+		/* Let the system set the focus. */
+		return TRUE;
+	}
+
+	return FALSE;
+}
============================================================
--- vulture/resource.h	d7743566f45444031fc3891e7cb09de6cf4f27bb
+++ vulture/resource.h	7fafa51aa101e29d2ae32aea5b90bed3c7aac7a9
@@ -48,8 +48,20 @@
 #define IDC_EDIT_ALIAS			1020
 #define IDC_CBEX_GROUP			1021
 #define IDC_EDIT_STRING			1022
+#define IDC_CHECK_REMEMBERPASS		1023
+#define IDC_CHECK_MAIL			1024
+#define IDC_RADIO_BICONGLOBAL		1025
+#define IDC_EDIT_PASSWORD		1026
+#define IDC_STATIC_BICON		1027
+#define IDC_STATIC_PROTOICON		1028
+#define IDC_EDIT_BICON			1029
+#define IDC_BUTTON_BICONBROWSE		1030
+#define IDC_RADIO_BICONOVERRIDE		1031
+#define IDC_RADIO_BICONNONE		1032
+#define IDC_STATIC_PROTOCOL		1033
 
 
+
 #define IDD_ACCOUNTS			101
 #define IDD_BLIST			102
 #define IDD_CHAT			103
@@ -62,10 +74,11 @@
 #define IDD_ADDCHAT			110
 #define IDD_ADDGROUP			111
 #define IDD_CHATPROPERTIES		112
+#define IDD_ACCOUNTPROP_ACCOUNT		113
 
 
 #define IDM_BLIST			1001
-#define IDM_BLIST_ACCOUNTS_MANAGE	40001
+#define IDM_BLIST_TOOLS_MANAGEACCOUNTS	40001
 #define IDM_BLIST_BUDDIES_CLOSE		40000
 #define IDM_BLIST_BUDDIES_JOINCHAT	40002
 #define IDM_BLIST_BUDDIES_ADDBUDDY	40003
@@ -123,3 +136,4 @@
 #define IDS_BUDDYICON_FILTER		9
 #define IDS_BUDDYICON_TITLE		10
 #define IDS_OFFLINE			11
+#define IDS_ACCOUNT_PP_TITLE		12
============================================================
--- vulture/vulture-res.rc	d865dab6d7310af76033fcae83940084c3894a45
+++ vulture/vulture-res.rc	a1209ea5d5b503c32c8484c49df20fd3c001acf9
@@ -58,9 +58,9 @@ IDM_BLIST MENU
 		MENUITEM "Show &Empty Groups", IDM_BLIST_VIEW_SHOWEMPTYGROUPS
 	}
 
-	POPUP "&Accounts"
+	POPUP "&Tools"
 	{
-		MENUITEM "&Manage Accounts\tCtrl+A", IDM_BLIST_ACCOUNTS_MANAGE
+		MENUITEM "&Manage Accounts\tCtrl+A", IDM_BLIST_TOOLS_MANAGEACCOUNTS
 	}
 }
 
@@ -174,6 +174,38 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_U
 // Dialog resources
 //
 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
+IDD_ACCOUNTPROP_ACCOUNT DIALOG 0, 0, 245, 280
+STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_VISIBLE | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP | WS_SYSMENU
+CAPTION "Account"
+FONT 8, "Ms Shell Dlg"
+{
+    GROUPBOX        "Login options", IDC_STATIC, 5, 5, 235, 100
+    LTEXT           "Chose the settings used to log into this account.", IDC_STATIC, 15, 20, 220, 9, SS_LEFT
+    LTEXT           "Protocol:", IDC_STATIC, 15, 42, 55, 8, SS_LEFT
+    LTEXT           "", IDC_STATIC_PROTOCOL, 125, 42, 110, 10, SS_LEFT
+    CONTROL         "", IDC_STATIC_PROTOICON, "Static", SS_CENTERIMAGE, 105, 42, 12, 9
+    LTEXT           "&Username:", IDC_STATIC, 15, 57, 55, 8, SS_LEFT
+    EDITTEXT        IDC_EDIT_USERNAME, 75, 55, 160, 12, ES_AUTOHSCROLL
+    LTEXT           "&Password:", IDC_STATIC, 15, 72, 55, 8, SS_LEFT
+    EDITTEXT        IDC_EDIT_PASSWORD, 75, 70, 160, 12, ES_AUTOHSCROLL | ES_PASSWORD
+    AUTOCHECKBOX    "&Remember password", IDC_CHECK_REMEMBERPASS, 75, 88, 130, 8
+    GROUPBOX        "User options", IDC_STATIC, 5, 110, 235, 50
+    LTEXT           "&Local alias:", IDC_STATIC, 15, 127, 55, 8, SS_LEFT
+    EDITTEXT        IDC_EDIT_ALIAS, 75, 125, 160, 12, ES_AUTOHSCROLL
+    AUTOCHECKBOX    "Show &new mail notifications for this account", IDC_CHECK_MAIL, 15, 143, 220, 10
+    GROUPBOX        "Buddy-icon options", IDC_STATIC, 5, 165, 235, 110
+    RADIOBUTTON     "Use &global buddy-icon settings", IDC_RADIO_BICONGLOBAL, 15, 195, 215, 10
+    LTEXT           "Buddy icons can be set on a per-account basis if desired.", IDC_STATIC, 15, 180, 220, 10, SS_LEFT
+    RADIOBUTTON     "Use the &following buddy icon:", IDC_RADIO_BICONOVERRIDE, 15, 210, 215, 10
+    CONTROL         "", IDC_STATIC_BICON, "Static", SS_ETCHEDFRAME, 28, 225, 35, 30
+    EDITTEXT        IDC_EDIT_BICON, 75, 226, 160, 12, ES_AUTOHSCROLL
+    PUSHBUTTON      "&Browse...", IDC_BUTTON_BICONBROWSE, 75, 240, 65, 15
+    RADIOBUTTON     "&Don't show a buddy icon for this account", IDC_RADIO_BICONNONE, 15, 260, 215, 10
+}
+
+
+
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
 IDD_ACCOUNTS DIALOG 0, 0, 315, 260
 STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_VISIBLE | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP | WS_SYSMENU
 EXSTYLE WS_EX_WINDOWEDGE
@@ -378,6 +410,7 @@ STRINGTABLE
 	IDS_BUDDYICON_FILTER		"Image Files\t*.bmp;*.png;*.gif;*.jpg\tAll Files (*.*)\t*.*\t"
 	IDS_BUDDYICON_TITLE		"Choose Icon"
 	IDS_OFFLINE			"Offline"
+	IDS_ACCOUNT_PP_TITLE		"Account"
 }
 
 
@@ -388,7 +421,7 @@ IDR_ACCEL_MAIN ACCELERATORS
 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
 IDR_ACCEL_MAIN ACCELERATORS
 {
-	"A",	IDM_BLIST_ACCOUNTS_MANAGE, VIRTKEY, CONTROL
+	"A",	IDM_BLIST_TOOLS_MANAGEACCOUNTS, VIRTKEY, CONTROL
 	"J",	IDM_BLIST_BUDDIES_JOINCHAT, VIRTKEY, CONTROL
 	"B",	IDM_BLIST_BUDDIES_ADDBUDDY, VIRTKEY, CONTROL
 	"M",	IDM_BLIST_BUDDIES_IM, VIRTKEY, CONTROL
============================================================
--- vulture/vultureblist.c	9a25b6157e3d91cb5a0b6d4b633b6f0241695286
+++ vulture/vultureblist.c	b401e092f692e492071ae21e5a67156efc498f7c
@@ -261,7 +261,7 @@ static LRESULT CALLBACK MainWndProc(HWND
 			VultureEnqueueAsyncPurpleCall(PC_REFRESHBLIST, NULL);
 			return 0;
 
-		case IDM_BLIST_ACCOUNTS_MANAGE:
+		case IDM_BLIST_TOOLS_MANAGEACCOUNTS:
 			ManageAccounts(hwnd);
 			return 0;
 


More information about the Commits mailing list