[gparted] Use Gtk::Viewport wrapper class



commit 1f54ab6b12596fd34af212b07fc7a48b21f0cd1a
Author: Luca Bacci <luca bacci982 gmail com>
Date:   Mon Aug 27 20:18:55 2018 +0200

    Use Gtk::Viewport wrapper class
    
    There is a GtkViewport wrapper class in gtkmm, Gtk::Viewport.  Make use
    of that class instead of direct gtk calls.
    
    Reference:
    https://developer.gnome.org/gtkmm/2.24/classGtk_1_1Viewport.html

 src/Dialog_Partition_Info.cc | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
---
diff --git a/src/Dialog_Partition_Info.cc b/src/Dialog_Partition_Info.cc
index f19146d0..0d814473 100644
--- a/src/Dialog_Partition_Info.cc
+++ b/src/Dialog_Partition_Info.cc
@@ -22,8 +22,8 @@
 #include "Utils.h"
 #include "btrfs.h"
 
-#include <gtk/gtk.h>
 #include <gtkmm/alignment.h>
+#include <gtkmm/viewport.h>
 
 namespace GParted
 {
@@ -53,11 +53,10 @@ Dialog_Partition_Info::Dialog_Partition_Info( const Partition & partition ) : pa
        //As Gtk::VBox widget info_msg_vbox doesn't have a native scrolling capability a
        //  Gtk::Viewport is automatically created to contain it when it is added to the
        //  Gtk::ScrolledWindow widget info_scrolled.  The Viewport widget is created with
-       //  shadow type GTK_SHADOW_IN by default.  Change to GTK_SHADOW_NONE.  Have to use
-       //  GTK+ C API as the Viewport widget isn't exposed via gtkmm C++ API.
-       //  
https://developer.gnome.org/gtkmm/2.24/classGtk_1_1ScrolledWindow.html#a17c588d56d93923841d38f0d5e2ec9d7
-       GtkWidget * scrollable_child = gtk_bin_get_child(GTK_BIN(info_scrolled.gobj()));
-       gtk_viewport_set_shadow_type(GTK_VIEWPORT(scrollable_child), GTK_SHADOW_NONE);
+       //  shadow type GTK_SHADOW_IN by default.  Change to GTK_SHADOW_NONE.
+       Gtk::Viewport * child_viewport = dynamic_cast<Gtk::Viewport *>(info_scrolled.get_child());
+       if (child_viewport)
+               child_viewport->set_shadow_type(Gtk::SHADOW_NONE);
        //horizontally center the information scrolled window to match partition graphic
        Gtk::Alignment * center_widget = manage( new Gtk::Alignment(0.5, 0.5, 0.0, 1.0) ) ;
        center_widget ->add( info_scrolled ) ;


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