[shotwell/wip/gtk4] Fix slideshow settings dialog



commit 7ecf2f8723abae555229cd9f52265a5d32e66023
Author: Jens Georg <mail jensge org>
Date:   Sat Apr 16 01:08:01 2022 +0200

    Fix slideshow settings dialog

 data/ui/slideshow_settings.ui | 235 ++++++++++++++----------------------------
 src/FullscreenWindow.vala     |  61 +++++------
 src/Page.vala                 |   2 +-
 src/PageWindow.vala           |  71 +++++++------
 src/SinglePhotoPage.vala      |  21 ++--
 src/SlideshowPage.vala        |  44 ++++----
 6 files changed, 182 insertions(+), 252 deletions(-)
---
diff --git a/data/ui/slideshow_settings.ui b/data/ui/slideshow_settings.ui
index 8bddfa85..6b3ef392 100644
--- a/data/ui/slideshow_settings.ui
+++ b/data/ui/slideshow_settings.ui
@@ -1,7 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.22.1 -->
 <interface>
-  <requires lib="gtk+" version="3.20"/>
+  <requires lib="gtk" version="4.0"/>
   <object class="GtkAdjustment" id="delay_adjustment">
     <property name="lower">1</property>
     <property name="upper">30</property>
@@ -17,222 +16,146 @@
     <property name="page_increment">1</property>
   </object>
   <template class="SlideshowPageSettingsDialog" parent="GtkDialog">
-    <property name="can_focus">False</property>
     <property name="title" translatable="yes">Settings</property>
-    <property name="modal">True</property>
-    <property name="type_hint">dialog</property>
+    <property name="modal">1</property>
     <child>
       <placeholder/>
     </child>
-    <child internal-child="vbox">
+    <child internal-child="content_area">
       <object class="GtkBox">
-        <property name="can_focus">False</property>
         <property name="orientation">vertical</property>
         <property name="spacing">2</property>
-        <child internal-child="action_area">
-          <object class="GtkButtonBox">
-            <property name="can_focus">False</property>
-            <property name="layout_style">end</property>
-            <child>
-              <object class="GtkButton" id="button1">
-                <property name="label" translatable="yes">_Cancel</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">True</property>
-                <property name="use_underline">True</property>
-              </object>
-              <packing>
-                <property name="expand">True</property>
-                <property name="fill">True</property>
-                <property name="position">0</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkButton" id="button2">
-                <property name="label" translatable="yes">_OK</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="can_default">True</property>
-                <property name="has_default">True</property>
-                <property name="receives_default">True</property>
-                <property name="use_underline">True</property>
-                <style>
-                  <class name="default-action"/>
-                </style>
-              </object>
-              <packing>
-                <property name="expand">True</property>
-                <property name="fill">True</property>
-                <property name="position">1</property>
-              </packing>
-            </child>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">False</property>
-            <property name="position">0</property>
-          </packing>
-        </child>
         <child>
           <object class="GtkBox" id="slideshow_settings_pane">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
             <property name="orientation">vertical</property>
             <child>
               <object class="GtkBox" id="dialog-vbox7">
-                <property name="can_focus">False</property>
-                <property name="margin_left">8</property>
-                <property name="margin_right">8</property>
+                <property name="margin-start">8</property>
+                <property name="margin-end">8</property>
                 <property name="spacing">2</property>
                 <child>
                   <object class="GtkGrid" id="grid3">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
                     <property name="row_spacing">4</property>
                     <property name="column_spacing">4</property>
                     <child>
                       <object class="GtkLabel" id="delay_label">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
                         <property name="halign">end</property>
                         <property name="label" translatable="yes">_Delay:</property>
-                        <property name="use_underline">True</property>
+                        <property name="use_underline">1</property>
                         <property name="mnemonic_widget">delay_hscale</property>
+                        <layout>
+                          <property name="column">0</property>
+                          <property name="row">0</property>
+                        </layout>
                       </object>
-                      <packing>
-                        <property name="left_attach">0</property>
-                        <property name="top_attach">0</property>
-                      </packing>
                     </child>
                     <child>
                       <object class="GtkLabel" id="transition_effect_label">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
                         <property name="halign">end</property>
                         <property name="label" translatable="yes">_Transition effect:</property>
