[gparted] Use Gtk::Grid for Win_GParted pt1 (!25)



commit 6e07fb051b9355eeb1cb56d7a3711983a64864c8
Author: Luca Bacci <luca bacci982 gmail com>
Date:   Wed Mar 6 16:56:34 2019 +0100

    Use Gtk::Grid for Win_GParted pt1 (!25)
    
    Gtk::Table was deprecated in Gtk 3.4.0.  Replace with Gtk::Grid.
    
    This commit makes the change for Win_GParted / pt1.
    
    Closes !25 - Modern Gtk3 - part 1

 src/Win_GParted.cc | 34 ++++++++++++++++------------------
 1 file changed, 16 insertions(+), 18 deletions(-)
---
diff --git a/src/Win_GParted.cc b/src/Win_GParted.cc
index 1d600756..76cffa45 100644
--- a/src/Win_GParted.cc
+++ b/src/Win_GParted.cc
@@ -55,6 +55,7 @@
 #include <gtkmm/radiomenuitem.h>
 #include <gtkmm/main.h>
 #include <gtkmm/separator.h>
+#include <gtkmm/grid.h>
 #include <glibmm/ustring.h>
 #include <glibmm/miscutils.h>
 #include <glibmm/shell.h>
@@ -3497,30 +3498,27 @@ bool Win_GParted::remove_non_empty_lvm2_pv_dialog( const OperationType optype )
 
        dialog .set_secondary_text( tmp_msg, true ) ;
 
-       // Nicely formatted display of VG members by using a table below the secondary
+       // Nicely formatted display of VG members by using a grid below the secondary
        // text in the dialog.
        Gtk::Box * msg_area = dialog .get_message_area() ;
 
        Gtk::Separator *hsep(manage(new Gtk::Separator(Gtk::ORIENTATION_HORIZONTAL)));
        msg_area ->pack_start( * hsep ) ;
 
-       Gtk::Table * table( manage( new Gtk::Table() ) ) ;
-        table ->set_border_width( 0 ) ;
-        table ->set_col_spacings( 10 ) ;
-        msg_area ->pack_start( * table ) ;
+       Gtk::Grid *grid(manage(new Gtk::Grid()));
+       grid->set_column_spacing(10);
+       msg_area->pack_start(*grid);
 
-       int top = 0, bottom = 1 ;
+       // Volume Group
+       grid->attach(*Utils::mk_label("<b>" + Glib::ustring(vgname_label) + "</b>"),
+                    0, 0, 1, 1);
+       grid->attach(*Utils::mk_label(vgname, true, false, true),
+                    1, 0, 1, 1);
 
-       //Volume Group
-       table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( vgname_label ) + "</b>" ),
-                       0, 1, top, bottom, Gtk::FILL ) ;
-       table ->attach( * Utils::mk_label( vgname, true, false, true ),
-                       1, 2, top++, bottom++, Gtk::FILL ) ;
-
-       //Members
-       table->attach(* Utils::mk_label("<b>" + Glib::ustring(members_label) + "</b>",
-                                       true, false, false, Gtk::ALIGN_START),
-                     0, 1, top, bottom, Gtk::FILL);
+       // Members
+       grid->attach(*Utils::mk_label("<b>" + Glib::ustring(members_label) + "</b>",
+                                     true, false, false, Gtk::ALIGN_START),
+                    0, 1, 1, 1);
 
        Glib::ustring members_str = "" ;
        if ( ! members .empty() )
@@ -3532,8 +3530,8 @@ bool Win_GParted::remove_non_empty_lvm2_pv_dialog( const OperationType optype )
                        members_str += members[i] ;
                }
        }
-       table->attach(* Utils::mk_label(members_str, true, false, true, Gtk::ALIGN_START),
-                     1, 2, top++, bottom++, Gtk::FILL);
+       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 );


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