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



commit e3f77966c949c4074048494baae6892b1a3a4a7e
Author: Luca Bacci <luca bacci982 gmail com>
Date:   Fri Aug 3 18:56:44 2018 +0200

    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

 src/DialogFeatures.cc  |  4 ++--
 src/Dialog_Progress.cc | 10 +++++-----
 src/TreeView_Detail.cc |  6 +++---
 src/Win_GParted.cc     | 22 +++++++++++-----------
 4 files changed, 21 insertions(+), 21 deletions(-)
---
diff --git a/src/DialogFeatures.cc b/src/DialogFeatures.cc
index e01cfbf6..a9574f93 100644
--- a/src/DialogFeatures.cc
+++ b/src/DialogFeatures.cc
@@ -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 );
diff --git a/src/Dialog_Progress.cc b/src/Dialog_Progress.cc
index 5ea00610..b3b25218 100644
--- a/src/Dialog_Progress.cc
+++ b/src/Dialog_Progress.cc
@@ -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);
diff --git a/src/TreeView_Detail.cc b/src/TreeView_Detail.cc
index 1a99f479..03a8ec3b 100644
--- a/src/TreeView_Detail.cc
+++ b/src/TreeView_Detail.cc
@@ -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);
        }
 
        
diff --git a/src/Win_GParted.cc b/src/Win_GParted.cc
index 10dcbb17..a30329ba 100644
--- a/src/Win_GParted.cc
+++ b/src/Win_GParted.cc
@@ -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;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]