-                        <property name="use_underline">True</property>
+                        <property name="use_underline">1</property>
                         <property name="mnemonic_widget">transition_effect_selector</property>
+                        <layout>
+                          <property name="column">0</property>
+                          <property name="row">1</property>
+                        </layout>
                       </object>
-                      <packing>
-                        <property name="left_attach">0</property>
-                        <property name="top_attach">1</property>
-                      </packing>
                     </child>
                     <child>
                       <object class="GtkLabel" id="transition_delay_label">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
                         <property name="halign">end</property>
                         <property name="label" translatable="yes">Transition d_elay:</property>
-                        <property name="use_underline">True</property>
+                        <property name="use_underline">1</property>
+                        <layout>
+                          <property name="column">0</property>
+                          <property name="row">2</property>
+                        </layout>
                       </object>
-                      <packing>
-                        <property name="left_attach">0</property>
-                        <property name="top_attach">2</property>
-                      </packing>
                     </child>
                     <child>
                       <object class="GtkCheckButton" id="show_title_button">
                         <property name="label" translatable="yes">Show t_itle</property>
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="receives_default">False</property>
+                        <property name="focusable">1</property>
                         <property name="halign">start</property>
-                        <property name="use_underline">True</property>
-                        <property name="draw_indicator">True</property>
+                        <property name="use_underline">1</property>
+                        <layout>
+                          <property name="column">0</property>
+                          <property name="row">3</property>
+                          <property name="column-span">4</property>
+                        </layout>
                       </object>
-                      <packing>
-                        <property name="left_attach">0</property>
-                        <property name="top_attach">3</property>
-                        <property name="width">4</property>
-                      </packing>
                     </child>
                     <child>
                       <object class="GtkComboBoxText" id="transition_effect_selector">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
+                        <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="GtkScale" id="delay_hscale">
                         <property name="width_request">150</property>
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
+                        <property name="focusable">1</property>
                         <property name="adjustment">delay_adjustment</property>
                         <property name="fill_level">300</property>
-                        <property name="draw_value">False</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="GtkScale" id="transition_effect_hscale">
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
+                        <property name="focusable">1</property>
                         <property name="adjustment">transition_effect_adjustment</property>
                         <property name="fill_level">3</property>
-                        <property name="draw_value">False</property>
+                        <layout>
+                          <property name="column">1</property>
+                          <property name="row">2</property>
+                        </layout>
                       </object>
-                      <packing>
-                        <property name="left_attach">1</property>
-                        <property name="top_attach">2</property>
-                      </packing>
                     </child>
                     <child>
                       <object class="GtkSpinButton" id="delay_entry">
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="invisible_char">●</property>
+                        <property name="focusable">1</property>
                         <property name="adjustment">delay_adjustment</property>
-                        <property name="numeric">True</property>
+                        <property name="numeric">1</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="GtkSpinButton" id="transition_effect_entry">
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="invisible_char">●</property>
-                        <property name="activates_default">True</property>
+                        <property name="focusable">1</property>
                         <property name="adjustment">transition_effect_adjustment</property>
                         <property name="digits">1</property>
-                        <property name="numeric">True</property>
+                        <property name="numeric">1</property>
+                        <layout>
+                          <property name="column">2</property>
+                          <property name="row">2</property>
+                        </layout>
                       </object>
-                      <packing>
-                        <property name="left_attach">2</property>
-                        <property name="top_attach">2</property>
-                      </packing>
                     </child>
                     <child>
                       <object class="GtkLabel" id="seconds_label_3">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
                         <property name="label" translatable="yes">seconds</property>
+                        <layout>
+                          <property name="column">3</property>
+                          <property name="row">0</property>
+                        </layout>
                       </object>
-                      <packing>
-                        <property name="left_attach">3</property>
-                        <property name="top_attach">0</property>
-                      </packing>
                     </child>
                     <child>
                       <object class="GtkLabel" id="seconds_label_4">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
                         <property name="label" translatable="yes">seconds</property>
+                        <layout>
+                          <property name="column">3</property>
+                          <property name="row">2</property>
+                        </layout>
                       </object>
-                      <packing>
-                        <property name="left_attach">3</property>
-                        <property name="top_attach">2</property>
-                      </packing>
                     </child>
                     <child>
                       <placeholder/>
