Use Gtk::Grid for Win_GParted pt2 (!25)

Gtk::Table was deprecated in Gtk 3.4.0.  Replace with Gtk::Grid.

This commit makes the change for Win_GParted / pt2.

Closes !25 - Modern Gtk3 - part 1
This commit is contained in:
Luca Bacci 2019-03-07 11:44:05 +01:00 committed by Mike Fleetwood
parent 6e07fb051b
commit d57d79b1c4
2 changed files with 69 additions and 88 deletions

View File

@ -35,7 +35,7 @@
#include <gtkmm/combobox.h> #include <gtkmm/combobox.h>
#include <gtkmm/progressbar.h> #include <gtkmm/progressbar.h>
#include <gtkmm/window.h> #include <gtkmm/window.h>
#include <gtkmm/table.h>
namespace GParted namespace GParted
{ {
@ -230,7 +230,6 @@ private:
Gtk::Statusbar statusbar; Gtk::Statusbar statusbar;
Gtk::Image *image ; Gtk::Image *image ;
Gtk::ScrolledWindow *scrollwindow; Gtk::ScrolledWindow *scrollwindow;
Gtk::Table *table ;
Gtk::ProgressBar pulsebar ; Gtk::ProgressBar pulsebar ;
Gtk::TreeRow treerow; Gtk::TreeRow treerow;

View File

@ -567,7 +567,7 @@ void Win_GParted::init_device_info()
{ {
vbox_info.set_orientation(Gtk::ORIENTATION_VERTICAL); vbox_info.set_orientation(Gtk::ORIENTATION_VERTICAL);
vbox_info.set_spacing( 5 ); vbox_info.set_spacing( 5 );
int top = 0, bottom = 1; int top = 0;
//title //title
vbox_info .pack_start( vbox_info .pack_start(
@ -575,98 +575,80 @@ void Win_GParted::init_device_info()
Gtk::PACK_SHRINK ); Gtk::PACK_SHRINK );
//GENERAL DEVICE INFO //GENERAL DEVICE INFO
table = manage( new Gtk::Table() ) ; Gtk::Grid *grid = manage(new Gtk::Grid());
table ->set_col_spacings( 10 ) ; grid->set_column_spacing(10);
//model // Model
table ->attach( * Utils::mk_label( " <b>" + static_cast<Glib::ustring>( _("Model:") ) + "</b>" ), grid->attach(*Utils::mk_label(" <b>" + static_cast<Glib::ustring>(_("Model:")) + "</b>"),
0, 1, 0, top, 1, 1);
top, bottom,
Gtk::FILL ) ;
device_info .push_back( Utils::mk_label( "", true, false, true ) ) ; device_info .push_back( Utils::mk_label( "", true, false, true ) ) ;
table ->attach( * device_info .back(), 1, 2, top++, bottom++, Gtk::FILL ) ; grid->attach(*device_info.back(), 1, top++, 1, 1);
// Serial number // Serial number
table->attach( *Utils::mk_label( " <b>" + static_cast<Glib::ustring>( _("Serial:") ) + "</b>" ), grid->attach(*Utils::mk_label(" <b>" + static_cast<Glib::ustring>(_("Serial:")) + "</b>"),
0, 1, top, bottom, Gtk::FILL ); 0, top, 1, 1);
device_info.push_back( Utils::mk_label( "", true, false, true ) ); device_info.push_back( Utils::mk_label( "", true, false, true ) );
table->attach( *device_info.back(), 1, 2, top++, bottom++, Gtk::FILL ); grid->attach(*device_info.back(), 1, top++, 1, 1);
//size // Size
table ->attach( * Utils::mk_label( " <b>" + static_cast<Glib::ustring>( _("Size:") ) + "</b>" ), grid->attach(*Utils::mk_label(" <b>" + static_cast<Glib::ustring>(_("Size:")) + "</b>"),
0, 1, 0, top, 1, 1);
top, bottom,
Gtk::FILL ) ;
device_info .push_back( Utils::mk_label( "", true, false, true ) ) ; device_info .push_back( Utils::mk_label( "", true, false, true ) ) ;
table ->attach( * device_info .back(), 1, 2, top++, bottom++, Gtk::FILL ) ; grid->attach(*device_info.back(), 1, top++, 1, 1);
//path // Path
table ->attach( * Utils::mk_label( " <b>" + static_cast<Glib::ustring>( _("Path:") ) + "</b>" ), grid->attach(*Utils::mk_label(" <b>" + static_cast<Glib::ustring>(_("Path:")) + "</b>"),
0, 1, 0, top, 1, 1);
top, bottom,
Gtk::FILL ) ;
device_info .push_back( Utils::mk_label( "", true, false, true ) ) ; device_info .push_back( Utils::mk_label( "", true, false, true ) ) ;
table ->attach( * device_info .back(), 1, 2, top++, bottom++, Gtk::FILL ) ; grid->attach(*device_info.back(), 1, top++, 1, 1);
vbox_info .pack_start( *table, Gtk::PACK_SHRINK ); vbox_info.pack_start(*grid, Gtk::PACK_SHRINK);
//DETAILED DEVICE INFO //DETAILED DEVICE INFO
top = 0 ; bottom = 1; top = 0;
table = manage( new Gtk::Table() ) ; grid = manage(new Gtk::Grid());
table ->set_col_spacings( 10 ) ; grid->set_column_spacing(10);
//one blank line // One blank line
table ->attach( * Utils::mk_label( "" ), 1, 2, top++, bottom++, Gtk::FILL ); grid->attach(*Utils::mk_label(""), 1, top++, 1, 1);
//disktype // Disktype
table ->attach( * Utils::mk_label( " <b>" + static_cast<Glib::ustring>( _("Partition table:") ) + "</b>" ), grid->attach(*Utils::mk_label(" <b>" + static_cast<Glib::ustring>(_("Partition table:")) + "</b>"),
0, 1, 0, top, 1, 1);
top, bottom,
Gtk::FILL );
device_info .push_back( Utils::mk_label( "", true, false, true ) ) ; device_info .push_back( Utils::mk_label( "", true, false, true ) ) ;
table ->attach( * device_info .back(), 1, 2, top++, bottom++, Gtk::FILL ) ; grid->attach(*device_info.back(), 1, top++, 1, 1);
//heads // Heads
table ->attach( * Utils::mk_label( " <b>" + static_cast<Glib::ustring>( _("Heads:") ) + "</b>" ), grid->attach(*Utils::mk_label(" <b>" + static_cast<Glib::ustring>(_("Heads:")) + "</b>"),
0, 1, 0, top, 1, 1);
top, bottom,
Gtk::FILL ) ;
device_info .push_back( Utils::mk_label( "", true, false, true ) ) ; device_info .push_back( Utils::mk_label( "", true, false, true ) ) ;
table ->attach( * device_info .back(), 1, 2, top++, bottom++, Gtk::FILL ) ; grid->attach(*device_info.back(), 1, top++, 1, 1);
//sectors/track // Sectors / track
table ->attach( * Utils::mk_label( " <b>" + static_cast<Glib::ustring>( _("Sectors/track:") ) + "</b>" ), grid->attach(*Utils::mk_label(" <b>" + static_cast<Glib::ustring>(_("Sectors/track:")) + "</b>"),
0, 1, 0, top, 1, 1);
top, bottom,
Gtk::FILL ) ;
device_info .push_back( Utils::mk_label( "", true, false, true ) ) ; device_info .push_back( Utils::mk_label( "", true, false, true ) ) ;
table ->attach( * device_info .back(), 1, 2, top++, bottom++, Gtk::FILL ); grid->attach(*device_info.back(), 1, top++, 1, 1);
//cylinders // Cylinders
table ->attach( * Utils::mk_label( " <b>" + static_cast<Glib::ustring>( _("Cylinders:") ) + "</b>" ), grid->attach(*Utils::mk_label(" <b>" + static_cast<Glib::ustring>(_("Cylinders:")) + "</b>"),
0, 1, 0, top, 1, 1);
top, bottom,
Gtk::FILL ) ;
device_info .push_back( Utils::mk_label( "", true, false, true ) ) ; device_info .push_back( Utils::mk_label( "", true, false, true ) ) ;
table ->attach( * device_info .back(), 1, 2, top++, bottom++, Gtk::FILL ) ; grid->attach(*device_info.back(), 1, top++, 1, 1);
//total sectors // Total sectors
table ->attach( * Utils::mk_label( " <b>" + static_cast<Glib::ustring>( _("Total sectors:") ) + "</b>" ), grid->attach(*Utils::mk_label(" <b>" + static_cast<Glib::ustring>(_("Total sectors:")) + "</b>"),
0, 1, 0, top, 1, 1);
top, bottom,
Gtk::FILL );
device_info .push_back( Utils::mk_label( "", true, false, true ) ) ; device_info .push_back( Utils::mk_label( "", true, false, true ) ) ;
table ->attach( * device_info .back(), 1, 2, top++, bottom++, Gtk::FILL ) ; grid->attach(*device_info.back(), 1, top++, 1, 1);
//sector size // Sector size
table ->attach( * Utils::mk_label( " <b>" + static_cast<Glib::ustring>( _("Sector size:") ) + "</b>" ), grid->attach(*Utils::mk_label(" <b>" + static_cast<Glib::ustring>(_("Sector size:")) + "</b>"),
0, 1, 0, top, 1, 1);
top, bottom,
Gtk::FILL );
device_info .push_back( Utils::mk_label( "", true, false, true ) ) ; device_info .push_back( Utils::mk_label( "", true, false, true ) ) ;
table ->attach( * device_info .back(), 1, 2, top++, bottom++, Gtk::FILL ) ; grid->attach(*device_info.back(), 1, top++, 1, 1);
vbox_info .pack_start( *table, Gtk::PACK_SHRINK ); vbox_info.pack_start(*grid, Gtk::PACK_SHRINK);
} }
void Win_GParted::init_hpaned_main() void Win_GParted::init_hpaned_main()