[gparted] Make the partition information dialog resizable (#690542)



commit ccaeb8dc516a2e02c40a99dfeb01581e9352bd94
Author: Curtis Gedak <gedakc gmail com>
Date:   Mon Apr 14 12:56:51 2014 -0600

    Make the partition information dialog resizable (#690542)
    
    Make the dialog resizable, add a vertical scrollbar to the information
    and messages section, and set the initial height to ensure the dialog
    fits entirely on an 800x600 screen.
    
    A default height is required because some window managers, such as
    fluxbox used in GParted Live, only permit resizing the height by using
    the bottom corners of the dialog.  If the dialog is too large for the
    screen then the user would not be able to resize it.
    
    Note that two default initial heights are used in an effort to minimize
    the amount of extra whitespace.
    
    Bug 690542 - Partition Information Dialog Warning not readable

 include/Dialog_Partition_Info.h |    7 +++++--
 src/Dialog_Partition_Info.cc    |   31 ++++++++++++++++++++++---------
 2 files changed, 27 insertions(+), 11 deletions(-)
---
diff --git a/include/Dialog_Partition_Info.h b/include/Dialog_Partition_Info.h
index 6480ade..245446b 100644
--- a/include/Dialog_Partition_Info.h
+++ b/include/Dialog_Partition_Info.h
@@ -27,12 +27,13 @@
 #include <gtkmm/stock.h>
 #include <gtkmm/frame.h>
 #include <gtkmm/drawingarea.h>
+#include <gtkmm/scrolledwindow.h>
 #include <gtkmm/table.h>
 
 #define BORDER 8
- 
+
 namespace GParted
-{ 
+{
 
 class Dialog_Partition_Info : public Gtk::Dialog
 {
@@ -53,6 +54,8 @@ private:
        Gtk::HBox *hbox ;
        Gtk::DrawingArea drawingarea ;
        Gtk::Frame *frame ;
+       Gtk::VBox info_msg_vbox ;
+       Gtk::ScrolledWindow info_scrolled ;
 
        Glib::RefPtr<Gdk::GC> gc;
        Glib::RefPtr<Pango::Layout> pango_layout;
diff --git a/src/Dialog_Partition_Info.cc b/src/Dialog_Partition_Info.cc
index 365ee61..4ab27f8 100644
--- a/src/Dialog_Partition_Info.cc
+++ b/src/Dialog_Partition_Info.cc
@@ -25,14 +25,28 @@ Dialog_Partition_Info::Dialog_Partition_Info( const Partition & partition )
 {
        this ->partition = partition ;
 
-       this ->set_resizable( false ) ;
        this ->set_has_separator( false ) ;
-       
+       //Set minimum dialog height so it fits on an 800x600 screen without
+       //  too much whitespace (~500 px max for GNOME desktop).
+       //  Allow extra space if have messages or LVM2 PV
+       if (   partition .messages .size() > 0
+           || partition .filesystem == FS_LVM2_PV
+          )
+               this ->set_size_request( -1, 460) ;
+       else
+               this ->set_size_request( -1, 370 ) ;    //Minimum 370 to avoid scrolling on Fedora 20
+
        /*TO TRANSLATORS: dialogtitle, looks like Information about /dev/hda3 */
        this ->set_title( String::ucompose( _("Information about %1"), partition .get_path() ) );
-        
+
        init_drawingarea() ;
-       
+
+       //place info and optional messages in scrollable window
+       info_msg_vbox .set_border_width( 6 ) ;
+       info_scrolled .set_policy( Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC ) ;
+       info_scrolled .add( info_msg_vbox ) ;
+       this ->get_vbox() ->pack_start( info_scrolled ) ;
+
        //add label for detail and fill with relevant info
        Display_Info() ;
        
@@ -40,8 +54,7 @@ Dialog_Partition_Info::Dialog_Partition_Info( const Partition & partition )
        if ( partition .messages .size() > 0 )
        {
                frame = manage( new Gtk::Frame() );
-               frame ->set_border_width( 10 );
-               
+
                {
                        Gtk::Image* image(manage(new Gtk::Image(Gtk::Stock::DIALOG_WARNING, 
Gtk::ICON_SIZE_BUTTON)));
 
@@ -80,9 +93,9 @@ Dialog_Partition_Info::Dialog_Partition_Info( const Partition & partition )
                vbox ->pack_start( *Utils::mk_label( all_messages, true, true, true ), Gtk::PACK_SHRINK ) ;
                frame ->add( *vbox ) ;
 
-               this ->get_vbox() ->pack_start( *frame, Gtk::PACK_SHRINK ) ;
+               info_msg_vbox .pack_start( *frame, Gtk::PACK_EXPAND_WIDGET ) ;
        }
-               
+
        this ->add_button( Gtk::Stock::CLOSE, Gtk::RESPONSE_OK ) ;
        this ->show_all_children() ;
 }
@@ -203,7 +216,7 @@ void Dialog_Partition_Info::Display_Info()
 
        table ->set_border_width( 5 ) ;
        table ->set_col_spacings(10 ) ;
-       this ->get_vbox() ->pack_start( *table, Gtk::PACK_SHRINK ) ;
+       info_msg_vbox .pack_start( *table, Gtk::PACK_SHRINK ) ;
 
        //FILE SYSTEM DETAIL SECTION
        //file system headline


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