@@ -241,32 +164,34 @@
                       <placeholder/>
                     </child>
                   </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="position">0</property>
-                  </packing>
                 </child>
               </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="padding">4</property>
-                <property name="position">0</property>
-              </packing>
             </child>
           </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">1</property>
-          </packing>
         </child>
       </object>
     </child>
     <action-widgets>
       <action-widget response="-6">button1</action-widget>
-      <action-widget response="-5">button2</action-widget>
+      <action-widget response="-5" default="true">button2</action-widget>
     </action-widgets>
+    <child type="action">
+      <object class="GtkButton" id="button1">
+        <property name="label" translatable="yes">_Cancel</property>
+        <property name="focusable">1</property>
+        <property name="receives_default">1</property>
+        <property name="use_underline">1</property>
+      </object>
+    </child>
+    <child type="action">
+      <object class="GtkButton" id="button2">
+        <property name="label" translatable="yes">_OK</property>
+        <property name="focusable">1</property>
+        <property name="use_underline">1</property>
+        <style>
+          <class name="default-action"/>
+        </style>
+      </object>
+    </child>
   </template>
 </interface>
diff --git a/src/FullscreenWindow.vala b/src/FullscreenWindow.vala
index 31870113..4adf5e02 100644
--- a/src/FullscreenWindow.vala
+++ b/src/FullscreenWindow.vala
@@ -12,6 +12,8 @@ public class FullscreenWindow : PageWindow {
     private time_t left_toolbar_time = 0;
     private bool switched_to = false;
     private bool is_toolbar_dismissal_enabled;
+    private bool pointer_in_toolbar = false;
+    Gtk.Allocation toolbar_alloc;
 
     private const GLib.ActionEntry[] entries = {
         { "LeaveFullscreen", on_close }
@@ -26,14 +28,6 @@ public class FullscreenWindow : PageWindow {
         const string[] accels = { "F11", null };
         Application.set_accels_for_action ("win.LeaveFullscreen", accels);
 
-        //set_screen(AppWindow.get_instance().get_screen());
-        
-        // Needed so fullscreen will occur on correct monitor in multi-monitor setups
-        Gdk.Rectangle monitor = get_monitor_geometry();
-        //move(monitor.x, monitor.y);
-        
-        //set_border_width(0);
-
         // restore pin state
         is_toolbar_dismissal_enabled = Config.Facade.get_instance().get_pin_toolbar_state();
         
@@ -48,10 +42,8 @@ public class FullscreenWindow : PageWindow {
         close_button.set_action_name ("win.LeaveFullscreen");
         
         toolbar = page.get_toolbar();
-        //toolbar.set_show_arrow(false);
         toolbar.valign = Gtk.Align.END;
         toolbar.halign = Gtk.Align.CENTER;
-        //toolbar.expand = false;
         toolbar.opacity = Resources.TRANSIENT_WINDOW_OPACITY;
 
         if (page is SlideshowPage) {
@@ -74,7 +66,7 @@ public class FullscreenWindow : PageWindow {
         // call to set_default_size() saves one repaint caused by changing
         // size from default to full screen. In slideshow mode, this change
         // also causes pixbuf cache updates, so it really saves some work.
-        set_default_size(monitor.width, monitor.height);
+        //set_default_size(monitor.width, monitor.height);
         
         // need to create a Gdk.Window to set masks
         fullscreen();
@@ -82,6 +74,20 @@ public class FullscreenWindow : PageWindow {
 
         // capture motion events to show the toolbar
         //add_events(Gdk.EventMask.POINTER_MOTION_MASK);
+
+        var motion = new Gtk.EventControllerMotion();
+        motion.enter.connect(() => {
+            pointer_in_toolbar = true;
+        });
+        motion.leave.connect(() => {
+            pointer_in_toolbar = false;
+        });
+        toolbar.add_controller(motion);
+
+        motion = new Gtk.EventControllerMotion();
+        motion.motion.connect(motion_notify_event);
+        page.add_controller(motion);
+
         
         // If toolbar is enabled in "normal" ui OR was pinned in
         // fullscreen, start off with toolbar invoked, as a clue for the
@@ -108,15 +114,6 @@ public class FullscreenWindow : PageWindow {
         is_toolbar_dismissal_enabled = !pin_button.get_active();
     }
 
-    private Gdk.Rectangle get_monitor_geometry() {
-        #if 0
-        var monitor = get_display().get_monitor_at_window(AppWindow.get_instance().get_window());
-        return monitor.get_geometry();
-        #endif
-
-        return Gdk.Rectangle();
-    }
-    
     public override bool configure_event(int width, int height) {
         bool result = base.configure_event(width, height);
         
@@ -176,8 +173,7 @@ public class FullscreenWindow : PageWindow {
         return true;
     }
     
-    #if 0
-    public override bool motion_notify_event(Gdk.EventMotion event) {
+    public void motion_notify_event(double x, double y) {
         if (!is_toolbar_shown) {
             // if pointer is in toolbar height range without the mouse down (i.e. in the middle of
             // an edit operation) and it stays there the necessary amount of time, invoke the
@@ -187,12 +183,13 @@ public class FullscreenWindow : PageWindow {
                 waiting_for_invoke = true;
             }
         }
-        
-        return (base.motion_notify_event != null) ? base.motion_notify_event(event) : false;
     }
-    #endif
     
     private bool is_pointer_in_toolbar() {
+        if (toolbar.visible) {
+            return pointer_in_toolbar;
+        }
+        
         var seat = get_display().get_default_seat();
         if (seat == null) {
             debug("No seat for display");
@@ -200,16 +197,10 @@ public class FullscreenWindow : PageWindow {
             return false;
         }
         
-        #if 0
-        int py;
-        seat.get_pointer().get_position(null, null, out py);
+        double py = 0;
+        get_surface().get_device_position(seat.get_pointer(), null, out py, null);
         
-        int wy;
-        toolbar.get_window().get_geometry(null, out wy, null, null);
-
-        return (py >= wy);
-        #endif
-        return false;
+        return py >= toolbar_alloc.y;
     }
     
     private bool on_check_toolbar_invocation() {
@@ -269,6 +260,8 @@ public class FullscreenWindow : PageWindow {
     }
     
     private void hide_toolbar() {
+        // Save location of toolbar before hiding
+        toolbar.get_allocation(out toolbar_alloc);
         toolbar.hide();
         is_toolbar_shown = false;
     }
diff --git a/src/Page.vala b/src/Page.vala
index 73184b35..ab7aacd6 100644
--- a/src/Page.vala
+++ b/src/Page.vala
@@ -1045,7 +1045,7 @@ public abstract class Page : Gtk.Box {
     }
 
     private void on_motion_internal(Gtk.EventControllerMotion controller, double x, double y) {
-        bool result = on_motion(controller, x, y, controller.get_current_event_state());
+        on_motion(controller, x, y, controller.get_current_event_state());
         // todo: stop propagation?
     }
 
diff --git a/src/PageWindow.vala b/src/PageWindow.vala
index e0fa56a1..1e69051a 100644
--- a/src/PageWindow.vala
+++ b/src/PageWindow.vala
@@ -10,19 +10,18 @@
 public abstract class PageWindow : Gtk.ApplicationWindow {
     private Page current_page = null;
     private int busy_counter = 0;
-    
-    protected virtual void switched_pages(Page? old_page, Page? new_page) {
-    }
-    
+
+    protected virtual void switched_pages(Page? old_page, Page? new_page) {}
+
     protected PageWindow() {
-        Object (application: Application.get_instance().get_system_app ());
+        Object(application: Application.get_instance().get_system_app());
 
         // the current page needs to know when modifier keys are pressed
         #if 0
         add_events(Gdk.EventMask.KEY_PRESS_MASK | Gdk.EventMask.KEY_RELEASE_MASK
             | Gdk.EventMask.STRUCTURE_MASK);
             #endif
-        set_show_menubar (true);
+        set_show_menubar(true);
 
         notify["maximized"].connect(synthesize_configure_event);
         notify["default-width"].connect(synthesize_configure_event);
@@ -31,8 +30,17 @@ public abstract class PageWindow : Gtk.ApplicationWindow {
     }
 
     private void synthesize_configure_event() {
-        int width = get_surface().get_width();
-        int height = get_surface().get_height();
+        int width = 0;
+        int height = 0;
+        if (get_surface() != null) {
+            width = get_surface().get_width();
+            height = get_surface().get_height();
+        } else {
+            Gtk.Allocation allocation;
+            get_allocation (out allocation);
+            width = allocation.width;
+            height = allocation.height;
+        }
         configure_event(width, height);
     }
 
@@ -40,79 +48,80 @@ public abstract class PageWindow : Gtk.ApplicationWindow {
         if (current_page != null) {
             if (current_page.notify_configure_event(width, height))
                 return true;
-        }      
-        
+        }
+
         return false;
     }
-    
+
     public Page? get_current_page() {
         return current_page;
     }
-    
+
     public virtual void set_current_page(Page page) {
         if (current_page != null)
             current_page.clear_container();
-        
+
         Page? old_page = current_page;
         current_page = page;
         current_page.set_container(this);
-        
+
         switched_pages(old_page, page);
     }
-    
+
     public virtual void clear_current_page() {
         if (current_page != null)
             current_page.clear_container();
-        
+
         Page? old_page = current_page;
         current_page = null;
-        
+
         switched_pages(old_page, null);
     }
-    
+
     #if 0
     public override bool key_press_event(Gdk.EventKey event) {
         if (get_focus() is Gtk.Entry && get_focus().key_press_event(event))
             return true;
-        
+
         if (current_page != null && current_page.notify_app_key_pressed(event))
             return true;
-        
+
         return (base.key_press_event != null) ? base.key_press_event(event) : false;
     }
-    
+
     public override bool key_release_event(Gdk.EventKey event) {
         if (get_focus() is Gtk.Entry && get_focus().key_release_event(event))
             return true;
-       
+
         if (current_page != null && current_page.notify_app_key_released(event))
-                return true;
-        
+            return true;
+
         return (base.key_release_event != null) ? base.key_release_event(event) : false;
     }
 
     public override bool focus_in_event(Gdk.EventFocus event) {
         if (current_page != null && current_page.notify_app_focus_in(event))
-                return true;
-        
+            return true;
+
         return (base.focus_in_event != null) ? base.focus_in_event(event) : false;
     }
 
     public override bool focus_out_event(Gdk.EventFocus event) {
         if (current_page != null && current_page.notify_app_focus_out(event))
-                return true;
-        
+            return true;
+
         return (base.focus_out_event != null) ? base.focus_out_event(event) : false;
     }
+
     #endif
 
     public void set_busy_cursor() {
         if (busy_counter++ > 0)
             return;
 
-        set_cursor (new Gdk.Cursor.from_name ("wait", null));
+        set_cursor(new Gdk.Cursor.from_name("wait", null));
     }
-    
+
     public void set_normal_cursor() {
         if (busy_counter <= 0) {
             busy_counter = 0;
@@ -121,6 +130,6 @@ public abstract class PageWindow : Gtk.ApplicationWindow {
             return;
         }
 
-        set_cursor (new Gdk.Cursor.from_name ("default", null));
+        set_cursor(new Gdk.Cursor.from_name("default", null));
     }
 }
diff --git a/src/SinglePhotoPage.vala b/src/SinglePhotoPage.vala
index dc40fe5b..d2cb072c 100644
--- a/src/SinglePhotoPage.vala
+++ b/src/SinglePhotoPage.vala
@@ -284,7 +284,7 @@ public abstract class SinglePhotoPage : Page {
     }
 
     public void invalidate_all() {
-        canvas.queue_draw ();
+        canvas.queue_draw();
     }
 
     private void on_viewport_resize() {
@@ -312,11 +312,9 @@ public abstract class SinglePhotoPage : Page {
         exposed_ctx.paint();
     }
 
-    protected virtual void new_surface(Cairo.Context ctx, Dimensions ctx_dim) {
-    }
+    protected virtual void new_surface(Cairo.Context ctx, Dimensions ctx_dim) {}
 
-    protected virtual void updated_pixbuf(Gdk.Pixbuf pixbuf, UpdateReason reason, Dimensions old_dim) {
-    }
+    protected virtual void updated_pixbuf(Gdk.Pixbuf pixbuf, UpdateReason reason, Dimensions old_dim) {}
 
     protected virtual void paint(Cairo.Context ctx, Dimensions ctx_dim) {
         if (is_zoom_supported() && (!static_zoom_state.is_default())) {
@@ -443,7 +441,7 @@ public abstract class SinglePhotoPage : Page {
 
     private void init_pixmap(int width, int height) {
         assert(unscaled != null);
-        //assert(canvas.get_window() != null);
+        // assert(canvas.get_window() != null);
 
         // Cairo backing surface (manual double-buffering)
         pixmap = new Cairo.ImageSurface(Cairo.Format.ARGB32, width, height);
@@ -466,20 +464,18 @@ public abstract class SinglePhotoPage : Page {
     }
 
     protected override bool on_context_keypress() {
-        //return popup_context_menu(get_page_context_menu());
+        // return popup_context_menu(get_page_context_menu());
         return false;
     }
 
-    protected virtual void on_previous_photo() {
-    }
+    protected virtual void on_previous_photo() {}
 
-    protected virtual void on_next_photo() {
-    }
+    protected virtual void on_next_photo() {}
 
 #if 0
     public override bool key_press_event(Gdk.EventKey event) {
         // if the user holds the arrow keys down, we will receive a steady stream of key press
-        // events for an operation that isn't designed for a rapid succession of output ... 
+        // events for an operation that isn't designed for a rapid succession of output ...
         // we staunch the supply of new photos to under a quarter second (#533)
         bool nav_ok = (event.time - last_nav_key) > KEY_REPEAT_INTERVAL_MSEC;
 
@@ -513,6 +509,7 @@ public abstract class SinglePhotoPage : Page {
 
         return (base.key_press_event != null) ? base.key_press_event(event) : true;
     }
+
     #endif
 
     private void on_colors_changed() {
diff --git a/src/SlideshowPage.vala b/src/SlideshowPage.vala
index ee1ea798..8a6d1e9d 100644
--- a/src/SlideshowPage.vala
+++ b/src/SlideshowPage.vala
@@ -365,29 +365,30 @@ class SlideshowPage : SinglePhotoPage {
     private void on_change_settings() {
         SettingsDialog settings_dialog = new SettingsDialog();
         settings_dialog.show();
+        settings_dialog.set_transient_for(get_container());
         
         bool slideshow_playing = playing;
         playing = false;
         hide_toolbar();
         suspend_cursor_hiding();
-        #if 0
-        // TODO
-        if (settings_dialog.run() == Gtk.ResponseType.OK) {
-            // sync with the config setting so it will persist
-            Config.Facade.get_instance().set_slideshow_delay(settings_dialog.get_delay());
-            
-            
Config.Facade.get_instance().set_slideshow_transition_delay(settings_dialog.get_transition_delay());
-            
Config.Facade.get_instance().set_slideshow_transition_effect_id(settings_dialog.get_transition_effect_id());
-            Config.Facade.get_instance().set_slideshow_show_title(settings_dialog.get_show_title());
-            
-            update_transition_effect();
-        }
-        #endif
-        
-        settings_dialog.destroy();
-        restore_cursor_hiding();
-        playing = slideshow_playing;
-        timer.start();
+        settings_dialog.show();
+        settings_dialog.response.connect((source, res) => {
+            if (res == Gtk.ResponseType.OK) {
+
+                // sync with the config setting so it will persist
+                Config.Facade.get_instance().set_slideshow_delay(settings_dialog.get_delay());
+                
+                
Config.Facade.get_instance().set_slideshow_transition_delay(settings_dialog.get_transition_delay());
+                
Config.Facade.get_instance().set_slideshow_transition_effect_id(settings_dialog.get_transition_effect_id());
+                Config.Facade.get_instance().set_slideshow_show_title(settings_dialog.get_show_title());
+                
+                update_transition_effect();
+                restore_cursor_hiding();
+                playing = slideshow_playing;
+                timer.start();    
+            }
+            settings_dialog.destroy();
+        });
     }
     
     private void update_transition_effect() {
@@ -412,8 +413,13 @@ class SlideshowPage : SinglePhotoPage {
         string? title = current.get_title();
         
         // If the photo doesn't have a title, don't paint anything
-        if (title == null || title == "")
+        if (title == null || title == "") {
+            title = current.get_name();
+        }
+
+        if (title == null || title == "") {
             return;
+        }
         
         Pango.Layout layout = create_pango_layout(title);
         Pango.AttrList list = new Pango.AttrList();


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