"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/dirbookmarkui.cc" between
worker-4.7.0.tar.bz2 and worker-4.8.0.tar.bz2

About: Worker is a file manager for the X Window System with the classical two panel interface.

dirbookmarkui.cc  (worker-4.7.0.tar.bz2):dirbookmarkui.cc  (worker-4.8.0.tar.bz2)
/* dirbookmarkui.cc /* dirbookmarkui.cc
* This file belongs to Worker, a file manager for UN*X/X11. * This file belongs to Worker, a file manager for UN*X/X11.
* Copyright (C) 2007-2020 Ralf Hoffmann. * Copyright (C) 2007-2021 Ralf Hoffmann.
* You can contact me at: ralf@boomerangsworld.de * You can contact me at: ralf@boomerangsworld.de
* or http://www.boomerangsworld.de/worker * or http://www.boomerangsworld.de/worker
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
skipping to change at line 40 skipping to change at line 40
#include "bookmarkdbentry.hh" #include "bookmarkdbentry.hh"
#include "bookmarkdbfilter.hh" #include "bookmarkdbfilter.hh"
#include "dirbookmarkaddui.hh" #include "dirbookmarkaddui.hh"
#include "dirbookmarkeditui.hh" #include "dirbookmarkeditui.hh"
#include "bookmarkdbproxy.hh" #include "bookmarkdbproxy.hh"
#include "nwc_path.hh" #include "nwc_path.hh"
#include <algorithm> #include <algorithm>
#include "prefixdb.hh" #include "prefixdb.hh"
#include "worker.h" #include "worker.h"
#include "stringmatcher_flexibleregex.hh" #include "stringmatcher_flexibleregex.hh"
#include "async_job_limiter.hh"
#include "wconfig.h"
#include <iostream>
DirBookmarkUI::DirBookmarkUI( Worker &worker, DirBookmarkUI::DirBookmarkUI( Worker &worker,
AGUIX &aguix, AGUIX &aguix,
BookmarkDBProxy &data ) : m_worker( worker ), BookmarkDBProxy &data ) : m_worker( worker ),
m_aguix( aguix ), m_aguix( aguix ),
m_data( data ) m_data( data )
{ {
m_filtered_data = std::unique_ptr<BookmarkDBFilter>( new BookmarkDBFilter( d ata ) ); m_filtered_data = std::unique_ptr<BookmarkDBFilter>( new BookmarkDBFilter( d ata ) );
m_win = std::unique_ptr<AWindow>( new AWindow( &m_aguix, m_win = std::unique_ptr<AWindow>( new AWindow( &m_aguix,
skipping to change at line 662 skipping to change at line 665
} }
} }
void DirBookmarkUI::updateLVData( int row, int field, void DirBookmarkUI::updateLVData( int row, int field,
struct FieldListView::on_demand_data &data ) struct FieldListView::on_demand_data &data )
{ {
if ( field == 0 ) { if ( field == 0 ) {
std::string path = m_lv->getText( row, 1 ); std::string path = m_lv->getText( row, 1 );
if ( m_existence_results.count( path ) == 0 ) { if ( m_existence_results.count( path ) == 0 ) {
auto f = std::async( std::launch::async, bool async_started = false;
[path] { bool do_check = true;
return ExistenceTest::checkPathExistence( p
ath );
} );
m_existence_tests.push_back( std::make_tuple( std::move( f ), row, t
rue ) );
data.text = "?"; if ( ! wconfig->getDisableBGCheckPrefix().empty() &&
data.text_set = true; AGUIXUtils::starts_with( path, wconfig->getDisableBGCheckPrefix
() ) ) {
do_check = false;
}
if ( do_check && ! AsyncJobLimiter::async_job_limit_reached() ) {
try {
auto f = std::async( std::launch::async,
[path] {
AsyncJobLimiter::inc_async_job();
auto res = ExistenceTest::checkPath
Existence( path );
AsyncJobLimiter::dec_async_job();
return res;
} );
m_existence_tests.push_back( std::make_tuple( std::move( f )
, row, true ) );
data.text = "?";
data.text_set = true;
async_started = true;
} catch ( std::system_error &e ) {
std::cout << e.what() << std::endl;
}
}
if ( ! async_started ) {
std::promise< ExistenceTest::existence_state_t > promise;
auto f = promise.get_future();
m_existence_tests.push_back( std::make_tuple( std::move( f ), ro
w, true ) );
if ( do_check ) {
promise.set_value( ExistenceTest::checkPathExistence( path )
);
} else {
promise.set_value( { .exists = ExistenceTest::EXISTS_YES,
.path_length = path.size() } );
}
data.text = "?";
data.text_set = true;
}
} else { } else {
auto &res = m_existence_results.at( path ); auto &res = m_existence_results.at( path );
if ( res.exists == ExistenceTest::EXISTS_YES ) { if ( res.exists == ExistenceTest::EXISTS_YES ) {
data.text = ""; data.text = "";
data.text_set = true; data.text_set = true;
} else if ( res.exists == ExistenceTest::EXISTS_NO ) { } else if ( res.exists == ExistenceTest::EXISTS_NO ) {
data.text = ""; data.text = "";
data.text_set = true; data.text_set = true;
} }
 End of changes. 4 change blocks. 
10 lines changed or deleted 53 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)