[dconf-editor] Connect to size_allocate.



commit 1f9dc109fe04c911940ce90a9b54bcfca8294039
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Thu Apr 16 18:06:13 2015 +0200

    Connect to size_allocate.

 editor/dconf-editor.vala |   19 ++++++++-----------
 1 files changed, 8 insertions(+), 11 deletions(-)
---
diff --git a/editor/dconf-editor.vala b/editor/dconf-editor.vala
index 39b724e..d2475a5 100644
--- a/editor/dconf-editor.vala
+++ b/editor/dconf-editor.vala
@@ -80,8 +80,8 @@ class ConfigurationEditor : Gtk.Application
         }
         window = (Gtk.ApplicationWindow) ui.get_object ("window");
         window.set_default_size(600, 300);
-        window.window_state_event.connect(main_window_window_state_event_cb);
-        window.configure_event.connect(main_window_configure_event_cb);
+        window.window_state_event.connect (window_state_event_cb);
+        window.size_allocate.connect (size_allocate_cb);
 
         var menu_ui = new Gtk.Builder();
         try
@@ -293,18 +293,15 @@ class ConfigurationEditor : Gtk.Application
         selected_key.set_to_default();
     }
 
-    private bool main_window_configure_event_cb (Gtk.Widget widget, Gdk.EventConfigure event)
+    private void size_allocate_cb (Gtk.Allocation allocation)
     {
-        if (!window_is_maximized && !window_is_fullscreen)
-        {
-            window_width = event.width;
-            window_height = event.height;
-        }
-
-        return false;
+        if (window_is_maximized || window_is_fullscreen)
+            return;
+        window_width = allocation.width;
+        window_height = allocation.height;
     }
 
-    private bool main_window_window_state_event_cb (Gtk.Widget widget, Gdk.EventWindowState event)
+    private bool window_state_event_cb (Gtk.Widget widget, Gdk.EventWindowState event)
     {
         if ((event.changed_mask & Gdk.WindowState.MAXIMIZED) != 0)
             window_is_maximized = (event.new_window_state & Gdk.WindowState.MAXIMIZED) != 0;


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