[baobab/wip/cdavis/gtk4] WIP: Port to GTK4




commit fa6d95471c53d27f92eaf2585c805885578e4658
Author: Christopher Davis <christopherdavis gnome org>
Date:   Fri Oct 1 01:49:07 2021 -0700

    WIP: Port to GTK4
    
    Unfinished, doesn't compile

 build-aux/flatpak/org.gnome.baobab.json |   3 +-
 data/ui/baobab-excluded-row.ui          |  24 +---
 data/ui/baobab-folder-display.ui        |   2 -
 data/ui/baobab-location-list.ui         |  12 +-
 data/ui/baobab-location-row.ui          |  69 ++++-----
 data/ui/baobab-main-window.ui           | 238 +++++++++++---------------------
 data/ui/baobab-pathbutton.ui            |   3 -
 data/ui/baobab-preferences-dialog.ui    |  13 +-
 meson.build                             |   4 +-
 src/baobab-application.vala             |   9 +-
 src/baobab-cellrenderers.vala           |  19 +--
 src/baobab-chart.vala                   | 128 +++++++++--------
 src/baobab-location-list.vala           |  15 +-
 src/baobab-pathbar.vala                 |   6 +-
 src/baobab-preferences-dialog.vala      |  25 ++--
 src/baobab-ringschart.vala              |   4 +-
 src/baobab-scanner.vala                 |   2 +-
 src/baobab-window.vala                  | 144 +++++++++----------
 18 files changed, 311 insertions(+), 409 deletions(-)
---
diff --git a/build-aux/flatpak/org.gnome.baobab.json b/build-aux/flatpak/org.gnome.baobab.json
index e5fb1f7..46478c4 100644
--- a/build-aux/flatpak/org.gnome.baobab.json
+++ b/build-aux/flatpak/org.gnome.baobab.json
@@ -20,7 +20,8 @@
         "--talk-name=org.gtk.vfs",
         "--talk-name=org.gtk.vfs.*",
         "--system-talk-name=org.freedesktop.hostname1",
