Verified Commit 772448f2 authored by Luca Bacci's avatar Luca Bacci
Browse files

WIP: Migrate way from stock items in Gtk::Dialog::add_button() (!43)

Closes !43 - Modern Gtk3 - part 2
parent 4ed834e0
Pipeline #84438 passed with stages
in 43 minutes and 39 seconds
......@@ -157,7 +157,13 @@ DialogFeatures::DialogFeatures()
/*TO TRANSLATORS: This is a button that will search for the software tools installed and then refresh the screen with the file system actions supported. */
add_button( _("Rescan For Supported Actions"), Gtk::RESPONSE_OK );
add_button( Gtk::Stock::CLOSE, Gtk::RESPONSE_CLOSE ) ->grab_focus() ;
Gtk::Button *close_button = add_button(
Utils::get_stock_label(Gtk::Stock::CLOSE),
Gtk::RESPONSE_CLOSE);
close_button->set_image(*Utils::mk_image("window-close", Gtk::ICON_SIZE_BUTTON));
close_button->grab_focus();
show_all_children() ;
}
......
......@@ -54,8 +54,13 @@ DialogManageFlags::DialogManageFlags( const Partition & partition, std::map<Glib
this ->flag_info = flag_info ;
load_treeview() ;
add_button( Gtk::Stock::CLOSE, Gtk::RESPONSE_OK ) ->grab_focus() ;
Gtk::Button *close_button = add_button(
Utils::get_stock_label(Gtk::Stock::CLOSE),
Gtk::RESPONSE_OK);
close_button->set_image(*Utils::mk_image("window-close", Gtk::ICON_SIZE_BUTTON));
close_button->grab_focus();
show_all_children() ;
}
......
......@@ -64,7 +64,11 @@ DialogPasswordEntry::DialogPasswordEntry( const Partition & partition )
error_message = Utils::mk_label( "" );
vbox->pack_start( *error_message );
this->add_button( Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL );
add_button(
Utils::get_stock_label(Gtk::Stock::CANCEL),
Gtk::RESPONSE_CANCEL)
->set_image(*Utils::mk_image("gtk-cancel", Gtk::ICON_SIZE_BUTTON));
Gtk::Button *unlock_button = this->add_button( _("Unlock"), Gtk::RESPONSE_OK );
unlock_button->signal_clicked().connect( sigc::mem_fun( *this, &DialogPasswordEntry::on_button_unlock ) );
this->set_default_response( Gtk::RESPONSE_OK );
......
......@@ -123,7 +123,11 @@ Dialog_Base_Partition::Dialog_Base_Partition()
for (std::vector<Gtk::Widget*>::iterator it = children.begin(); it != children.end(); ++it)
(*it)->set_vexpand();
this->add_button( Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL );
add_button(
Utils::get_stock_label(Gtk::Stock::CANCEL),
Gtk::RESPONSE_CANCEL)
->set_image(*Utils::mk_image("gtk-cancel", Gtk::ICON_SIZE_BUTTON));
this ->show_all_children() ;
}
......@@ -253,8 +257,11 @@ void Dialog_Base_Partition::Set_Confirm_Button( CONFIRMBUTTON button_type )
switch( button_type )
{
case NEW :
this ->add_button( Gtk::Stock::ADD, Gtk::RESPONSE_OK );
add_button(
Utils::get_stock_label(Gtk::Stock::ADD),
Gtk::RESPONSE_OK)
->set_image(*Utils::mk_image("document-add", Gtk::ICON_SIZE_BUTTON));
break ;
case RESIZE_MOVE:
{
......@@ -272,8 +279,11 @@ void Dialog_Base_Partition::Set_Confirm_Button( CONFIRMBUTTON button_type )
break ;
case PASTE :
this ->add_button( Gtk::Stock::PASTE, Gtk::RESPONSE_OK );
add_button(
Utils::get_stock_label(Gtk::Stock::PASTE),
Gtk::RESPONSE_OK)
->set_image(*Utils::mk_image("edit-paste", Gtk::ICON_SIZE_BUTTON));
break ;
}
}
......
......@@ -94,8 +94,16 @@ Dialog_Disklabel::Dialog_Disklabel( const Device & device )
hbox->pack_start(combo_labeltypes, Gtk::PACK_SHRINK);
}
this ->add_button( Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL );
this ->add_button( Gtk::Stock::APPLY, Gtk::RESPONSE_APPLY );
add_button(
Utils::get_stock_label(Gtk::Stock::CANCEL),
Gtk::RESPONSE_CANCEL)
->set_image(*Utils::mk_image("gtk-cancel", Gtk::ICON_SIZE_BUTTON));
add_button(
Utils::get_stock_label(Gtk::Stock::APPLY),
Gtk::RESPONSE_APPLY)
->set_image(*Utils::mk_image("gtk-apply", Gtk::ICON_SIZE_BUTTON));
this ->show_all_children() ;
}
......
......@@ -49,8 +49,16 @@ Dialog_FileSystem_Label::Dialog_FileSystem_Label( const Partition & partition )
entry->select_region( 0, entry->get_text_length() );
hbox->pack_start( *entry, Gtk::PACK_SHRINK );
this ->add_button( Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL ) ;
this ->add_button( Gtk::Stock::OK, Gtk::RESPONSE_OK ) ;
add_button(
Utils::get_stock_label(Gtk::Stock::CANCEL),
Gtk::RESPONSE_CANCEL)
->set_image(*Utils::mk_image("gtk-cancel", Gtk::ICON_SIZE_BUTTON));
add_button(
Utils::get_stock_label(Gtk::Stock::OK),
Gtk::RESPONSE_OK)
->set_image(*Utils::mk_image("gtk-ok", Gtk::ICON_SIZE_BUTTON));
this ->set_default_response( Gtk::RESPONSE_OK ) ;
this ->show_all_children() ;
}
......
......@@ -118,7 +118,11 @@ Dialog_Partition_Info::Dialog_Partition_Info( const Partition & partition ) : pa
info_msg_vbox .pack_start( *frame, Gtk::PACK_EXPAND_WIDGET ) ;
}
this ->add_button( Gtk::Stock::CLOSE, Gtk::RESPONSE_OK ) ;
add_button(
Utils::get_stock_label(Gtk::Stock::CLOSE),
Gtk::RESPONSE_OK)
->set_image(*Utils::mk_image("window-close", Gtk::ICON_SIZE_BUTTON));
this ->show_all_children() ;
}
......
......@@ -55,8 +55,16 @@ Dialog_Partition_Name::Dialog_Partition_Name( const Partition & partition, int m
entry->select_region( 0, entry->get_text_length() );
hbox->pack_start( *entry, Gtk::PACK_SHRINK );
this->add_button( Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL );
this->add_button( Gtk::Stock::OK, Gtk::RESPONSE_OK );
add_button(
Utils::get_stock_label(Gtk::Stock::CANCEL),
Gtk::RESPONSE_CANCEL)
->set_image(*Utils::mk_image("gtk-cancel", Gtk::ICON_SIZE_BUTTON));
add_button(
Utils::get_stock_label(Gtk::Stock::OK),
Gtk::RESPONSE_OK)
->set_image(*Utils::mk_image("gtk-ok", Gtk::ICON_SIZE_BUTTON));
this->set_default_response( Gtk::RESPONSE_OK );
this->show_all_children() ;
}
......
......@@ -118,8 +118,11 @@ Dialog_Progress::Dialog_Progress(const std::vector<Device>& devices, const std::
vbox ->set_spacing(5);
}
cancelbutton = this ->add_button( Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL );
cancelbutton = add_button(
Utils::get_stock_label(Gtk::Stock::CANCEL),
Gtk::RESPONSE_CANCEL);
cancelbutton->set_image(*Utils::mk_image("gtk-cancel", Gtk::ICON_SIZE_BUTTON));
this ->signal_show() .connect( sigc::mem_fun(*this, &Dialog_Progress::on_signal_show) );
this ->show_all_children() ;
}
......@@ -248,7 +251,11 @@ void Dialog_Progress::on_signal_show()
canceltimer.disconnect();
delete cancelbutton;
cancelbutton = 0;
this ->add_button( Gtk::Stock::CLOSE, Gtk::RESPONSE_CLOSE );
add_button(
Utils::get_stock_label(Gtk::Stock::CLOSE),
Gtk::RESPONSE_CLOSE)
->set_image(*Utils::mk_image("window-close", Gtk::ICON_SIZE_BUTTON));
pulsetimer.disconnect();
......@@ -368,8 +375,16 @@ void Dialog_Progress::on_save()
dialog .set_current_folder( Glib::get_home_dir() ) ;
dialog .set_current_name( "gparted_details.htm" ) ;
dialog .set_do_overwrite_confirmation( true ) ;
dialog .add_button( Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL ) ;
dialog .add_button( Gtk::Stock::SAVE, Gtk::RESPONSE_OK ) ; //there's no enum for SAVE
dialog.add_button(
Utils::get_stock_label(Gtk::Stock::CANCEL),
Gtk::RESPONSE_CANCEL)
->set_image(*Utils::mk_image("gtk-cancel", Gtk::ICON_SIZE_BUTTON));
dialog.add_button(
Utils::get_stock_label(Gtk::Stock::SAVE),
Gtk::RESPONSE_OK) //there's no enum for SAVE
->set_image(*Utils::mk_image("document-save", Gtk::ICON_SIZE_BUTTON));
if ( dialog .run() == Gtk::RESPONSE_OK )
{
......
......@@ -37,7 +37,10 @@ Dialog_Rescue_Data::Dialog_Rescue_Data()
{
this ->set_title( _("Search disk for file systems") );
this ->add_button( Gtk::Stock::CLOSE, Gtk::RESPONSE_CLOSE );
add_button(
Utils::get_stock_label(Gtk::Stock::CLOSE),
Gtk::RESPONSE_CLOSE)
->set_image(*Utils::mk_image("window-close", Gtk::ICON_SIZE_BUTTON));
}
//getters
......
......@@ -1169,10 +1169,17 @@ bool Win_GParted::Quit_Check_Operations()
, operations .size()
)
) ;
dialog .add_button( Gtk::Stock::QUIT, Gtk::RESPONSE_CLOSE );
dialog .add_button( Gtk::Stock::CANCEL,Gtk::RESPONSE_CANCEL );
dialog.add_button(
Utils::get_stock_label(Gtk::Stock::QUIT),
Gtk::RESPONSE_CLOSE)
->set_image(*Utils::mk_image("application-exit", Gtk::ICON_SIZE_BUTTON));
dialog.add_button(
Utils::get_stock_label(Gtk::Stock::CANCEL),
Gtk::RESPONSE_CANCEL)
->set_image(*Utils::mk_image("gtk-cancel", Gtk::ICON_SIZE_BUTTON));
if ( dialog .run() == Gtk::RESPONSE_CANCEL )
return false;//don't close GParted
}
......@@ -2392,9 +2399,16 @@ void Win_GParted::activate_delete()
selected_partition_ptr->get_path(),
Utils::get_filesystem_string( selected_partition_ptr->filesystem ),
Utils::format_size( selected_partition_ptr->get_sector_length(), selected_partition_ptr->sector_size ) ) );
dialog .add_button( Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL );
dialog .add_button( Gtk::Stock::DELETE, Gtk::RESPONSE_OK );
dialog.add_button(
Utils::get_stock_label(Gtk::Stock::CANCEL),
Gtk::RESPONSE_CANCEL)
->set_image(*Utils::mk_image("gtk-cancel", Gtk::ICON_SIZE_BUTTON));
dialog.add_button(
Utils::get_stock_label(Gtk::Stock::DELETE),
Gtk::RESPONSE_OK)
->set_image(*Utils::mk_image("edit-delete", Gtk::ICON_SIZE_BUTTON));
dialog .show_all_children() ;
if ( dialog .run() != Gtk::RESPONSE_OK )
......@@ -3423,10 +3437,17 @@ void Win_GParted::activate_apply()
temp += _( "You are advised to backup your data before proceeding." ) ;
dialog .set_secondary_text( temp ) ;
dialog .set_title( _( "Apply operations to device" ) );
dialog .add_button( Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL );
dialog .add_button( Gtk::Stock::APPLY, Gtk::RESPONSE_OK );
dialog.add_button(
Utils::get_stock_label(Gtk::Stock::CANCEL),
Gtk::RESPONSE_CANCEL)
->set_image(*Utils::mk_image("gtk-cancel", Gtk::ICON_SIZE_BUTTON));
dialog.add_button(
Utils::get_stock_label(Gtk::Stock::APPLY),
Gtk::RESPONSE_OK)
->set_image(*Utils::mk_image("gtk-apply", Gtk::ICON_SIZE_BUTTON));
dialog .show_all_children() ;
if ( dialog.run() == Gtk::RESPONSE_OK )
{
......@@ -3536,8 +3557,16 @@ bool Win_GParted::remove_non_empty_lvm2_pv_dialog( const OperationType optype )
grid->attach(*Utils::mk_label(members_str, true, false, true, Gtk::ALIGN_START),
1, 1, 1, 1);
dialog .add_button( Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL );
dialog .add_button( Gtk::Stock::DELETE, Gtk::RESPONSE_OK );
dialog.add_button(
Utils::get_stock_label(Gtk::Stock::CANCEL),
Gtk::RESPONSE_CANCEL)
->set_image(*Utils::mk_image("gtk-cancel", Gtk::ICON_SIZE_BUTTON));
dialog.add_button(
Utils::get_stock_label(Gtk::Stock::DELETE),
Gtk::RESPONSE_OK)
->set_image(*Utils::mk_image("edit-delete", Gtk::ICON_SIZE_BUTTON));
dialog .show_all() ;
if ( dialog .run() == Gtk::RESPONSE_OK )
return true ;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment