modern-gtk2: Use OptionComboBox class for alignment combobox (!17)
First part in a series of commits to replace Gtk::OptionMenu widgets with GParted::OptionComboBox. This specific commit is about partition alignment combobox. Closes !17 - Gtk2 modernisation
This commit is contained in:
parent
5407e8346b
commit
83b98885f6
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
#include "Frame_Resizer_Extended.h"
|
#include "Frame_Resizer_Extended.h"
|
||||||
#include "FileSystem.h"
|
#include "FileSystem.h"
|
||||||
|
#include "OptionComboBox.h"
|
||||||
#include "Partition.h"
|
#include "Partition.h"
|
||||||
|
|
||||||
#include <gtkmm/dialog.h>
|
#include <gtkmm/dialog.h>
|
||||||
|
@ -28,7 +29,6 @@
|
||||||
#include <gtkmm/spinbutton.h>
|
#include <gtkmm/spinbutton.h>
|
||||||
#include <gtkmm/table.h>
|
#include <gtkmm/table.h>
|
||||||
#include <gtkmm/box.h>
|
#include <gtkmm/box.h>
|
||||||
#include <gtkmm/optionmenu.h>
|
|
||||||
|
|
||||||
namespace GParted
|
namespace GParted
|
||||||
{
|
{
|
||||||
|
@ -71,8 +71,7 @@ protected:
|
||||||
|
|
||||||
Gtk::HBox hbox_main ;
|
Gtk::HBox hbox_main ;
|
||||||
Gtk::SpinButton spinbutton_before, spinbutton_size, spinbutton_after;
|
Gtk::SpinButton spinbutton_before, spinbutton_size, spinbutton_after;
|
||||||
Gtk::OptionMenu optionmenu_alignment ;
|
OptionComboBox combo_alignment;
|
||||||
Gtk::Menu menu_alignment ;
|
|
||||||
|
|
||||||
sigc::connection before_change_connection, size_change_connection, after_change_connection ;
|
sigc::connection before_change_connection, size_change_connection, after_change_connection ;
|
||||||
|
|
||||||
|
|
|
@ -95,22 +95,21 @@ Dialog_Base_Partition::Dialog_Base_Partition()
|
||||||
sigc::mem_fun(*this, &Dialog_Base_Partition::on_spinbutton_value_changed), AFTER ) ) ;
|
sigc::mem_fun(*this, &Dialog_Base_Partition::on_spinbutton_value_changed), AFTER ) ) ;
|
||||||
|
|
||||||
//add alignment
|
//add alignment
|
||||||
/*TO TRANSLATORS: used as label for a list of choices. Align to: <optionmenu with choices> */
|
/* TO TRANSLATORS: used as label for a list of choices. Align to: <combo box with choices> */
|
||||||
table_resize .attach( * Utils::mk_label( static_cast<Glib::ustring>( _("Align to:") ) + "\t" ),
|
table_resize .attach( * Utils::mk_label( static_cast<Glib::ustring>( _("Align to:") ) + "\t" ),
|
||||||
0, 1, 3, 4, Gtk::FILL );
|
0, 1, 3, 4, Gtk::FILL );
|
||||||
|
|
||||||
//fill partition alignment menu
|
// Fill partition alignment combo
|
||||||
/*TO TRANSLATORS: Menu option for drop down menu "Align to:" */
|
/* TO TRANSLATORS: Option for combo box "Align to:" */
|
||||||
menu_alignment .items() .push_back( Gtk::Menu_Helpers::MenuElem( _("Cylinder") ) ) ;
|
combo_alignment.items().push_back(_("Cylinder"));
|
||||||
/*TO TRANSLATORS: Menu option for label "Align to:" */
|
/* TO TRANSLATORS: Option for combo box "Align to:" */
|
||||||
menu_alignment .items() .push_back( Gtk::Menu_Helpers::MenuElem( _("MiB") ) ) ;
|
combo_alignment.items().push_back(_("MiB"));
|
||||||
/*TO TRANSLATORS: Menu option for drop down menu "Align to:" */
|
/* TO TRANSLATORS: Option for combo box "Align to:" */
|
||||||
menu_alignment .items() .push_back( Gtk::Menu_Helpers::MenuElem( _("None") ) ) ;
|
combo_alignment.items().push_back(_("None"));
|
||||||
|
|
||||||
optionmenu_alignment .set_menu( menu_alignment );
|
combo_alignment.set_active(ALIGN_MEBIBYTE); // Default setting
|
||||||
optionmenu_alignment .set_history( ALIGN_MEBIBYTE ); //Default setting
|
|
||||||
|
|
||||||
table_resize .attach( optionmenu_alignment, 1, 2, 3, 4, Gtk::FILL );
|
table_resize.attach(combo_alignment, 1, 2, 3, 4, Gtk::FILL);
|
||||||
|
|
||||||
this->add_button( Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL );
|
this->add_button( Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL );
|
||||||
this ->show_all_children() ;
|
this ->show_all_children() ;
|
||||||
|
@ -176,7 +175,7 @@ void Dialog_Base_Partition::prepare_new_partition()
|
||||||
new_partition->sector_end = START + total_length - 1;
|
new_partition->sector_end = START + total_length - 1;
|
||||||
|
|
||||||
//set alignment
|
//set alignment
|
||||||
switch ( optionmenu_alignment .get_history() )
|
switch (combo_alignment.get_active_row_number())
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
new_partition->alignment = ALIGN_CYLINDER;
|
new_partition->alignment = ALIGN_CYLINDER;
|
||||||
|
|
|
@ -181,8 +181,8 @@ void Dialog_Partition_New::set_data( const Device & device,
|
||||||
if ( TOTAL_MB < 2 )
|
if ( TOTAL_MB < 2 )
|
||||||
frame_resizer_base ->set_sensitive( false ) ;
|
frame_resizer_base ->set_sensitive( false ) ;
|
||||||
|
|
||||||
//connect signal handler for Dialog_Base_Partiton optionmenu_alignment
|
// Connect signal handler for Dialog_Base_Partiton combo_alignment.
|
||||||
optionmenu_alignment .signal_changed() .connect(
|
combo_alignment.signal_changed().connect(
|
||||||
sigc::bind<bool>( sigc::mem_fun( *this, &Dialog_Partition_New::optionmenu_changed ), false ) );
|
sigc::bind<bool>( sigc::mem_fun( *this, &Dialog_Partition_New::optionmenu_changed ), false ) );
|
||||||
|
|
||||||
this ->show_all_children() ;
|
this ->show_all_children() ;
|
||||||
|
@ -247,7 +247,7 @@ const Partition & Dialog_Partition_New::Get_New_Partition()
|
||||||
new_partition->set_filesystem_label( Utils::trim( filesystem_label_entry.get_text() ) );
|
new_partition->set_filesystem_label( Utils::trim( filesystem_label_entry.get_text() ) );
|
||||||
|
|
||||||
//set alignment
|
//set alignment
|
||||||
switch ( optionmenu_alignment .get_history() )
|
switch (combo_alignment.get_active_row_number())
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
new_partition->alignment = ALIGN_CYLINDER;
|
new_partition->alignment = ALIGN_CYLINDER;
|
||||||
|
@ -336,7 +336,7 @@ void Dialog_Partition_New::optionmenu_changed( bool type )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//optionmenu_filesystem and optionmenu_alignment
|
// optionmenu_filesystem and combo_alignment
|
||||||
if ( ! type )
|
if ( ! type )
|
||||||
{
|
{
|
||||||
fs = FILESYSTEMS[ optionmenu_filesystem .get_history() ] ;
|
fs = FILESYSTEMS[ optionmenu_filesystem .get_history() ] ;
|
||||||
|
|
Loading…
Reference in New Issue