[gparted] modern-gtk2: Use OptionComboBox class for alignment combobox (!17)
- From: Mike Fleetwood <mfleetwo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gparted] modern-gtk2: Use OptionComboBox class for alignment combobox (!17)
- Date: Tue, 13 Nov 2018 17:48:05 +0000 (UTC)
commit 83b98885f614e44869d81a2bb61752ab64a06cce
Author: Luca Bacci <luca bacci982 gmail com>
Date: Tue Jul 31 12:19:14 2018 +0200
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
include/Dialog_Base_Partition.h | 5 ++---
src/Dialog_Base_Partition.cc | 23 +++++++++++------------
src/Dialog_Partition_New.cc | 8 ++++----
3 files changed, 17 insertions(+), 19 deletions(-)
---
diff --git a/include/Dialog_Base_Partition.h b/include/Dialog_Base_Partition.h
index 1b810a9e..8374cf1f 100644
--- a/include/Dialog_Base_Partition.h
+++ b/include/Dialog_Base_Partition.h
@@ -20,6 +20,7 @@
#include "Frame_Resizer_Extended.h"
#include "FileSystem.h"
+#include "OptionComboBox.h"
#include "Partition.h"
#include <gtkmm/dialog.h>
@@ -28,7 +29,6 @@
#include <gtkmm/spinbutton.h>
#include <gtkmm/table.h>
#include <gtkmm/box.h>
-#include <gtkmm/optionmenu.h>
namespace GParted
{
@@ -71,8 +71,7 @@ protected:
Gtk::HBox hbox_main ;
Gtk::SpinButton spinbutton_before, spinbutton_size, spinbutton_after;
- Gtk::OptionMenu optionmenu_alignment ;
- Gtk::Menu menu_alignment ;
+ OptionComboBox combo_alignment;
sigc::connection before_change_connection, size_change_connection, after_change_connection ;
diff --git a/src/Dialog_Base_Partition.cc b/src/Dialog_Base_Partition.cc
index 70f0687b..eeea927f 100644
--- a/src/Dialog_Base_Partition.cc
+++ b/src/Dialog_Base_Partition.cc
@@ -95,22 +95,21 @@ Dialog_Base_Partition::Dialog_Base_Partition()
sigc::mem_fun(*this, &Dialog_Base_Partition::on_spinbutton_value_changed), AFTER ) ) ;
//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" ),
0, 1, 3, 4, Gtk::FILL );
- //fill partition alignment menu
- /*TO TRANSLATORS: Menu option for drop down menu "Align to:" */
- menu_alignment .items() .push_back( Gtk::Menu_Helpers::MenuElem( _("Cylinder") ) ) ;
- /*TO TRANSLATORS: Menu option for label "Align to:" */
- menu_alignment .items() .push_back( Gtk::Menu_Helpers::MenuElem( _("MiB") ) ) ;
- /*TO TRANSLATORS: Menu option for drop down menu "Align to:" */
- menu_alignment .items() .push_back( Gtk::Menu_Helpers::MenuElem( _("None") ) ) ;
+ // Fill partition alignment combo
+ /* TO TRANSLATORS: Option for combo box "Align to:" */
+ combo_alignment.items().push_back(_("Cylinder"));
+ /* TO TRANSLATORS: Option for combo box "Align to:" */
+ combo_alignment.items().push_back(_("MiB"));
+ /* TO TRANSLATORS: Option for combo box "Align to:" */
+ combo_alignment.items().push_back(_("None"));
- optionmenu_alignment .set_menu( menu_alignment );
- optionmenu_alignment .set_history( ALIGN_MEBIBYTE ); //Default setting
+ combo_alignment.set_active(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 ->show_all_children() ;
@@ -176,7 +175,7 @@ void Dialog_Base_Partition::prepare_new_partition()
new_partition->sector_end = START + total_length - 1;
//set alignment
- switch ( optionmenu_alignment .get_history() )
+ switch (combo_alignment.get_active_row_number())
{
case 0:
new_partition->alignment = ALIGN_CYLINDER;
diff --git a/src/Dialog_Partition_New.cc b/src/Dialog_Partition_New.cc
index 237b3afd..8461a5e6 100644
--- a/src/Dialog_Partition_New.cc
+++ b/src/Dialog_Partition_New.cc
@@ -181,8 +181,8 @@ void Dialog_Partition_New::set_data( const Device & device,
if ( TOTAL_MB < 2 )
frame_resizer_base ->set_sensitive( false ) ;
- //connect signal handler for Dialog_Base_Partiton optionmenu_alignment
- optionmenu_alignment .signal_changed() .connect(
+ // Connect signal handler for Dialog_Base_Partiton combo_alignment.
+ combo_alignment.signal_changed().connect(
sigc::bind<bool>( sigc::mem_fun( *this, &Dialog_Partition_New::optionmenu_changed ), false )
);
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() ) );
//set alignment
- switch ( optionmenu_alignment .get_history() )
+ switch (combo_alignment.get_active_row_number())
{
case 0:
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 )
{
fs = FILESYSTEMS[ optionmenu_filesystem .get_history() ] ;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]