$OpenBSD: patch-src_PrefsUnifiedDlg_cpp,v 1.3 2016/10/10 13:25:38 dcoppa Exp $

commit 8f0c06698f988e8d93b62045716bd205a015490b
Author: upstream svn <svn@amule.org>
Date:   Thu Oct 6 10:49:44 2016 +0000

Fix restoring toolbar orientation on 'Cancel'

Since the toolbar orientation change takes effect immediately, we have to be
extra careful to restore it to its original state if the user presses 'Cancel'.
Otherwise the current GUI layout and the preferences would get out of sync.

--- src/PrefsUnifiedDlg.cpp.orig	Fri Sep 16 09:55:06 2016
+++ src/PrefsUnifiedDlg.cpp	Mon Oct 10 15:02:43 2016
@@ -521,6 +521,9 @@ bool PrefsUnifiedDlg::TransferToWindow()
 	}
 #endif
 
+	m_verticalToolbar = thePrefs::VerticalToolbar();
+	m_toolbarOrientationChanged = false;
+
 	return true;
 }
 
@@ -780,6 +783,13 @@ void PrefsUnifiedDlg::OnCancel(wxCommandEvent& WXUNUSE
 	Show(false);
 	// restore state of server tab if necessary
 	EnableServerTab(thePrefs::GetNetworkED2K());
+
+	if (m_toolbarOrientationChanged) {
+			theApp->amuledlg->Create_Toolbar(m_verticalToolbar);
+			// Update the first tool (conn button)
+			theApp->amuledlg->ShowConnectionState();
+			theApp->amuledlg->Layout();
+	}
 }
 
 
@@ -920,6 +930,7 @@ void PrefsUnifiedDlg::OnCheckBoxChange(wxCommandEvent&
 			break;
 
 		case IDC_VERTTOOLBAR:
+			m_toolbarOrientationChanged = (m_verticalToolbar != value);
 			theApp->amuledlg->Create_Toolbar(value);
 			// Update the first tool (conn button)
 			theApp->amuledlg->ShowConnectionState();
