Gtk: make windows resizable

This commit is contained in:
zvon 2020-04-01 20:09:15 +02:00
parent 013d98e941
commit f468596022
5 changed files with 13 additions and 13 deletions

View File

@ -28,7 +28,6 @@ DatabaseWindow::DatabaseWindow(
property_modal().set_value( true ); property_modal().set_value( true );
set_default_size( 550, 350 ); set_default_size( 550, 350 );
set_resizable( false );
auto *box = new Gtk::Box( Gtk::ORIENTATION_VERTICAL ); auto *box = new Gtk::Box( Gtk::ORIENTATION_VERTICAL );
add( *box ); add( *box );
@ -95,6 +94,11 @@ DatabaseWindow::DatabaseWindow(
m_tree_database->signal_button_press_event().connect( m_tree_database->signal_button_press_event().connect(
sigc::mem_fun( *this, &DatabaseWindow::treeViewClick ) ); sigc::mem_fun( *this, &DatabaseWindow::treeViewClick ) );
// make columns resizable
for ( auto &column : m_tree_database->get_columns() ) {
column->set_resizable(true);
}
// create language combobox for treeview // create language combobox for treeview
auto model = Gtk::ListStore::create( m_columns_language ); auto model = Gtk::ListStore::create( m_columns_language );
m_combo_language.property_model().set_value( model ); m_combo_language.property_model().set_value( model );
@ -208,9 +212,6 @@ void DatabaseWindow::save() {
auto *pw = new ProgressWindow; auto *pw = new ProgressWindow;
app->add_window( *pw ); app->add_window( *pw );
std::thread t = std::thread( refreshSelectDB, changed_rows, linux, pw );
t.detach();
// lambda capture // lambda capture
auto *app_ptr = app.get(); auto *app_ptr = app.get();
@ -221,6 +222,10 @@ void DatabaseWindow::save() {
} ); } );
pw->show(); pw->show();
std::thread t = std::thread( refreshSelectDB, changed_rows, linux, pw );
t.detach();
changed_rows.clear(); changed_rows.clear();
} }

View File

@ -31,9 +31,8 @@ int main( int argc, char **argv ) {
error( 1, errno, _( MEM_ALLOC_FAILED ).c_str() ); error( 1, errno, _( MEM_ALLOC_FAILED ).c_str() );
} }
// TODO let user know that program is authenticating and will start shortly
authenticate( API_KEY ); authenticate( API_KEY );
MainWindow mw( app ); MainWindow mw( app );
return app->run( mw ); return app->run( mw );
} }

View File

@ -155,7 +155,6 @@ void MainWindow::finishedSelection() {
std::unique_ptr< Gtk::Dialog > dialog( std::unique_ptr< Gtk::Dialog > dialog(
new Gtk::Dialog( _( RENAME_CONFIRM ), *this ) ); new Gtk::Dialog( _( RENAME_CONFIRM ), *this ) );
dialog->set_default_size( 550, 350 ); dialog->set_default_size( 550, 350 );
dialog->set_resizable( false );
auto content = dialog->get_content_area(); auto content = dialog->get_content_area();
std::unique_ptr< Gtk::ScrolledWindow > sc_w( new Gtk::ScrolledWindow ); std::unique_ptr< Gtk::ScrolledWindow > sc_w( new Gtk::ScrolledWindow );
@ -216,7 +215,6 @@ MainWindow::MainWindow( const Glib::RefPtr< Gtk::Application > &ptr )
Gtk::Label *label_pattern = new Gtk::Label(); Gtk::Label *label_pattern = new Gtk::Label();
set_default_size( 400, 345 ); set_default_size( 400, 345 );
set_resizable( false );
{ {
// if cached pattern exists, load that instead of default // if cached pattern exists, load that instead of default
@ -459,9 +457,9 @@ void MainWindow::dbUpdate() {
app_ptr->remove_window( *pw ); app_ptr->remove_window( *pw );
delete pw; delete pw;
} ); } );
pw->show();
std::thread t( updateDB, !m_check_linux->get_active(), pw ); std::thread t( updateDB, !m_check_linux->get_active(), pw );
t.detach(); t.detach();
pw->show();
} }
void MainWindow::dbClean() { void MainWindow::dbClean() {
@ -477,9 +475,9 @@ void MainWindow::dbRefresh() {
app_ptr->remove_window( *pw ); app_ptr->remove_window( *pw );
delete pw; delete pw;
} ); } );
pw->show();
std::thread t( refreshDB, !m_check_linux->get_active(), pw ); std::thread t( refreshDB, !m_check_linux->get_active(), pw );
t.detach(); t.detach();
pw->show();
} }
void MainWindow::dbAdd() { void MainWindow::dbAdd() {
@ -514,12 +512,12 @@ void MainWindow::dbAdd() {
delete pw; delete pw;
} ); } );
pw->show();
std::thread t( addToDB, std::move( show ), m_entry_dir->get_text(), std::thread t( addToDB, std::move( show ), m_entry_dir->get_text(),
std::move( language_code ), std::move( show_id ), std::move( language_code ), std::move( show_id ),
getDBPattern(), !m_check_linux->get_active(), getDBPattern(), !m_check_linux->get_active(),
m_check_dvd->get_active(), pw ); m_check_dvd->get_active(), pw );
t.detach(); t.detach();
pw->show();
} }
void MainWindow::dbManage() { void MainWindow::dbManage() {

View File

@ -41,7 +41,6 @@ SearchWindow::SearchWindow( std::string &_show, std::string &_id,
language_map( _languages ) { language_map( _languages ) {
set_title( _( GUI_WINDOW_SEARCH ) ); set_title( _( GUI_WINDOW_SEARCH ) );
property_modal().set_value( true ); property_modal().set_value( true );
set_resizable( false );
auto *box = new Gtk::Box( Gtk::ORIENTATION_VERTICAL ); auto *box = new Gtk::Box( Gtk::ORIENTATION_VERTICAL );
add( *box ); add( *box );

View File

@ -36,7 +36,6 @@ SeasonWindow::SeasonWindow( const std::vector< int > &seasons,
set_title( _( GUI_WINDOW_SEASON ) ); set_title( _( GUI_WINDOW_SEASON ) );
set_default_size( 250, 250 ); set_default_size( 250, 250 );
set_resizable( false );
add( m_layout ); add( m_layout );