port-to-gtk3: Use Gtk::Widget::render_icon_pixbuf() (#7)

In Gtk3/C, gtk_widget_render_icon() was deprecated in Gtk 3.0 [1].  In
Gtkmm3/C++, Gtk::Widget::render_icon() was abruptly removed from Gtkmm
3.0 and replaced with Gtk::Widget::render_icon_pixbuf() [2].

Gtk::Widget::render_icon() [3] had an optional 3rd parameter which
GParted never used.  Replace with Gtk::Widget::render_icon_pixbuf() [4].

References:

[1] GTK+ 3 Reference Manual, GtkWidget
    https://developer.gnome.org/gtk3/stable/GtkWidget.html#gtk-widget-render-icon
    "gtk_widget_render_icon has been deprecated since version 3.0 and
    should not be used in newly-written code."

[2] Gtkmm 3.0.0 NEWS file
    "... Removed render_icon(), adding render_icon_pixbuf()."
    https://gitlab.gnome.org/GNOME/gtkmm/blob/3.0.0/NEWS#L187

[3] Gtkmm 2.24 Gtk::Widget Class Reference, render_icon()
    https://developer.gnome.org/gtkmm/2.24/classGtk_1_1Widget.html#a91efd1b5aed7c184506ddd5721710584

[4] Gtkmm 3.0 Gtk::Widget Class Reference, render_icon_pixbuf()
    https://developer.gnome.org/gtkmm/3.0/classGtk_1_1Widget.html#a28bbbd0c1717e58343df56f7f422b106

Closes #7 - Port to Gtk3
This commit is contained in:
Luca Bacci 2018-08-03 18:56:44 +02:00 committed by Mike Fleetwood
parent 5fb58f8877
commit e3f77966c9
4 changed files with 21 additions and 21 deletions

View File

@ -31,8 +31,8 @@ DialogFeatures::DialogFeatures()
set_size_request( -1, 500 ) ;
//initialize icons
icon_yes = render_icon( Gtk::Stock::APPLY, Gtk::ICON_SIZE_LARGE_TOOLBAR );
icon_no = render_icon( Gtk::Stock::CANCEL, Gtk::ICON_SIZE_LARGE_TOOLBAR );
icon_yes = render_icon_pixbuf(Gtk::Stock::APPLY, Gtk::ICON_SIZE_LARGE_TOOLBAR);
icon_no = render_icon_pixbuf(Gtk::Stock::CANCEL, Gtk::ICON_SIZE_LARGE_TOOLBAR);
icon_blank = Gdk::Pixbuf::create( Gdk::COLORSPACE_RGB, true, 8,
icon_yes ->get_width(), icon_yes ->get_height() );
icon_blank ->fill( 0xFFFFFF00 );

View File

@ -64,11 +64,11 @@ Dialog_Progress::Dialog_Progress( const std::vector<Operation *> & operations )
vbox->pack_start(progressbar_all, Gtk::PACK_SHRINK);
//create some icons here, instead of recreating them every time
icon_execute = render_icon(Gtk::Stock::EXECUTE, Gtk::ICON_SIZE_LARGE_TOOLBAR);
icon_success = render_icon(Gtk::Stock::APPLY, Gtk::ICON_SIZE_LARGE_TOOLBAR);
icon_error = render_icon(Gtk::Stock::DIALOG_ERROR, Gtk::ICON_SIZE_LARGE_TOOLBAR);
icon_info = render_icon(Gtk::Stock::INFO, Gtk::ICON_SIZE_LARGE_TOOLBAR);
icon_warning = render_icon(Gtk::Stock::DIALOG_WARNING, Gtk::ICON_SIZE_LARGE_TOOLBAR);
icon_execute = render_icon_pixbuf(Gtk::Stock::EXECUTE, Gtk::ICON_SIZE_LARGE_TOOLBAR);
icon_success = render_icon_pixbuf(Gtk::Stock::APPLY, Gtk::ICON_SIZE_LARGE_TOOLBAR);
icon_error = render_icon_pixbuf(Gtk::Stock::DIALOG_ERROR, Gtk::ICON_SIZE_LARGE_TOOLBAR);
icon_info = render_icon_pixbuf(Gtk::Stock::INFO, Gtk::ICON_SIZE_LARGE_TOOLBAR);
icon_warning = render_icon_pixbuf(Gtk::Stock::DIALOG_WARNING, Gtk::ICON_SIZE_LARGE_TOOLBAR);
treestore_operations = Gtk::TreeStore::create( treeview_operations_columns);
treeview_operations.set_model(treestore_operations);

View File

@ -159,16 +159,16 @@ void TreeView_Detail::create_row( const Gtk::TreeRow & treerow,
const Partition & filesystem_ptn = partition.get_filesystem_partition();
if ( filesystem_ptn.busy )
treerow[ treeview_detail_columns .icon1 ] =
render_icon( Gtk::Stock::DIALOG_AUTHENTICATION, Gtk::ICON_SIZE_BUTTON );
render_icon_pixbuf(Gtk::Stock::DIALOG_AUTHENTICATION, Gtk::ICON_SIZE_BUTTON);
if ( partition.have_messages() > 0 )
{
if ( ! static_cast< Glib::RefPtr<Gdk::Pixbuf> >( treerow[ treeview_detail_columns .icon1 ] ) )
treerow[ treeview_detail_columns .icon1 ] =
render_icon( Gtk::Stock::DIALOG_WARNING, Gtk::ICON_SIZE_BUTTON );
render_icon_pixbuf(Gtk::Stock::DIALOG_WARNING, Gtk::ICON_SIZE_BUTTON);
else
treerow[ treeview_detail_columns .icon2 ] =
render_icon( Gtk::Stock::DIALOG_WARNING, Gtk::ICON_SIZE_BUTTON );
render_icon_pixbuf(Gtk::Stock::DIALOG_WARNING, Gtk::ICON_SIZE_BUTTON);
}

View File

@ -683,7 +683,7 @@ void Win_GParted::refresh_combo_devices()
//combo...
treerow = *( liststore_devices ->append() ) ;
treerow[ treeview_devices_columns .icon ] =
render_icon( Gtk::Stock::HARDDISK, Gtk::ICON_SIZE_LARGE_TOOLBAR ) ;
render_icon_pixbuf(Gtk::Stock::HARDDISK, Gtk::ICON_SIZE_LARGE_TOOLBAR);
treerow[ treeview_devices_columns .device ] = devices[ i ] .get_path() ;
treerow[ treeview_devices_columns .size ] = "(" + Utils::format_size( devices[ i ] .length, devices[ i ] .sector_size ) + ")" ;
@ -2009,7 +2009,7 @@ void Win_GParted::activate_resize()
Operation * operation = new OperationResizeMove( devices[current_device],
*selected_partition_ptr,
*resized_ptn );
operation->icon = render_icon( Gtk::Stock::GOTO_LAST, Gtk::ICON_SIZE_MENU );
operation->icon = render_icon_pixbuf(Gtk::Stock::GOTO_LAST, Gtk::ICON_SIZE_MENU);
delete resized_ptn;
resized_ptn = NULL;
@ -2105,7 +2105,7 @@ void Win_GParted::activate_paste()
*selected_partition_ptr,
dialog.Get_New_Partition(),
*copied_partition );
operation ->icon = render_icon( Gtk::Stock::COPY, Gtk::ICON_SIZE_MENU );
operation ->icon = render_icon_pixbuf(Gtk::Stock::COPY, Gtk::ICON_SIZE_MENU);
// When pasting into unallocated space set a temporary
// path of "Copy of /dev/SRC" for display purposes until
@ -2201,7 +2201,7 @@ void Win_GParted::activate_paste()
*selected_partition_ptr,
*partition_new,
*copied_partition );
operation ->icon = render_icon( Gtk::Stock::COPY, Gtk::ICON_SIZE_MENU );
operation->icon = render_icon_pixbuf(Gtk::Stock::COPY, Gtk::ICON_SIZE_MENU);
delete partition_new;
partition_new = NULL;
@ -2262,7 +2262,7 @@ void Win_GParted::activate_new()
Operation * operation = new OperationCreate( devices[current_device],
*selected_partition_ptr,
dialog.Get_New_Partition() );
operation ->icon = render_icon( Gtk::Stock::NEW, Gtk::ICON_SIZE_MENU );
operation->icon = render_icon_pixbuf(Gtk::Stock::NEW, Gtk::ICON_SIZE_MENU);
Add_Operation( devices[current_device], operation );
@ -2376,7 +2376,7 @@ void Win_GParted::activate_delete()
else //deletion of a real partition...
{
Operation * operation = new OperationDelete( devices[ current_device ], *selected_partition_ptr );
operation ->icon = render_icon( Gtk::Stock::DELETE, Gtk::ICON_SIZE_MENU ) ;
operation->icon = render_icon_pixbuf(Gtk::Stock::DELETE, Gtk::ICON_SIZE_MENU);
Add_Operation( devices[current_device], operation );
}
@ -2528,7 +2528,7 @@ void Win_GParted::activate_format( FSType new_fs )
Operation * operation = new OperationFormat( devices[current_device],
*selected_partition_ptr,
*temp_ptn );
operation->icon = render_icon( Gtk::Stock::CONVERT, Gtk::ICON_SIZE_MENU );
operation->icon = render_icon_pixbuf(Gtk::Stock::CONVERT, Gtk::ICON_SIZE_MENU);
Add_Operation( devices[current_device], operation );
merge_operations( mergetype );
@ -3125,7 +3125,7 @@ void Win_GParted::activate_check()
// file system to fill the partition.
Operation * operation = new OperationCheck( devices[current_device], *selected_partition_ptr );
operation ->icon = render_icon( Gtk::Stock::EXECUTE, Gtk::ICON_SIZE_MENU );
operation->icon = render_icon_pixbuf(Gtk::Stock::EXECUTE, Gtk::ICON_SIZE_MENU);
Add_Operation( devices[current_device], operation );
// Try to merge this check operation with all previous operations.
@ -3154,7 +3154,7 @@ void Win_GParted::activate_label_filesystem()
Operation * operation = new OperationLabelFileSystem( devices[current_device],
*selected_partition_ptr, *part_temp );
operation ->icon = render_icon( Gtk::Stock::EXECUTE, Gtk::ICON_SIZE_MENU );
operation->icon = render_icon_pixbuf(Gtk::Stock::EXECUTE, Gtk::ICON_SIZE_MENU);
delete part_temp;
part_temp = NULL;
@ -3188,7 +3188,7 @@ void Win_GParted::activate_name_partition()
Operation * operation = new OperationNamePartition( devices[current_device],
*selected_partition_ptr, *part_temp );
operation->icon = render_icon( Gtk::Stock::EXECUTE, Gtk::ICON_SIZE_MENU );
operation->icon = render_icon_pixbuf(Gtk::Stock::EXECUTE, Gtk::ICON_SIZE_MENU);
delete part_temp;
part_temp = NULL;
@ -3246,7 +3246,7 @@ void Win_GParted::activate_change_uuid()
Operation * operation = new OperationChangeUUID( devices[current_device],
*selected_partition_ptr, *temp_ptn );
operation ->icon = render_icon( Gtk::Stock::EXECUTE, Gtk::ICON_SIZE_MENU );
operation->icon = render_icon_pixbuf(Gtk::Stock::EXECUTE, Gtk::ICON_SIZE_MENU);
delete temp_ptn;
temp_ptn = NULL;