-        "--share=network"
+        "--share=network",
+        "--device=dri"
     ],
     "build-options" : {
         "cflags" : "-O2 -g",
diff --git a/data/ui/baobab-excluded-row.ui b/data/ui/baobab-excluded-row.ui
index a5d48f9..a5b0a9c 100644
--- a/data/ui/baobab-excluded-row.ui
+++ b/data/ui/baobab-excluded-row.ui
@@ -1,35 +1,25 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
   <template class="BaobabExcludedRow" parent="GtkListBoxRow">
-    <property name="visible">True</property>
-    <property name="can_focus">False</property>
     <property name="activatable">False</property>
     <child>
       <object class="GtkGrid">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="margin">12</property>
+        <property name="margin_start">12</property>
+        <property name="margin_end">12</property>
+        <property name="margin_top">12</property>
+        <property name="margin_bottom">12</property>
         <child>
           <object class="GtkLabel" id="name_label">
-            <property name="visible">True</property>
-            <property name="hexpand">True</property>
             <property name="halign">start</property>
             <property name="ellipsize">end</property>
           </object>
         </child>
         <child>
           <object class="GtkButton" id="remove_button">
-            <property name="visible">True</property>
+            <property name="hexpand">True</property>
+            <property name="halign">end</property>
             <property name="valign">center</property>
-            <style>
-              <class name="image-button"/>
-            </style>
-            <child>
-              <object class="GtkImage">
-                <property name="visible">True</property>
-                <property name="icon_name">list-remove-symbolic</property>
-              </object>
-            </child>
+            <property name="icon_name">list-remove-symbolic</property>
           </object>
         </child>
       </object>
diff --git a/data/ui/baobab-folder-display.ui b/data/ui/baobab-folder-display.ui
index a80b246..7e585c7 100644
--- a/data/ui/baobab-folder-display.ui
+++ b/data/ui/baobab-folder-display.ui
@@ -3,8 +3,6 @@
 <interface>
   <requires lib="gtk+" version="3.22"/>
   <template class="BaobabFolderDisplay" parent="GtkTreeView">
-    <property name="visible">True</property>
-    <property name="can_focus">True</property>
     <property name="activate_on_single_click">True</property>
     <child internal-child="selection">
       <object class="GtkTreeSelection" id="treeview_selection">
diff --git a/data/ui/baobab-location-list.ui b/data/ui/baobab-location-list.ui
index ec3713d..8669c67 100644
--- a/data/ui/baobab-location-list.ui
+++ b/data/ui/baobab-location-list.ui
@@ -2,18 +2,18 @@
 <interface>
   <!-- interface-requires gtk+ 3.0 -->
   <template class="BaobabLocationList" parent="GtkBox">
-    <property name="visible">True</property>
     <property name="orientation">vertical</property>
     <property name="spacing">32</property>
-    <property name="margin">32</property>
+    <property name="margin_start">32</property>
+    <property name="margin_end">32</property>
+    <property name="margin_top">32</property>
+    <property name="margin_bottom">32</property>
     <child>
       <object class="GtkBox" id="local_box">
-        <property name="visible">True</property>
         <property name="orientation">vertical</property>
         <property name="spacing">6</property>
         <child>
           <object class="GtkLabel" id="local_label">
-            <property name="visible">True</property>
             <property name="halign">start</property>
             <property name="label" translatable="yes">This Computer</property>
             <style>
@@ -23,7 +23,6 @@
         </child>
         <child>
           <object class="GtkListBox" id="local_list_box">
-            <property name="visible">True</property>
             <property name="selection_mode">none</property>
             <style>
               <class name="view"/>
@@ -35,12 +34,10 @@
     </child>
     <child>
       <object class="GtkBox" id="remote_box">
-        <property name="visible">True</property>
         <property name="orientation">vertical</property>
         <property name="spacing">6</property>
         <child>
           <object class="GtkLabel" id="remote_label">
-            <property name="visible">True</property>
             <property name="halign">start</property>
             <property name="label" translatable="yes">Remote Locations</property>
             <style>
@@ -50,7 +47,6 @@
         </child>
         <child>
           <object class="GtkListBox" id="remote_list_box">
-            <property name="visible">True</property>
             <property name="selection_mode">none</property>
             <style>
               <class name="view"/>
diff --git a/data/ui/baobab-location-row.ui b/data/ui/baobab-location-row.ui
index 115cae2..0b01a17 100644
--- a/data/ui/baobab-location-row.ui
+++ b/data/ui/baobab-location-row.ui
@@ -2,11 +2,8 @@
 <interface>
   <!-- interface-requires gtk+ 3.0 -->
   <template class="BaobabLocationRow" parent="GtkListBoxRow">
-    <property name="visible">True</property>
     <child>
       <object class="GtkBox">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
         <property name="margin-top">6</property>
         <property name="margin-bottom">12</property>
         <property name="margin-start">12</property>
@@ -14,39 +11,32 @@
         <property name="spacing">12</property>
         <child>
           <object class="GtkGrid" id="grid">
-            <property name="visible">True</property>
             <property name="column_spacing">12</property>
             <child>
               <object class="GtkImage" id="image">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
                 <property name="pixel_size">64</property>
+                <layout>
+                  <property name="column">0</property>
+                  <property name="row">0</property>
+                  <property name="row_span">2</property>
+                </layout>
               </object>
-              <packing>
-                <property name="left_attach">0</property>
-                <property name="top_attach">0</property>
-                <property name="height">2</property>
-              </packing>
             </child>
             <child>
               <object class="GtkLabel" id="name_label">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
                 <property name="halign">start</property>
                 <property name="valign">end</property>
                 <property name="hexpand">True</property>
                 <property name="use_markup">True</property>
                 <property name="ellipsize">end</property>
+                <layout>
+                  <property name="column">1</property>
+                  <property name="row">0</property>
+                </layout>
               </object>
-              <packing>
-                <property name="left_attach">1</property>
-                <property name="top_attach">0</property>
-              </packing>
             </child>
             <child>
               <object class="GtkLabel" id="path_label">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
                 <property name="halign">start</property>
                 <property name="valign">start</property>
                 <property name="hexpand">True</property>
@@ -54,59 +44,52 @@
                 <style>
                   <class name="dim-label"/>
                 </style>
+                <layout>
+                  <property name="column">1</property>
+                  <property name="row">1</property>
+                </layout>
               </object>
-              <packing>
-                <property name="left_attach">1</property>
-                <property name="top_attach">1</property>
-              </packing>
             </child>
             <child>
               <object class="GtkLabel" id="available_label">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
                 <property name="halign">end</property>
                 <property name="valign">end</property>
+                <layout>
+                  <property name="column">2</property>
+                  <property name="row">0</property>
+                </layout>
               </object>
-              <packing>
-                <property name="left_attach">2</property>
-                <property name="top_attach">0</property>
-              </packing>
             </child>
             <child>
               <object class="GtkLabel" id="total_size_label">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
                 <property name="halign">end</property>
                 <property name="valign">start</property>
                 <style>
                   <class name="dim-label"/>
                 </style>
+                <layout>
+                  <property name="column">2</property>
+                  <property name="row">1</property>
+                </layout>
               </object>
-              <packing>
-                <property name="left_attach">2</property>
-                <property name="top_attach">1</property>
-              </packing>
             </child>
             <child>
               <object class="GtkLevelBar" id="usage_bar">
-                <property name="can_focus">False</property>
                 <property name="valign">start</property>
                 <property name="margin_top">6</property>
                 <property name="margin_bottom">6</property>
                 <property name="hexpand">True</property>
+                <layout>
+                  <property name="column">0</property>
+                  <property name="row">2</property>
+                  <property name="column_span">3</property>
+                </layout>
               </object>
-              <packing>
-                <property name="left_attach">0</property>
-                <property name="top_attach">2</property>
-                <property name="width">3</property>
-              </packing>
             </child>
           </object>
         </child>
         <child>
           <object class="GtkImage">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
             <property name="icon_name">go-next-symbolic</property>
             <property name="width_request">36</property>
             <style>
diff --git a/data/ui/baobab-main-window.ui b/data/ui/baobab-main-window.ui
index e1cd76a..c20b0ea 100644
--- a/data/ui/baobab-main-window.ui
+++ b/data/ui/baobab-main-window.ui
@@ -31,142 +31,86 @@
       </item>
     </section>
   </menu>
-  <object class="GtkPopoverMenu" id="treeview_popover_menu">
-    <property name="can_focus">False</property>
-    <property name="relative-to">treeview</property>
-    <property name="position">bottom</property>
-  </object>
-  <template class="BaobabWindow" parent="HdyApplicationWindow">
+  <template class="BaobabWindow" parent="AdwApplicationWindow">
     <property name="title" translatable="yes">Disk Usage Analyzer</property>
     <property name="icon_name">baobab</property>
+    <child>
+      <object class="GtkEventControllerFocus" id="focus_controller"/>
+    </child>
     <child>
       <object class="GtkBox" id="vbox">
       <property name="orientation">vertical</property>
-      <property name="visible">True</property>
       <child>
-        <object class="HdyHeaderBar" id="header_bar">
-          <property name="visible">True</property>
-          <property name="can_focus">False</property>
-          <property name="show_close_button">True</property>
-          <style>
-            <class name="titlebar"/>
-          </style>
+        <object class="AdwHeaderBar" id="header_bar">
           <child>
             <object class="GtkButton" id="back_button">
               <property name="valign">center</property>
-              <property name="can_focus">True</property>
               <property name="action_name">win.show-home-page</property>
+              <property name="icon_name">go-previous-symbolic</property>
               <property name="tooltip_text" translatable="yes">Go back to location list</property>
-              <style>
-                <class name="image-button"/>
-              </style>
-              <child>
-                <object class="GtkImage" id="back_button_image">
-                  <property name="visible">True</property>
-                  <property name="icon_name">go-previous-symbolic</property>
-                  <property name="icon_size">1</property>
-                </object>
-              </child>
             </object>
-            <packing>
-              <property name="pack_type">start</property>
-            </packing>
           </child>
-          <child>
-            <object class="GtkButton" id="reload_button">
-              <property name="valign">center</property>
-              <property name="can_focus">True</property>
-              <property name="action_name">win.reload</property>
-              <property name="tooltip_text" translatable="yes">Rescan current location</property>
-              <style>
-                <class name="image-button"/>
-              </style>
-              <child>
-                <object class="GtkImage" id="reload_button_image">
-                  <property name="visible">True</property>
-                  <property name="icon_size">1</property>
-                  <property name="icon_name">view-refresh-symbolic</property>
-                </object>
-              </child>
-            </object>
-            <packing>
-              <property name="pack_type">end</property>
-            </packing>
-          </child>
-          <child>
+          <child type="end">
             <object class="GtkMenuButton" id="menu_button">
               <property name="valign">center</property>
               <property name="menu_model">primarymenu</property>
-              <property name="action_name">win.show-primary-menu</property>
+              <property name="icon_name">open-menu-symbolic</property>
               <property name="direction">none</property>
-              <style>
-                <class name="image-button"/>
-              </style>
             </object>
-            <packing>
-              <property name="pack_type">end</property>
-            </packing>
+          </child>
+          <child type="end">
+            <object class="GtkButton" id="reload_button">
+              <property name="valign">center</property>
+              <property name="action_name">win.reload</property>
+              <property name="icon_name">view-refresh-symbolic</property>
+              <property name="tooltip_text" translatable="yes">Rescan current location</property>
+            </object>
           </child>
         </object>
       </child>
       <child>
         <object class="GtkGrid" id="window_contents">
-          <property name="visible">True</property>
           <property name="orientation">vertical</property>
           <child>
             <object class="GtkInfoBar" id="infobar">
               <property name="visible">False</property>
-              <child internal-child="content_area">
+              <child>
                 <object class="GtkBox" id="infobar_content_area">
-                  <property name="visible">True</property>
-                  <property name="can_focus">False</property>
-                  <property name="border_width">8</property>
+                  <property name="margin_start">8</property>
+                  <property name="margin_end">8</property>
+                  <property name="margin_top">8</property>
+                  <property name="margin_bottom">8</property>
                   <property name="orientation">vertical</property>
                   <property name="spacing">16</property>
                   <property name="hexpand">True</property>
                   <child>
                     <object class="GtkLabel" id="infobar_primary_label">
-                      <property name="visible">True</property>
-                      <property name="can_focus">True</property>
                       <property name="selectable">True</property>
                       <property name="use-markup">True</property>
                       <property name="halign">GTK_ALIGN_START</property>
                       <property name="wrap">True</property>
                     </object>
-                    <packing>
-                      <property name="expand">False</property>
-                      <property name="fill">True</property>
-                      <property name="position">0</property>
-                    </packing>
                   </child>
                   <child>
                     <object class="GtkLabel" id="infobar_secondary_label">
-                      <property name="visible">True</property>
-                      <property name="can_focus">True</property>
                       <property name="selectable">True</property>
                       <property name="use-markup">True</property>
                       <property name="halign">GTK_ALIGN_START</property>
                       <property name="wrap">True</property>
                     </object>
-                    <packing>
-                      <property name="expand">False</property>
-                      <property name="fill">True</property>
-                      <property name="position">1</property>
-                    </packing>
                   </child>
                 </object>
               </child>
-              <child internal-child="action_area">
-                <object class="GtkButtonBox" id="infobar_action_area">
-                  <property name="visible">True</property>
-                  <property name="can_focus">False</property>
-                  <property name="border_width">5</property>
+              <child type="action">
+                <object class="GtkBox" id="infobar_action_area">
+                  <property name="margin_start">5</property>
+                  <property name="margin_end">5</property>
+                  <property name="margin_top">5</property>
+                  <property name="margin_bottom">5</property>
                   <property name="orientation">vertical</property>
                   <property name="spacing">6</property>
-                  <property name="layout_style">end</property>
                   <child>
                     <object class="GtkButton" id="infobar_close_button">
-                      <property name="visible">True</property>
                       <property name="label" translatable="yes">Close</property>
                     </object>
                   </child>
@@ -176,17 +120,12 @@
           </child>
           <child>
             <object class="GtkStack" id="main_stack">
-              <property name="visible">True</property>
-              <property name="can_focus">False</property>
               <property name="transition_type">slide-left-right</property>
               <child>
                 <object class="GtkGrid" id="home_page">
-                  <property name="can_focus">False</property>
-                  <property name="visible">True</property>
                   <property name="orientation">vertical</property>
                   <child>
                     <object class="GtkScrolledWindow" id="location_scrolled_window">
-                      <property name="visible">True</property>
                       <property name="vexpand">True</property>
                       <property name="hexpand">True</property>
                       <property name="hscrollbar-policy">never</property>
@@ -202,40 +141,42 @@
               </child>
               <child>
                 <object class="GtkGrid" id="result_page">
-                  <property name="visible">True</property>
-                  <property name="can_focus">False</property>
                   <property name="column_homogeneous">True</property>
                   <child>
                     <object class="GtkFrame" id="folder_display_frame">
-                      <property name="visible">true</property>
                       <child>
                         <object class="BaobabFolderDisplay" id="folder_display"/>
                       </child>
+                      <layout>
+                        <property name="row">0</property>
+                        <property name="column">0</property>
+                        <property name="column_span">1</property>
+                        <property name="row_span">1</property>
+                      </layout>
                     </object>
-                    <packing>
-                      <property name="left_attach">0</property>
-                      <property name="top_attach">0</property>
-                      <property name="width">1</property>
-                      <property name="height">1</property>
-                    </packing>
                   </child>
                   <child>
                     <object class="GtkScrolledWindow" id="scrolled_window">
-                      <property name="visible">True</property>
-                      <property name="can_focus">True</property>
-                      <property name="shadow_type">in</property>
                       <property name="hexpand">True</property>
                       <property name="vexpand">True</property>
                       <property name="hscrollbar-policy">never</property>
                       <child>
                         <object class="GtkTreeView" id="treeview">
-                          <property name="visible">True</property>
-                          <property name="can_focus">True</property>
                           <property name="headers_visible">false</property>
                           <property name="activate_on_single_click">True</property>
                           <child internal-child="selection">
                             <object class="GtkTreeSelection" id="treeview_selection1"/>
                           </child>
+                          <child>
+                            <object class="GtkPopoverMenu" id="treeview_popover_menu">
+                              <property name="position">bottom</property>
+                            </object>
+                          </child>
+                          <child>
+                            <object class="GtkGestureClick" id="treeview_click_gesture">
+                              <property name="button">3</property>
+                            </object>
+                          </child>
                           <child>
                             <object class="GtkTreeViewColumn" id="folder_column">
                               <property name="title" translatable="yes">Folder</property>
@@ -243,7 +184,7 @@
                               <property name="reorderable">True</property>
                               <property name="sort_column_id">0</property>
                               <child>
-                                <object class="BaobabCellRendererProgress" id="usage_column_bar_renderer">
+                                <object class="GtkCellRendererProgress" id="usage_column_bar_renderer">
                                   <property name="xpad">4</property>
                                   <property name="ypad">4</property>
                                 </object>
@@ -313,111 +254,100 @@
                           </child>
                         </object>
                       </child>
+                      <layout>
+                        <property name="column">0</property>
+                        <property name="row">1</property>
+                        <property name="column_span">1</property>
+                        <property name="row_span">1</property>
+                      </layout>
                     </object>
-                    <packing>
-                      <property name="left_attach">0</property>
-                      <property name="top_attach">1</property>
-                      <property name="width">1</property>
-                      <property name="height">1</property>
-                    </packing>
                   </child>
                   <child>
                     <object class="GtkGrid" id="chart_grid">
-                      <property name="visible">True</property>
-                      <property name="can_focus">False</property>
                       <property name="hexpand">True</property>
                       <property name="vexpand">True</property>
                       <child>
                         <object class="GtkStack" id="spinner_stack">
-                          <property name="visible">True</property>
                           <child>
                             <object class="GtkStack" id="chart_stack">
-                              <property name="visible">True</property>
-                              <property name="can_focus">True</property>
                               <property name="transition_type">crossfade</property>
                               <child>
-                                <object class="BaobabRingschart" id="rings_chart">
-                                  <property name="visible">True</property>
-                                  <property name="hexpand">True</property>
-                                  <property name="vexpand">True</property>
-                                </object>
-                                <packing>
+                                <object class="GtkStackPage">
                                   <property name="name">rings</property>
                                   <property name="title" translatable="yes">Rings Chart</property>
                                   <property name="icon_name">view-ringschart-symbolic</property>
-                                </packing>
+                                  <property name="child">
+                                    <object class="BaobabRingschart" id="rings_chart">
+                                      <property name="hexpand">True</property>
+                                      <property name="vexpand">True</property>
+                                    </object>
+                                  </property>
+                                </object>
                               </child>
                               <child>
-                                <object class="BaobabTreemap" id="treemap_chart">
-                                  <property name="visible">True</property>
-                                  <property name="hexpand">True</property>
-                                  <property name="vexpand">True</property>
-                                </object>
-                                <packing>
+                                <object class="GtkStackPage">
                                   <property name="name">treemap</property>
                                   <property name="title" translatable="yes">Treemap Chart</property>
                                   <property name="icon_name">view-treemap-symbolic</property>
-                                </packing>
+                                  <property name="child">
+                                    <object class="BaobabTreemap" id="treemap_chart">
+                                      <property name="hexpand">True</property>
+                                      <property name="vexpand">True</property>
+                                    </object>
+                                  </property>
+                                </object>
                               </child>
                             </object>
                           </child>
                           <child>
                             <object class="GtkSpinner" id="spinner">
-                              <property name="visible">True</property>
-                              <property name="can_focus">False</property>
                               <property name="width_request">128</property>
                               <property name="height_request">128</property>
                               <property name="halign">GTK_ALIGN_CENTER</property>
                               <property name="valign">GTK_ALIGN_CENTER</property>
                             </object>
                           </child>
+                          <layout>
+                            <property name="column">0</property>
+                            <property name="row">0</property>
+                            <property name="column_span">1</property>
+                            <property name="row_span">1</property>
+                          </layout>
                         </object>
-                        <packing>
-                          <property name="left_attach">0</property>
-                          <property name="top_attach">0</property>
-                          <property name="width">1</property>
-                          <property name="height">1</property>
-                        </packing>
                       </child>
                       <child>
                         <object class="GtkActionBar" id="chart_action_bar">
-                        <property name="visible">True</property>
                           <child type="center">
                             <object class="GtkStackSwitcher" id="chart_stack_switcher">
-                              <property name="visible">True</property>
                               <property name="stack">chart_stack</property>
                             </object>
                           </child>
+                          <layout>
+                            <property name="column">0</property>
+                            <property name="row">1</property>
+                            <property name="column_span">1</property>
+                            <property name="row_span">1</property>
+                          </layout>
                         </object>
-                        <packing>
-                          <property name="left_attach">0</property>
-                          <property name="top_attach">1</property>
-                          <property name="width">1</property>
-                          <property name="height">1</property>
-                        </packing>
                       </child>
+                      <layout>
+                        <property name="column">1</property>
+                        <property name="row">0</property>
+                        <property name="column_span">1</property>
+                        <property name="row_span">2</property>
+                      </layout>
                     </object>
-                    <packing>
-                      <property name="left_attach">1</property>
-                      <property name="top_attach">0</property>
-                      <property name="width">1</property>
-                      <property name="height">2</property>
-                    </packing>
                   </child>
                 </object>
               </child>
             </object>
           </child>
         </object>
-        <packing>
-          <property name="pack_type">end</property>
-        </packing>
       </child>
     </object>
   </child>
   </template>
   <object class="BaobabPathbar" id="pathbar">
-    <property name="visible">True</property>
     <property name="valign">center</property>
     <property name="width_request">700</property>
     <style>
diff --git a/data/ui/baobab-pathbutton.ui b/data/ui/baobab-pathbutton.ui
index 90cf5f7..25eea39 100644
--- a/data/ui/baobab-pathbutton.ui
+++ b/data/ui/baobab-pathbutton.ui
@@ -2,10 +2,8 @@
 <interface>
   <!-- interface-requires gtk+ 3.0 -->
   <template class="BaobabPathButton" parent="GtkButton">
-    <property name="visible">True</property>
     <child>
       <object class="GtkBox" id="box">
-        <property name="visible">True</property>
         <child>
           <object class="GtkImage" id="icon">
             <property name="margin-end">8</property>
@@ -13,7 +11,6 @@
         </child>
         <child>
           <object class="GtkLabel" id="label">
-            <property name="visible">True</property>
             <property name="ellipsize">middle</property>
             <property name="max_width_chars">15</property>
           </object>
diff --git a/data/ui/baobab-preferences-dialog.ui b/data/ui/baobab-preferences-dialog.ui
index 4e683a9..e43eecd 100644
--- a/data/ui/baobab-preferences-dialog.ui
+++ b/data/ui/baobab-preferences-dialog.ui
@@ -2,23 +2,16 @@
 <!-- Generated with glade 3.22.0 -->
 <interface>
   <requires lib="gtk+" version="3.22"/>
-  <template class="BaobabPreferencesDialog" parent="HdyPreferencesWindow">
-    <property name="can_focus">False</property>
-    <property name="type_hint">dialog</property>
+  <template class="BaobabPreferencesDialog" parent="AdwPreferencesWindow">
     <property name="title" translatable="yes">Preferences</property>
     <property name="search_enabled">False</property>
     <child>
-      <object class="HdyPreferencesPage">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
+      <object class="AdwPreferencesPage">
         <child>
-          <object class="HdyPreferencesGroup">
-            <property name="visible">True</property>
+          <object class="AdwPreferencesGroup">
             <property name="title" translatable="yes">Locations to Ignore</property>
             <child>
               <object class="GtkListBox" id="excluded_list_box">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
                 <property name="selection_mode">none</property>
                 <style>
                   <class name="content"/>
diff --git a/meson.build b/meson.build
index 8a5eb7e..da303a0 100644
--- a/meson.build
+++ b/meson.build
@@ -12,8 +12,8 @@ python = import('python')
 glib = dependency('glib-2.0', version: '>=2.44')
 gio = dependency('gio-2.0', version: '>=2.44')
 gobject = dependency('gobject-2.0', version: '>=2.44')
-gtk = dependency('gtk+-3.0', version: '>=3.24.1')
-libhandy = dependency('libhandy-1', version: '>=1.0.0')
+gtk = dependency('gtk4', version: '>=4.4.0')
+libhandy = dependency('libadwaita-1', version: '>=1.0.0')
 
 cc = meson.get_compiler('c')
 math = cc.find_library('m', required: false)
diff --git a/src/baobab-application.vala b/src/baobab-application.vala
index dee0a03..eed5846 100644
--- a/src/baobab-application.vala
+++ b/src/baobab-application.vala
@@ -54,11 +54,6 @@ namespace Baobab {
         void ensure_window () {
             if (window == null) {
                 window = new Window (this);
-
-                window.focus_in_event.connect (() => {
-                    withdraw_notification ("scan-completed");
-                    return false;
-                });
             }
         }
 
@@ -80,12 +75,12 @@ namespace Baobab {
         protected override void startup () {
             base.startup ();
 
-            Hdy.init ();
+            Adw.init ();
 
             // Load custom CSS
             var css_provider = new Gtk.CssProvider ();
             css_provider.load_from_resource ("/org/gnome/baobab/baobab.css");
-            Gtk.StyleContext.add_provider_for_screen (Gdk.Screen.get_default (), css_provider, 
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
+            Gtk.StyleContext.add_provider_for_display (Gdk.Display.get_default (), css_provider, 
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
 
             set_accels_for_action ("win.show-home-page", { "<Alt>Left" });
             set_accels_for_action ("win.show-primary-menu", { "F10" });
diff --git a/src/baobab-cellrenderers.vala b/src/baobab-cellrenderers.vala
index 23bae81..08c2ed0 100644
--- a/src/baobab-cellrenderers.vala
+++ b/src/baobab-cellrenderers.vala
@@ -85,7 +85,7 @@ namespace Baobab {
             }
         }
 
-        protected override void render (Cairo.Context cr, Gtk.Widget widget, Gdk.Rectangle background_area, 
Gdk.Rectangle cell_area, Gtk.CellRendererState flags) {
+        protected override void snapshot (Gtk.Snapshot snp, Gtk.Widget widget, Gdk.Rectangle 
background_area, Gdk.Rectangle cell_area, Gtk.CellRendererState flags) {
             var context = widget.get_style_context ();
 
             context.save ();
@@ -101,7 +101,7 @@ namespace Baobab {
                 break;
             }
 
-            base.render (cr, widget, background_area, cell_area, flags);
+            base.snapshot (snp, widget, background_area, cell_area, flags);
 
             context.restore ();
         }
@@ -135,11 +135,11 @@ namespace Baobab {
             }
         }
     }
-
+    /*
     public class CellRendererProgress : Gtk.CellRendererProgress {
         public Scanner.State state { set; get; }
 
-        public override void render (Cairo.Context cr, Gtk.Widget widget, Gdk.Rectangle background_area, 
Gdk.Rectangle cell_area, Gtk.CellRendererState flags) {
+        public override void snapshot (Gtk.Snapshot snp, Gtk.Widget widget, Gdk.Rectangle background_area, 
Gdk.Rectangle cell_area, Gtk.CellRendererState flags) {
             if (state == Scanner.State.ERROR) {
                 return;
             }
@@ -158,16 +158,16 @@ namespace Baobab {
             context.save ();
             context.add_class ("baobab-level-cell");
 
-            context.render_background (cr, x, y, w, h);
-            context.render_frame (cr, x, y, w, h);
+            snp.render_background (context, x, y, w, h);
+            snp.render_frame (context, x, y, w, h);
 
-            var border = context.get_border (Gtk.StateFlags.NORMAL);
+            var border = context.get_border ();
             x += border.left;
             y += border.top;
             w -= border.left + border.right;
             h -= border.top + border.bottom;
 
-            border = context.get_padding (Gtk.StateFlags.NORMAL);
+            border = context.get_padding ();
             x += border.left;
             y += border.top;
             w -= border.left + border.right;
@@ -188,9 +188,10 @@ namespace Baobab {
                 context.add_class ("level-high");
             }
 
-            context.render_background (cr, x_bar, y, perc_w, h);
+            snp.render_background (context, x_bar, y, perc_w, h);
 
             context.restore ();
         }
     }
+    */
 }
diff --git a/src/baobab-chart.vala b/src/baobab-chart.vala
index b61ef2c..d318f3b 100644
--- a/src/baobab-chart.vala
+++ b/src/baobab-chart.vala
@@ -59,10 +59,13 @@ namespace Baobab {
 
         bool model_changed;
 
-        Gtk.Popover context_menu = null;
+        Gtk.PopoverMenu context_menu = null;
 
         Gtk.EventControllerScroll scroll_controller;
         Gtk.EventControllerMotion motion_controller;
+        Gtk.GestureClick primary_click_gesture;
+        Gtk.GestureClick secondary_click_gesture;
+        Gtk.GestureClick middle_click_gesture;
 
         List<ChartItem> items;
 
@@ -161,10 +164,13 @@ namespace Baobab {
                 }
 
                 if (highlighted_item_ != null) {
-                    get_window ().invalidate_rect (highlighted_item_.rect, true);
+                    // FIXME: Is replacing invalidate_rect () like this right?
+                    // get_window ().invalidate_rect (highlighted_item_.rect, true);
+                    queue_draw ();
                 }
                 if (value != null) {
-                    get_window ().invalidate_rect (value.rect, true);
+                    // get_window ().invalidate_rect (value.rect, true);
+                    queue_draw ();
                 }
 
                 highlighted_item_ = value;
@@ -203,24 +209,57 @@ namespace Baobab {
         };
 
         construct {
-            add_events (Gdk.EventMask.EXPOSURE_MASK | Gdk.EventMask.ENTER_NOTIFY_MASK | 
Gdk.EventMask.LEAVE_NOTIFY_MASK | Gdk.EventMask.BUTTON_PRESS_MASK | Gdk.EventMask.POINTER_MOTION_MASK);
+            // add_events (Gdk.EventMask.EXPOSURE_MASK | Gdk.EventMask.ENTER_NOTIFY_MASK | 
Gdk.EventMask.LEAVE_NOTIFY_MASK | Gdk.EventMask.BUTTON_PRESS_MASK | Gdk.EventMask.POINTER_MOTION_MASK);
 
-            scroll_controller = new Gtk.EventControllerScroll (this, 
Gtk.EventControllerScrollFlags.BOTH_AXES);
+            scroll_controller = new Gtk.EventControllerScroll (Gtk.EventControllerScrollFlags.BOTH_AXES);
             scroll_controller.scroll.connect (scroll_cb);
+            add_controller (scroll_controller);
 
-            motion_controller = new Gtk.EventControllerMotion (this);
+            motion_controller = new Gtk.EventControllerMotion ();
             motion_controller.motion.connect (motion_cb);
             motion_controller.leave.connect (leave_cb);
+            add_controller (motion_controller);
+
+            primary_click_gesture = new Gtk.GestureClick ();
+            primary_click_gesture.button = Gdk.BUTTON_PRIMARY;
+            primary_click_gesture.pressed.connect ((_, x, y) => {
+                if (highlight_item_at_point (x, y)) {
+                    var path = model.get_path (highlighted_item.iter);
+                    if (root.compare (path) == 0) {
+                        move_up_root ();
+                    } else {
+                        item_activated (highlighted_item.iter);
+                    }
+                }
+            });
+            add_controller (primary_click_gesture);
+
+            secondary_click_gesture = new Gtk.GestureClick ();
+            secondary_click_gesture.button = Gdk.BUTTON_SECONDARY;
+            secondary_click_gesture.pressed.connect ((_, x, y) => {
+                show_popover_at ((int) x, (int) y);
+            });
+            add_controller (secondary_click_gesture);
+
+            middle_click_gesture = new Gtk.GestureClick ();
+            middle_click_gesture.button = Gdk.BUTTON_MIDDLE;
+            middle_click_gesture.pressed.connect ((_, x, y) => {
+                move_up_root ();
+            });
+            add_controller (middle_click_gesture);
 
             action_group = new SimpleActionGroup ();
             action_group.add_action_entries (action_entries, this);
             insert_action_group ("chart", action_group);
 
             build_context_menu ();
+
+            set_draw_func (draw_func);
         }
 
-        public override void size_allocate (Gtk.Allocation allocation) {
-            base.size_allocate (allocation);
+        public override void size_allocate (int width, int height, int baseline) {
+            base.size_allocate (width, height, baseline);
+            context_menu.present ();
             foreach (ChartItem item in items) {
                 item.has_visible_children = false;
                 item.visible = false;
@@ -336,10 +375,7 @@ namespace Baobab {
 
             foreach (ChartItem item in items) {
                 Gdk.Rectangle clip;
-                if (Gdk.cairo_get_clip_rectangle (cr, out clip) &&
-                    item.visible &&
-                    clip.intersect (item.rect, null) &&
-                    (item.depth <= max_depth)) {
+                if (item.visible && (item.depth <= max_depth)) {
                     bool highlighted = (item == highlighted_item);
                     draw_item (cr, item, highlighted);
                 }
@@ -400,7 +436,7 @@ namespace Baobab {
             update_draw (path);
         }
 
-        public override bool draw (Cairo.Context cr) {
+        void draw_func (Gtk.DrawingArea da, Cairo.Context cr, int width, int height) {
             if (model != null) {
                 if (model_changed || items == null) {
                     get_items (root);
@@ -413,8 +449,6 @@ namespace Baobab {
 
                 draw_chart (cr);
             }
-
-            return false;
         }
 
         Gdk.RGBA interpolate_colors (Gdk.RGBA colora, Gdk.RGBA colorb, double percentage) {
@@ -423,13 +457,13 @@ namespace Baobab {
             double diff;
 
             diff = colora.red - colorb.red;
-            color.red = colora.red - diff * percentage;
-            diff = colora.green - colorb.green;
-            color.green = colora.green - diff * percentage;
-            diff = colora.blue - colorb.blue;
-            color.blue = colora.blue - diff * percentage;
+            color.red = (float) (colora.red - diff * percentage);
+            diff = (float) (colora.green - colorb.green);
+            color.green = (float) (colora.green - diff * percentage);
+            diff = (float) (colora.blue - colorb.blue);
+            color.blue = (float) (colora.blue - diff * percentage);
 
-            color.alpha = 1.0;
+            color.alpha = (float) 1.0;
 
             return color;
         }
@@ -439,7 +473,7 @@ namespace Baobab {
 
             var color = Gdk.RGBA ();
 
-            double intensity = 1 - (((depth - 1) * 0.3) / MAX_DEPTH);
+            float intensity = (float) (1 - (((depth - 1) * 0.3) / MAX_DEPTH));
 
             if (depth == 0) {
                 context.lookup_color ("level_color", out color);
@@ -463,7 +497,7 @@ namespace Baobab {
                 if (depth == 0) {
                     context.lookup_color ("level_color_hi", out color);
                 } else {
-                    double maximum = double.max (color.red, double.max (color.green, color.blue));
+                    float maximum = float.max (color.red, float.max (color.green, color.blue));
                     color.red /= maximum;
                     color.green /= maximum;
                     color.blue /= maximum;
@@ -473,55 +507,30 @@ namespace Baobab {
             return color;
         }
 
-        protected override bool button_press_event (Gdk.EventButton event) {
-            if (event.type == Gdk.EventType.BUTTON_PRESS) {
-                if (event.triggers_context_menu ()) {
-                    show_popup_menu (event);
-                    return true;
-                }
-
-                switch (event.button) {
-                case Gdk.BUTTON_PRIMARY:
-                    if (highlight_item_at_point (event.x, event.y)) {
-                        var path = model.get_path (highlighted_item.iter);
-                        if (root.compare (path) == 0) {
-                            move_up_root ();
-                        } else {
-                            item_activated (highlighted_item.iter);
-                        }
-                    }
-                    break;
-                case Gdk.BUTTON_MIDDLE:
-                    move_up_root ();
-                    break;
-                }
-
-                return true;
-            }
-
-            return false;
-        }
-
-        void scroll_cb (double dx, double dy) {
+        bool scroll_cb (double dx, double dy) {
             // Up or to the left
             if (dx > 0.0 || dy < 0.0) {
                 zoom_out ();
+                return true;
             // Down or to the right
             } else if (dx < 0.0 || dy > 0.0) {
                 zoom_in ();
+                return true;
             }
+
+            return false;
         }
 
         public void open_file () {
-            ((Window) get_toplevel ()).open_item (highlighted_item.iter);
+            ((Window) get_root ()).open_item (highlighted_item.iter);
         }
 
         public void copy_path () {
-            ((Window) get_toplevel ()).copy_path (highlighted_item.iter);
+            ((Window) get_root ()).copy_path (highlighted_item.iter);
         }
 
         public void trash_file () {
-            ((Window) get_toplevel ()).trash_file (highlighted_item.iter);
+            ((Window) get_root ()).trash_file (highlighted_item.iter);
         }
 
         protected bool can_move_up_root () {
@@ -555,11 +564,12 @@ namespace Baobab {
 
         void build_context_menu () {
             var menu_model = Application.get_default ().get_menu_by_id ("chartmenu");
-            context_menu = new Gtk.Popover.from_model (this, menu_model);
+            context_menu = new Gtk.PopoverMenu.from_model (menu_model);
+            context_menu.set_parent (this);
             context_menu.set_position (Gtk.PositionType.BOTTOM);
         }
 
-        void show_popup_menu (Gdk.EventButton? event) {
+        void show_popover_at (int x, int y) {
             var enable = highlighted_item != null;
             var action = action_group.lookup_action ("open-file") as SimpleAction;
             action.set_enabled (enable);
@@ -576,7 +586,7 @@ namespace Baobab {
             action = action_group.lookup_action ("zoom-out") as SimpleAction;
             action.set_enabled (can_zoom_out ());
 
-            Gdk.Rectangle rect = { (int) event.x, (int) event.y, 0, 0 };
+            Gdk.Rectangle rect = { x, y, 0, 0 };
             context_menu.set_pointing_to (rect);
             context_menu.popup ();
         }
diff --git a/src/baobab-location-list.vala b/src/baobab-location-list.vala
index 43b0ed4..731e329 100644
--- a/src/baobab-location-list.vala
+++ b/src/baobab-location-list.vala
@@ -250,7 +250,7 @@ namespace Baobab {
             }
 
             recent_items.sort ((a, b) => {
-                return (int)(b.get_modified () - a.get_modified ());
+                return (int)(b.get_modified ().difference (a.get_modified ()));
             });
 
             unowned List<Gtk.RecentInfo> last = recent_items.nth (MAX_RECENT_LOCATIONS - 1);
@@ -269,17 +269,22 @@ namespace Baobab {
         }
 
         public void update () {
-            local_list_box.foreach ((widget) => { widget.destroy (); });
-            remote_list_box.foreach ((widget) => { widget.destroy (); });
+            for (Gtk.Widget? child = local_list_box.get_first_child (); child != null; child = 
local_list_box.get_first_child ()) {
+                local_list_box.remove (child);
+            }
+
+            for (Gtk.Widget? child = remote_list_box.get_first_child (); child != null; child = 
remote_list_box.get_first_child ()) {
+                remote_list_box.remove (child);
+            }
 
             remote_box.visible = false;
 
             foreach (var location in locations) {
                 if (location.is_remote) {
-                    remote_list_box.add (new LocationRow (location));
+                    remote_list_box.append (new LocationRow (location));
                     remote_box.visible = true;
                 } else {
-                    local_list_box.add (new LocationRow (location));
+                    local_list_box.append (new LocationRow (location));
                 }
             }
         }
diff --git a/src/baobab-pathbar.vala b/src/baobab-pathbar.vala
index ad39f6c..cb9433a 100644
--- a/src/baobab-pathbar.vala
+++ b/src/baobab-pathbar.vala
@@ -71,13 +71,15 @@ namespace Baobab {
 
                 buttons.reverse ();
                 foreach (var button in buttons) {
-                    add (button);
+                    append (button);
                 }
             }
         }
 
         void clear () {
-            this.foreach ((widget) => { widget.destroy (); });
+            for (Gtk.Widget? child = get_first_child (); child != null; child = get_first_child ()) {
+                remove (child);
+            }
         }
 
         PathButton make_button (Gtk.TreePath path) {
diff --git a/src/baobab-preferences-dialog.vala b/src/baobab-preferences-dialog.vala
index 5a324e1..78b9a14 100644
--- a/src/baobab-preferences-dialog.vala
+++ b/src/baobab-preferences-dialog.vala
@@ -39,7 +39,7 @@ namespace Baobab {
     }
 
     [GtkTemplate (ui = "/org/gnome/baobab/ui/baobab-preferences-dialog.ui")]
-    public class PreferencesDialog : Hdy.PreferencesWindow {
+    public class PreferencesDialog : Adw.PreferencesWindow {
         [GtkChild]
         private unowned Gtk.ListBox excluded_list_box;
 
@@ -50,17 +50,14 @@ namespace Baobab {
 
             excluded_list_box.row_activated.connect (() => {
                 // The only activatable row is "Add location"
-                var file_chooser = new Gtk.FileChooserDialog (_("Select Location to Ignore"), this,
+                var file_chooser = new Gtk.FileChooserNative (_("Select Location to Ignore"), this,
                                                              Gtk.FileChooserAction.SELECT_FOLDER,
-                                                              _("_Cancel"), Gtk.ResponseType.CANCEL,
-                                                              _("_Open"), Gtk.ResponseType.OK);
+                                                             null, null);
 
-                file_chooser.local_only = false;
                 file_chooser.modal = true;
-                file_chooser.set_default_response (Gtk.ResponseType.OK);
 
                 file_chooser.response.connect ((response) => {
-                    if (response == Gtk.ResponseType.OK) {
+                    if (response == Gtk.ResponseType.ACCEPT) {
                         var uri = file_chooser.get_file ().get_uri ();
                         add_uri (uri);
                         populate ();
@@ -75,12 +72,14 @@ namespace Baobab {
         }
 
         void populate () {
-            excluded_list_box.foreach ((widget) => { widget.destroy (); });
+            for (Gtk.Widget? child = excluded_list_box.get_first_child (); child != null; child = 
excluded_list_box.get_first_child ()) {
+                excluded_list_box.remove (child);
+            }
 
             foreach (var uri in prefs_settings.get_strv ("excluded-uris")) {
                 var file = File.new_for_uri (uri);
                 var row = new ExcludedRow (file);
-                excluded_list_box.insert (row, -1);
+                excluded_list_box.append (row);
 
                 row.removed.connect (() => {
                     remove_uri (uri);
@@ -89,9 +88,11 @@ namespace Baobab {
             }
 
             var label = new Gtk.Label (_("Add Location…"));
-            label.margin = 12;
-            label.show ();
-            excluded_list_box.insert (label, -1);
+            label.margin_start = 12;
+            label.margin_end = 12;
+            label.margin_top = 12;
+            label.margin_bottom = 12;
+            excluded_list_box.append (label);
         }
 
         void add_uri (string uri) {
diff --git a/src/baobab-ringschart.vala b/src/baobab-ringschart.vala
index b1c5e39..4073963 100644
--- a/src/baobab-ringschart.vala
+++ b/src/baobab-ringschart.vala
@@ -111,7 +111,7 @@ namespace Baobab {
 
             Gdk.Rectangle last_rect = Gdk.Rectangle ();
 
-            var padding = context.get_padding (context_state);
+            var padding = context.get_padding ();
             var vpadding = padding.top + padding.bottom;
             var hpadding = padding.left + padding.right;
 
@@ -305,7 +305,7 @@ namespace Baobab {
             var context = get_style_context ();
             var context_state = context.get_state ();
 
-            var padding = context.get_padding (context_state);
+            var padding = context.get_padding ();
             var max_radius = int.min (allocation.width / 2, allocation.height / 2) - padding.left; // 
Assuming that padding is the same for all sides
             var thickness = max_radius / (max_depth + 1);
 
diff --git a/src/baobab-scanner.vala b/src/baobab-scanner.vala
index 998995e..1c61a26 100644
--- a/src/baobab-scanner.vala
+++ b/src/baobab-scanner.vala
@@ -419,7 +419,7 @@ namespace Baobab {
             hardlinks = new GenericSet<HardLink> (HardLink.hash, HardLink.equal);
 
             base.clear ();
-            set_sort_column_id (Gtk.SortColumn.UNSORTED, Gtk.SortType.DESCENDING);
+            set_sort_column_id (Gtk.TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID, Gtk.SortType.DESCENDING);
 
             cancellable.reset ();
             scan_error = null;
diff --git a/src/baobab-window.vala b/src/baobab-window.vala
index 3126b20..08946a6 100644
--- a/src/baobab-window.vala
+++ b/src/baobab-window.vala
@@ -23,11 +23,13 @@
 namespace Baobab {
 
     [GtkTemplate (ui = "/org/gnome/baobab/ui/baobab-main-window.ui")]
-    public class Window : Hdy.ApplicationWindow {
+    public class Window : Adw.ApplicationWindow {
+        [GtkChild]
+        private unowned Gtk.EventControllerFocus focus_controller;
         [GtkChild]
         private unowned Gtk.Box vbox;
         [GtkChild]
-        private unowned Hdy.HeaderBar header_bar;
+        private unowned Adw.HeaderBar header_bar;
         [GtkChild]
         private unowned Pathbar pathbar;
         [GtkChild]
@@ -106,19 +108,19 @@ namespace Baobab {
             { "scan-folder", false },
         };
 
-        private enum DndTargets {
-            URI_LIST
-        }
+        // private enum DndTargets {
+        //     URI_LIST
+        // }
 
-        private const Gtk.TargetEntry dnd_target_list[1] = {
-            {"text/uri-list", 0, DndTargets.URI_LIST}
-        };
+        // private const Gtk.TargetEntry dnd_target_list[1] = {
+        //     {"text/uri-list", 0, DndTargets.URI_LIST}
+        // };
 
         public Window (Application app) {
             Object (application: app);
 
             if (busy_cursor == null) {
-                busy_cursor = new Gdk.Cursor.from_name (get_display(), "wait");
+                busy_cursor = new Gdk.Cursor.from_name ("wait", null);
             }
 
             var ui_settings = new Settings ("org.gnome.baobab.ui");
@@ -134,7 +136,7 @@ namespace Baobab {
             GLib.MenuModel treeview_menu = (GLib.MenuModel) builder.get_object ("treeview_menu");
 
             setup_treeview ();
-            treeview_popover_menu.bind_model (treeview_menu, null);
+            treeview_popover_menu.set_menu_model (treeview_menu);
 
             infobar_close_button.clicked.connect (() => { clear_message (); });
 
@@ -147,8 +149,8 @@ namespace Baobab {
             folder_display.activated.connect (on_folder_display_activated);
 
             // Setup drag-n-drop
-            drag_data_received.connect (on_drag_data_received);
-            enable_drop ();
+            // drag_data_received.connect (on_drag_data_received);
+            // enable_drop ();
 
             // Setup window geometry saving
             if (ui_settings.get_boolean ("is-maximized")) {
@@ -157,23 +159,23 @@ namespace Baobab {
 
             int width, height;
             ui_settings.get ("window-size", "(ii)", out width, out height);
-            resize (width, height);
+            set_default_size (width, height);
 
-            ui_settings.bind ("is-maximized", this, "is-maximized", GLib.SettingsBindFlags.SET);
+            ui_settings.bind ("is-maximized", this, "maximized", GLib.SettingsBindFlags.SET);
 
-            size_allocate.connect ((_) => {
-                if (!is_maximized) {
-                    get_size (out width, out height);
-                    ui_settings.set ("window-size", "(ii)", width, height);
+            close_request.connect (() => {
+                if (!maximized) {
+                    int win_width, win_height;
+                    get_default_size (out win_width, out win_height);
+                    ui_settings.set ("window-size", "(ii)", win_width, win_height);
                 }
-            });
-
-            destroy.connect (() => {
                 ui_settings.apply ();
+                return false;
             });
 
             set_ui_state (home_page, false);
 
+            /*
             button_press_event.connect ((event) => {
                 // mouse back button
                 if (event.button == 8) {
@@ -182,6 +184,11 @@ namespace Baobab {
                 }
                 return Gdk.EVENT_PROPAGATE;
             });
+            */
+
+            focus_controller.enter.connect (() => {
+                application.withdraw_notification ("scan-completed");
+            });
 
             show ();
         }
@@ -203,17 +210,17 @@ namespace Baobab {
                                                           _("_Cancel"), Gtk.ResponseType.CANCEL,
                                                           _("_Open"), Gtk.ResponseType.OK);
 
-            file_chooser.local_only = false;
             file_chooser.modal = true;
             file_chooser.set_default_response (Gtk.ResponseType.OK);
 
-            var check_button = new Gtk.CheckButton.with_label (_("Recursively analyze mount points"));
-            file_chooser.extra_widget = check_button;
+            // FIXME: What do we do here to replace this?
+            // var check_button = new Gtk.CheckButton.with_label (_("Recursively analyze mount points"));
+            // file_chooser.extra_widget = check_button;
 
             file_chooser.response.connect ((response) => {
                 if (response == Gtk.ResponseType.OK) {
-                    var flags = check_button.active ? ScanFlags.NONE : ScanFlags.EXCLUDE_MOUNTS;
-                    scan_directory (file_chooser.get_file (), flags);
+                    // var flags = check_button.active ? ScanFlags.NONE : ScanFlags.EXCLUDE_MOUNTS;
+                    scan_directory (file_chooser.get_file (), ScanFlags.NONE);
                 }
                 file_chooser.destroy ();
             });
@@ -264,7 +271,7 @@ namespace Baobab {
 
         void on_help_activate () {
             try {
-                Gtk.show_uri (get_screen (), "help:baobab", Gtk.get_current_event_time ());
+                Gtk.show_uri (this, "help:baobab", Gdk.CURRENT_TIME);
             } catch (Error e) {
                 message (_("Failed to show help"), e.message, Gtk.MessageType.WARNING);
             }
@@ -322,36 +329,36 @@ namespace Baobab {
             }
         }
 
-        void on_drag_data_received (Gtk.Widget widget, Gdk.DragContext context, int x, int y,
-                                    Gtk.SelectionData selection_data, uint target_type, uint time) {
-            File dir = null;
+        // void on_drag_data_received (Gtk.Widget widget, Gdk.DragContext context, int x, int y,
+        //                             Gtk.SelectionData selection_data, uint target_type, uint time) {
+        //     File dir = null;
 
-            if ((selection_data != null) && (selection_data.get_length () >= 0) && (target_type == 
DndTargets.URI_LIST)) {
-                var uris = GLib.Uri.list_extract_uris ((string) selection_data.get_data ());
-                if (uris != null && uris.length == 1) {
-                    dir = File.new_for_uri (uris[0]);
-                }
-            }
+        //     if ((selection_data != null) && (selection_data.get_length () >= 0) && (target_type == 
DndTargets.URI_LIST)) {
+        //         var uris = GLib.Uri.list_extract_uris ((string) selection_data.get_data ());
+        //         if (uris != null && uris.length == 1) {
+        //             dir = File.new_for_uri (uris[0]);
+        //         }
+        //     }
 
-            if (dir != null) {
+        //     if (dir != null) {
                 // finish drop before scanning, since the it can time out
-                Gtk.drag_finish (context, true, false, time);
-                scan_directory (dir);
-            } else {
-                Gtk.drag_finish (context, false, false, time);
-            }
-        }
-
-        void enable_drop () {
-            Gtk.drag_dest_set (this,
-                               Gtk.DestDefaults.DROP | Gtk.DestDefaults.MOTION | Gtk.DestDefaults.HIGHLIGHT,
-                               dnd_target_list,
-                               Gdk.DragAction.COPY);
-        }
-
-        void disable_drop () {
-            Gtk.drag_dest_unset (this);
-        }
+        //         Gtk.drag_finish (context, true, false, time);
+        //         scan_directory (dir);
+        //     } else {
+        //         Gtk.drag_finish (context, false, false, time);
+        //     }
+        // }
+
+        // void enable_drop () {
+        //     Gtk.drag_dest_set (this,
+        //                        Gtk.DestDefaults.DROP | Gtk.DestDefaults.MOTION | 
Gtk.DestDefaults.HIGHLIGHT,
+        //                        dnd_target_list,
+        //                        Gdk.DragAction.COPY);
+        // }
+
+        // void disable_drop () {
+        //     Gtk.drag_dest_unset (this);
+        // }
 
         bool show_treeview_popover (Gtk.PopoverMenu popover, int x, int y) {
             Gdk.Rectangle  rect = { x, y, 0, 0, };
@@ -371,9 +378,8 @@ namespace Baobab {
 
         public void copy_path (Gtk.TreeIter iter) {
             var parse_name = active_location.scanner.get_file (iter).get_parse_name ();
-            var clipboard = Gtk.Clipboard.get (Gdk.SELECTION_CLIPBOARD);
-            clipboard.set_text (parse_name, -1);
-            clipboard.store ();
+            var clipboard = get_primary_clipboard ();
+            clipboard.set_text (parse_name);
         }
 
         public void trash_file (Gtk.TreeIter iter) {
@@ -444,6 +450,7 @@ namespace Baobab {
         }
 
         void setup_treeview () {
+            /*
             treeview.button_press_event.connect ((event) => {
                 if (event.triggers_context_menu ()) {
                     Gtk.TreePath path;
@@ -492,7 +499,7 @@ namespace Baobab {
                 return show_treeview_popover (treeview_popover_menu,
                                               allocation.width / 2,
                                               allocation.height / 2);
-            });
+            });*/
 
             treeview.row_activated.connect ((wrapper_path, column) => {
                 var path = convert_path_to_child_path (wrapper_path);
@@ -558,28 +565,21 @@ namespace Baobab {
         }
 
         void set_busy (bool busy) {
-            Gdk.Cursor? cursor = null;
-
             if (busy) {
-                cursor = busy_cursor;
-                disable_drop ();
+                this.cursor = busy_cursor;
+                // disable_drop ();
                 chart_stack_switcher.sensitive = false;
                 spinner_stack.visible_child = spinner;
                 spinner.start ();
                 pathbar.sensitive = false;
             } else {
-                enable_drop ();
+                // enable_drop ();
                 spinner.stop ();
                 spinner_stack.visible_child = chart_stack;
                 chart_stack_switcher.sensitive = true;
                 pathbar.sensitive = true;
             }
 
-            var window = get_window ();
-            if (window != null) {
-                window.cursor = cursor;
-            }
-
             foreach (ActionState action_state in actions_while_scanning) {
                 var action = lookup_action (action_state.name) as SimpleAction;
                 action.set_enabled (busy == action_state.enable);
@@ -593,17 +593,17 @@ namespace Baobab {
 
             set_busy (busy);
 
-            header_bar.custom_title = null;
+            header_bar.title_widget = null;
             if (child == home_page) {
                 var action = lookup_action ("reload") as SimpleAction;
                 action.set_enabled (false);
-                header_bar.title = _("Devices & Locations");
+                this.title = _("Devices & Locations");
             } else {
                 var action = lookup_action ("reload") as SimpleAction;
                 action.set_enabled (true);
-                header_bar.title = active_location.name;
+                this.title = active_location.name;
                 if (child == result_page) {
-                    header_bar.custom_title = pathbar;
+                    header_bar.title_widget = pathbar;
                 }
             }
 


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