added mountpointcolumn (#304688) added submenu 'Devices' which allows one

* include/TreeView_Detail.h,
  src/TreeView_Detail.cc: added mountpointcolumn (#304688)
* include/Win_GParted.h,
  src/Win_GParted.cc: added submenu 'Devices' which allows one to
  select devices from the menu (#329415)
This commit is contained in:
Bart Hakvoort 2006-02-02 10:59:44 +00:00
parent b301e8da94
commit 35593e5747
5 changed files with 85 additions and 20 deletions

View File

@ -1,3 +1,11 @@
2006-02-02 Bart Hakvoort <hakvoort@cvs.gnome.org>
* include/TreeView_Detail.h,
src/TreeView_Detail.cc: added mountpointcolumn (#304688)
* include/Win_GParted.h,
src/Win_GParted.cc: added submenu 'Devices' which allows one to
select devices from the menu (#329415)
2006-01-31 Bart Hakvoort <hakvoort@cvs.gnome.org> 2006-01-31 Bart Hakvoort <hakvoort@cvs.gnome.org>
* confgure.in: added 'tr' to ALL_LINUGAS on request of the Turkish * confgure.in: added 'tr' to ALL_LINUGAS on request of the Turkish

View File

@ -66,6 +66,7 @@ private:
{ {
Gtk::TreeModelColumn<Glib::ustring> partition; Gtk::TreeModelColumn<Glib::ustring> partition;
Gtk::TreeModelColumn<Glib::ustring> filesystem; Gtk::TreeModelColumn<Glib::ustring> filesystem;
Gtk::TreeModelColumn<Glib::ustring> mountpoint;
Gtk::TreeModelColumn<Glib::ustring> size; Gtk::TreeModelColumn<Glib::ustring> size;
Gtk::TreeModelColumn<Glib::ustring> used; Gtk::TreeModelColumn<Glib::ustring> used;
Gtk::TreeModelColumn<Glib::ustring> unused; Gtk::TreeModelColumn<Glib::ustring> unused;
@ -77,7 +78,7 @@ private:
treeview_detail_Columns( ) treeview_detail_Columns( )
{ {
add( partition ); add( filesystem ); add( partition ); add( filesystem ); add( mountpoint ) ;
add( size ); add( used ); add( unused ); add( size ); add( used ); add( unused );
add( color ); add( text_color ); add( status_icon ); add( color ); add( text_color ); add( status_icon );
add( flags ); add(partition_struct); add( flags ); add(partition_struct);

View File

@ -123,6 +123,7 @@ private:
void close_operationslist( ) ; void close_operationslist( ) ;
void clear_operationslist( ) ; void clear_operationslist( ) ;
void combo_devices_changed( ); void combo_devices_changed( );
void radio_devices_changed( unsigned int item ) ;
void menu_gparted_refresh_devices( ); void menu_gparted_refresh_devices( );
void menu_gparted_filesystems( ); void menu_gparted_filesystems( );

View File

@ -33,6 +33,7 @@ TreeView_Detail::TreeView_Detail( )
//append columns //append columns
append_column( _("Partition"), treeview_detail_columns .partition ); append_column( _("Partition"), treeview_detail_columns .partition );
append_column( _("Filesystem"), treeview_detail_columns .color ); append_column( _("Filesystem"), treeview_detail_columns .color );
append_column( _("Mountpoint"), treeview_detail_columns .mountpoint );
append_column( _("Size"), treeview_detail_columns .size ); append_column( _("Size"), treeview_detail_columns .size );
append_column( _("Used"), treeview_detail_columns .used ); append_column( _("Used"), treeview_detail_columns .used );
append_column( _("Unused"), treeview_detail_columns .unused ); append_column( _("Unused"), treeview_detail_columns .unused );
@ -61,11 +62,11 @@ TreeView_Detail::TreeView_Detail( )
cell_renderer_text ->property_xalign() = Gtk::ALIGN_LEFT ; cell_renderer_text ->property_xalign() = Gtk::ALIGN_LEFT ;
//set alignment of numeric columns to right //set alignment of numeric columns to right
for( short t = 2 ; t < 5 ; t++ ) for( short t = 3 ; t < 6 ; t++ )
get_column_cell_renderer( t ) ->property_xalign() = 1 ; get_column_cell_renderer( t ) ->property_xalign() = 1 ;
//expand columns and centeralign the headertext //expand columns and centeralign the headertext
for( short t = 2 ; t < 6 ; t++ ) for( short t = 3 ; t < 7 ; t++ )
{ {
get_column( t ) ->set_expand( true ) ; get_column( t ) ->set_expand( true ) ;
get_column( t ) ->set_alignment( 0.5 ) ; get_column( t ) ->set_alignment( 0.5 ) ;
@ -146,6 +147,9 @@ void TreeView_Detail::create_row( const Gtk::TreeRow & treerow, const Partition
treerow[ treeview_detail_columns .filesystem ] = treerow[ treeview_detail_columns .filesystem ] =
Utils::Get_Filesystem_String( partition .filesystem ) ; Utils::Get_Filesystem_String( partition .filesystem ) ;
//mountpoint
treerow[ treeview_detail_columns .mountpoint ] = partition .mountpoint ;
//size //size
treerow[ treeview_detail_columns .size ] = Utils::format_size( partition .get_length() ) ; treerow[ treeview_detail_columns .size ] = Utils::format_size( partition .get_length() ) ;

View File

@ -26,6 +26,7 @@
#include <gtkmm/aboutdialog.h> #include <gtkmm/aboutdialog.h>
#include <gtkmm/messagedialog.h> #include <gtkmm/messagedialog.h>
#include <gtkmm/radiobuttongroup.h>
#include <cerrno> #include <cerrno>
#include <sys/swap.h> #include <sys/swap.h>
@ -107,6 +108,10 @@ void Win_GParted::init_menubar( )
menu = manage( new Gtk::Menu( ) ) ; menu = manage( new Gtk::Menu( ) ) ;
image = manage( new Gtk::Image( Gtk::Stock::REFRESH, Gtk::ICON_SIZE_MENU ) ); image = manage( new Gtk::Image( Gtk::Stock::REFRESH, Gtk::ICON_SIZE_MENU ) );
menu ->items( ) .push_back( Gtk::Menu_Helpers::ImageMenuElem( _("_Refresh devices"), Gtk::AccelKey("<control>r"), *image, sigc::mem_fun(*this, &Win_GParted::menu_gparted_refresh_devices) ) ); menu ->items( ) .push_back( Gtk::Menu_Helpers::ImageMenuElem( _("_Refresh devices"), Gtk::AccelKey("<control>r"), *image, sigc::mem_fun(*this, &Win_GParted::menu_gparted_refresh_devices) ) );
image = manage( new Gtk::Image( Gtk::Stock::HARDDISK, Gtk::ICON_SIZE_MENU ) );
menu ->items() .push_back( Gtk::Menu_Helpers::ImageMenuElem( _("Devices"), *image ) ) ;
menu ->items( ) .push_back( Gtk::Menu_Helpers::SeparatorElem( ) ); menu ->items( ) .push_back( Gtk::Menu_Helpers::SeparatorElem( ) );
menu ->items( ) .push_back( Gtk::Menu_Helpers::MenuElem( _("Filesystems"), sigc::mem_fun( *this, &Win_GParted::menu_gparted_filesystems ) ) ); menu ->items( ) .push_back( Gtk::Menu_Helpers::MenuElem( _("Filesystems"), sigc::mem_fun( *this, &Win_GParted::menu_gparted_filesystems ) ) );
menu ->items( ) .push_back( Gtk::Menu_Helpers::SeparatorElem( ) ); menu ->items( ) .push_back( Gtk::Menu_Helpers::SeparatorElem( ) );
@ -149,35 +154,45 @@ void Win_GParted::init_toolbar( )
//NEW and DELETE //NEW and DELETE
toolbutton = Gtk::manage(new Gtk::ToolButton(Gtk::Stock::NEW)); toolbutton = Gtk::manage(new Gtk::ToolButton(Gtk::Stock::NEW));
toolbutton ->signal_clicked().connect( sigc::mem_fun(*this, &Win_GParted::activate_new) ); toolbar_main.append(*toolbutton); toolbutton ->signal_clicked().connect( sigc::mem_fun(*this, &Win_GParted::activate_new) );
toolbar_main.append(*toolbutton);
toolbutton ->set_tooltip(tooltips, _("Create a new partition in the selected unallocated space") ); toolbutton ->set_tooltip(tooltips, _("Create a new partition in the selected unallocated space") );
toolbutton = Gtk::manage(new Gtk::ToolButton(Gtk::Stock::DELETE)); toolbutton = Gtk::manage(new Gtk::ToolButton(Gtk::Stock::DELETE));
toolbutton ->signal_clicked().connect( sigc::mem_fun(*this, &Win_GParted::activate_delete) ); toolbar_main.append(*toolbutton); toolbutton ->signal_clicked().connect( sigc::mem_fun(*this, &Win_GParted::activate_delete) );
toolbar_main.append(*toolbutton);
toolbutton ->set_tooltip(tooltips, _("Delete the selected partition") ); toolbutton ->set_tooltip(tooltips, _("Delete the selected partition") );
toolbar_main.append( *(Gtk::manage(new Gtk::SeparatorToolItem)) ); toolbar_main.append( *(Gtk::manage(new Gtk::SeparatorToolItem)) );
//RESIZE/MOVE //RESIZE/MOVE
image = manage( new Gtk::Image( Gtk::Stock::GOTO_LAST, Gtk::ICON_SIZE_BUTTON ) ); image = manage( new Gtk::Image( Gtk::Stock::GOTO_LAST, Gtk::ICON_SIZE_BUTTON ) );
toolbutton = Gtk::manage(new Gtk::ToolButton( *image, _("Resize/Move") )); toolbutton = Gtk::manage(new Gtk::ToolButton( *image, _("Resize/Move") ));
toolbutton ->signal_clicked().connect( sigc::mem_fun(*this, &Win_GParted::activate_resize) ); toolbar_main.append(*toolbutton); toolbutton ->signal_clicked().connect( sigc::mem_fun(*this, &Win_GParted::activate_resize) );
toolbar_main.append(*toolbutton);
toolbutton ->set_tooltip(tooltips, _("Resize/Move the selected partition") ); toolbutton ->set_tooltip(tooltips, _("Resize/Move the selected partition") );
toolbar_main.append( *(Gtk::manage(new Gtk::SeparatorToolItem)) ); toolbar_main.append( *(Gtk::manage(new Gtk::SeparatorToolItem)) );
//COPY and PASTE //COPY and PASTE
toolbutton = Gtk::manage(new Gtk::ToolButton(Gtk::Stock::COPY)); toolbutton = Gtk::manage(new Gtk::ToolButton(Gtk::Stock::COPY));
toolbutton ->signal_clicked().connect( sigc::mem_fun(*this, &Win_GParted::activate_copy) ); toolbar_main.append(*toolbutton); toolbutton ->signal_clicked().connect( sigc::mem_fun(*this, &Win_GParted::activate_copy) );
toolbar_main.append(*toolbutton);
toolbutton ->set_tooltip(tooltips, _("Copy the selected partition to the clipboard") ); toolbutton ->set_tooltip(tooltips, _("Copy the selected partition to the clipboard") );
toolbutton = Gtk::manage(new Gtk::ToolButton(Gtk::Stock::PASTE)); toolbutton = Gtk::manage(new Gtk::ToolButton(Gtk::Stock::PASTE));
toolbutton ->signal_clicked().connect( sigc::mem_fun(*this, &Win_GParted::activate_paste) ); toolbar_main.append(*toolbutton); toolbutton ->signal_clicked().connect( sigc::mem_fun(*this, &Win_GParted::activate_paste) );
toolbar_main.append(*toolbutton);
toolbutton ->set_tooltip(tooltips, _("Paste the partition from the clipboard") ); toolbutton ->set_tooltip(tooltips, _("Paste the partition from the clipboard") );
toolbar_main.append( *(Gtk::manage(new Gtk::SeparatorToolItem)) ); toolbar_main.append( *(Gtk::manage(new Gtk::SeparatorToolItem)) );
//UNDO and APPLY //UNDO and APPLY
toolbutton = Gtk::manage(new Gtk::ToolButton(Gtk::Stock::UNDO)); toolbutton = Gtk::manage(new Gtk::ToolButton(Gtk::Stock::UNDO));
toolbutton ->signal_clicked().connect( sigc::mem_fun(*this, &Win_GParted::activate_undo) ); toolbar_main.append(*toolbutton); toolbutton ->set_sensitive( false ); toolbutton ->signal_clicked().connect( sigc::mem_fun(*this, &Win_GParted::activate_undo) );
toolbar_main.append(*toolbutton);
toolbutton ->set_sensitive( false );
toolbutton ->set_tooltip(tooltips, _("Undo last operation") ); toolbutton ->set_tooltip(tooltips, _("Undo last operation") );
toolbutton = Gtk::manage(new Gtk::ToolButton(Gtk::Stock::APPLY)); toolbutton = Gtk::manage(new Gtk::ToolButton(Gtk::Stock::APPLY));
toolbutton ->signal_clicked().connect( sigc::mem_fun(*this, &Win_GParted::activate_apply) ); toolbar_main.append(*toolbutton); toolbutton ->set_sensitive( false ); toolbutton ->signal_clicked().connect( sigc::mem_fun(*this, &Win_GParted::activate_apply) );
toolbar_main.append(*toolbutton);
toolbutton ->set_sensitive( false );
toolbutton ->set_tooltip(tooltips, _("Apply all operations") ); toolbutton ->set_tooltip(tooltips, _("Apply all operations") );
//initialize and pack combo_devices //initialize and pack combo_devices
@ -420,15 +435,33 @@ void Win_GParted::refresh_combo_devices()
{ {
liststore_devices ->clear() ; liststore_devices ->clear() ;
menu = manage( new Gtk::Menu() ) ;
Gtk::RadioButtonGroup radio_group ;
for ( unsigned int i = 0 ; i < devices .size( ) ; i++ ) for ( unsigned int i = 0 ; i < devices .size( ) ; i++ )
{ {
//combo...
treerow = *( liststore_devices ->append() ) ; treerow = *( liststore_devices ->append() ) ;
treerow[ treeview_devices_columns .icon ] = treerow[ treeview_devices_columns .icon ] =
render_icon( Gtk::Stock::HARDDISK, Gtk::ICON_SIZE_LARGE_TOOLBAR ) ; render_icon( Gtk::Stock::HARDDISK, Gtk::ICON_SIZE_LARGE_TOOLBAR ) ;
treerow[ treeview_devices_columns .device ] = devices[ i ] .path ; treerow[ treeview_devices_columns .device ] = devices[ i ] .path ;
treerow[ treeview_devices_columns .size ] = "(" + Utils::format_size( devices[ i ] .length ) + ")" ; treerow[ treeview_devices_columns .size ] = "(" + Utils::format_size( devices[ i ] .length ) + ")" ;
//devices submenu....
menu ->items() .push_back( Gtk::Menu_Helpers::RadioMenuElem(
radio_group,
devices[ i ] .path + "\t(" + Utils::format_size( devices[ i ] .length ) + ")",
sigc::bind<unsigned int>( sigc::mem_fun(*this, &Win_GParted::radio_devices_changed), i ) ) ) ;
} }
menubar_main .items()[ 0 ] .get_submenu() ->items()[ 1 ] .remove_submenu() ;
if ( menu ->items() .size() )
menubar_main .items()[ 0 ] .get_submenu() ->items()[ 1 ] .set_submenu( *menu ) ;
menubar_main .items()[ 0 ] .get_submenu() ->items()[ 1 ] .set_sensitive( menu ->items() .size() ) ;
combo_devices .set_active( current_device ) ; combo_devices .set_active( current_device ) ;
} }
@ -735,7 +768,9 @@ void Win_GParted::close_operationslist( )
} }
hbox_operations .hide( ) ; hbox_operations .hide( ) ;
( (Gtk::CheckMenuItem *) & menubar_main .items( ) [ 2 ] .get_submenu( ) ->items() [ 1 ] ) ->set_active( false ) ; static_cast<Gtk::CheckMenuItem *>(
& menubar_main .items( ) [ 2 ] .get_submenu( ) ->
items() [ 1 ] ) ->set_active( false ) ;
} }
void Win_GParted::clear_operationslist() void Win_GParted::clear_operationslist()
@ -755,6 +790,22 @@ void Win_GParted::combo_devices_changed( )
//rebuild visualdisk and treeview //rebuild visualdisk and treeview
Refresh_Visual(); Refresh_Visual();
//uodate radiobuttons..
if ( menubar_main .items()[ 0 ] .get_submenu() ->items()[ 1 ] .get_submenu() )
static_cast<Gtk::RadioMenuItem *>(
& menubar_main .items()[ 0 ] .get_submenu() ->items()[ 1 ] .get_submenu() ->
items()[ current_device ] ) ->set_active( true ) ;
}
void Win_GParted::radio_devices_changed( unsigned int item )
{
if ( static_cast<Gtk::RadioMenuItem *>(
& menubar_main .items()[ 0 ] .get_submenu() ->items()[ 1 ] .get_submenu() ->
items()[ item ] ) ->get_active() )
{
combo_devices .set_active( item ) ;
}
} }
void Win_GParted::thread_refresh_devices() void Win_GParted::thread_refresh_devices()