[gparted] Show too wide Mount Point column with ellipsis (#771693)



commit 1f4f0a4b677eb795ce4d8d8cad6fae5f1c43372c
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date:   Sun Sep 18 21:46:12 2016 +0100

    Show too wide Mount Point column with ellipsis (#771693)
    
    openSUSE 42.1 with default btrfs root installation is heavily using
    subvolumes.  (Think of btrfs as a storage pool and subvolumes as
    individual file systems within the pool for a rough approximation).
    Thus the root partition is mounted on many mount points:
    
        # df -k
        Filesystem     1K-blocks    Used Available Use% Mounted on
        ...
        /dev/sda2       19445760 5820080  13157104  31% /
        /dev/sda2       19445760 5820080  13157104  31% /var/lib/libvirt/images
        /dev/sda2       19445760 5820080  13157104  31% /var/lib/mysql
        /dev/sda2       19445760 5820080  13157104  31% /.snapshots
        /dev/sda2       19445760 5820080  13157104  31% /home
        /dev/sda2       19445760 5820080  13157104  31% /var/opt
        /dev/sda2       19445760 5820080  13157104  31% /usr/local
        /dev/sda2       19445760 5820080  13157104  31% /var/tmp
        /dev/sda2       19445760 5820080  13157104  31% /var/lib/named
        /dev/sda2       19445760 5820080  13157104  31% /var/lib/mariadb
        /dev/sda2       19445760 5820080  13157104  31% /var/spool
        /dev/sda2       19445760 5820080  13157104  31% /var/lib/pgsql
        /dev/sda2       19445760 5820080  13157104  31% /var/lib/mailman
        /dev/sda2       19445760 5820080  13157104  31% /srv
        /dev/sda2       19445760 5820080  13157104  31% /opt
        /dev/sda2       19445760 5820080  13157104  31% /var/crash
        /dev/sda2       19445760 5820080  13157104  31% /tmp
        /dev/sda2       19445760 5820080  13157104  31% /boot/grub2/i386-pc
        /dev/sda2       19445760 5820080  13157104  31% /var/log
        /dev/sda2       19445760 5820080  13157104  31% /boot/grub2/x86_64-efi
    
    As the Mount Point column contains all 20 mount points it makes the
    column wider than the screen, requiring lots of horizontal scrolling to
    see the following columns.  (Truncated to just 7 mounts in this
    example here).
    
        Partition     | File System | Mount Point
          /dev/sda1 * | # swap      |
          /dev/sda2 * | # btrfs     | /, /.snapshots, /boot/grub2/i386-pc, /boot/grub2/x86_64-efi, /home, 
/opt, /srv
    
    Fix by making the Mount Point column resizable and display truncated
    text with ellipsis.  The column now takes the initial and minimum width
    from the width of the "Mount Point" column header text.
    
        Partition     | File System | Mount Point     |   Size
          /dev/sda1 * | # swap      |                 |  1.45 GiB
          /dev/sda2 * | # btrfs     | /, /.snapsho... | 18.54 GiB
    
    Bug 771693 - Mount Point column is wider than the screen on openSUSE
                 using btrfs root with lots of mounted subvolumes

 src/TreeView_Detail.cc |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/src/TreeView_Detail.cc b/src/TreeView_Detail.cc
index d303bb1..a68f37b 100644
--- a/src/TreeView_Detail.cc
+++ b/src/TreeView_Detail.cc
@@ -23,6 +23,7 @@
 #include <vector>
 #include <gtkmm/cellrenderer.h>
 #include <gtkmm/cellrenderertext.h>
+#include <pangomm/layout.h>
 
 namespace GParted
 { 
@@ -61,6 +62,12 @@ TreeView_Detail::TreeView_Detail()
        Gtk::CellRendererText *cell_renderer_text = dynamic_cast<Gtk::CellRendererText*>( renderers.back() );
        cell_renderer_text ->property_xalign() = Gtk::ALIGN_LEFT ;
 
+       // Tree view column "Mount Point", make column resizable and show too wide text
+       // with ellipsis.
+       get_column( 3 )->set_resizable( true );
+       cell_renderer_text = dynamic_cast<Gtk::CellRendererText *>( get_column( 3 
)->get_first_cell_renderer() );
+       cell_renderer_text->property_ellipsize() = Pango::ELLIPSIZE_END;
+
        //set alignment of numeric columns to right
        for( short t = 5 ; t < 8 ; t++ )
                get_column_cell_renderer( t ) ->property_xalign() = 1 ;


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