← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2765: fix glitches with the file list loader

 

Merge authors:
  poy (poy)
------------------------------------------------------------
revno: 2765 [merge]
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Wed 2011-12-28 15:38:29 +0100
message:
  fix glitches with the file list loader
modified:
  atomic/boost/atomic.hpp
  win32/DirectoryListingFrame.cpp
  win32/MainWindow.cpp


--
lp:dcplusplus
https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk

Your team Dcplusplus-team is subscribed to branch lp:dcplusplus.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk/+edit-subscription
=== modified file 'atomic/boost/atomic.hpp'
--- atomic/boost/atomic.hpp	2011-12-17 16:25:32 +0000
+++ atomic/boost/atomic.hpp	2011-12-28 12:51:48 +0000
@@ -61,7 +61,7 @@
 
 #ifndef BOOST_ATOMIC_THREAD_FENCE
 #define BOOST_ATOMIC_THREAD_FENCE 0
-void
+inline void
 atomic_thread_fence(memory_order)
 {
 }
@@ -69,7 +69,7 @@
 
 #ifndef BOOST_ATOMIC_SIGNAL_FENCE
 #define BOOST_ATOMIC_SIGNAL_FENCE 0
-void
+inline void
 atomic_signal_fence(memory_order order)
 {
 	atomic_thread_fence(order);

=== modified file 'win32/DirectoryListingFrame.cpp'
--- win32/DirectoryListingFrame.cpp	2011-12-27 22:02:43 +0000
+++ win32/DirectoryListingFrame.cpp	2011-12-28 14:38:29 +0000
@@ -375,6 +375,8 @@
 		status->setWidget(STATUS_SHOW_TREE, showTree);
 	}
 
+	dirs->setFocus();
+
 	treeRoot = dirs->insert(NULL, new ItemInfo(true, dl->getRoot()));
 
 	ClientManager::getInstance()->addListener(this);
@@ -437,27 +439,30 @@
 		layout();
 	}
 
-	loader = new FileListLoader(dl.get(), path, [this, dir] { callAsync([=] {
+	auto finishLoad = [this] {
+		delete loader;
+		loader = 0;
+		setEnabled(true);
+		loading->close(true);
+		loading = 0;
+		layout();
+		if(!error.empty()) {
+			updateTitle();
+			status->setText(STATUS_STATUS, error);
+		}
+		setDirty(SettingsManager::BOLD_FL);
+	};
+
+	loader = new FileListLoader(dl.get(), path, [this, dir, finishLoad] { callAsync([=] {
 		// success callback
-		delete loader;
-		loader = 0;
-		setEnabled(true);
-		loading->close(true);
 		loaded = true;
+		finishLoad();
 		addRecent();
 		refreshTree(dir);
-		layout();
-		setDirty(SettingsManager::BOLD_FL);
-	}); }, [this](tstring s) { callAsync([=] {
+	}); }, [this, finishLoad](tstring s) { callAsync([=] {
 		// error callback
-		delete loader;
-		loader = 0;
-		setEnabled(true);
-		loading->close(true);
 		error = std::move(s);
-		updateTitle();
-		layout();
-		setDirty(SettingsManager::BOLD_FL);
+		finishLoad();
 	}); });
 
 	onDestroy([this] {
@@ -471,13 +476,8 @@
 		loader->start();
 
 	} catch(const ThreadException& e) {
-		delete loader;
-		loader = 0;
-		setEnabled(true);
-		loading->close(true);
 		error = Text::toT(e.getError());
-		updateTitle();
-		layout();
+		finishLoad();
 	}
 
 	initStatusText();
@@ -502,6 +502,7 @@
 	if(loading) {
 		loading->bringToFront();
 		loading->resize(r);
+		loading->redraw(true);
 		return;
 	}
 

=== modified file 'win32/MainWindow.cpp'
--- win32/MainWindow.cpp	2011-12-27 22:02:43 +0000
+++ win32/MainWindow.cpp	2011-12-28 14:38:29 +0000
@@ -270,7 +270,7 @@
 		file->appendSeparator();
 
 		file->appendItem(T_("Open file list...\tCtrl+L"), [this] { handleOpenFileList(); }, WinUtil::menuIcon(IDI_OPEN_FILE_LIST));
-		file->appendItem(T_("Open own list"), [this] { DirectoryListingFrame::openOwnList(getTabView()); });
+		file->appendItem(T_("Open own list"), [this] { DirectoryListingFrame::openOwnList(getTabView(), Util::emptyStringT, DirectoryListingFrame::FORCE_ACTIVE); });
 		file->appendItem(T_("Match downloaded lists"), [this] { handleMatchAll(); });
 		file->appendItem(T_("Refresh file list\tF5"), [this] { handleRefreshFileList(); }, WinUtil::menuIcon(IDI_REFRESH));
 		file->appendItem(T_("Open downloads directory"), [this] { handleOpenDownloadsDir(); }, WinUtil::menuIcon(IDI_OPEN_DL_DIR));