[geary] Don't focus on the detach button on click



commit 28eb21373665bc58bf621aeb5d82cdff02fbad37
Author: Robert Schroll <rschroll gmail com>
Date:   Fri May 16 15:13:46 2014 -0700

    Don't focus on the detach button on click
    
    This way, we can maintain the selection when detaching the composer.

 src/client/composer/composer-embed.vala |   11 +++++++++--
 ui/composer.glade                       |    1 +
 2 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/src/client/composer/composer-embed.vala b/src/client/composer/composer-embed.vala
index 41ff73b..7b1ec02 100644
--- a/src/client/composer/composer-embed.vala
+++ b/src/client/composer/composer-embed.vala
@@ -63,10 +63,17 @@ public class ComposerEmbed : Gtk.Bin, ComposerContainer {
             on_focus_out();
         composer.editor.focus_in_event.disconnect(on_focus_in);
         composer.editor.focus_out_event.disconnect(on_focus_out);
+        Gtk.Widget focus = top_window.get_focus();
         
         remove(composer);
-        new ComposerWindow(composer);
-        composer.set_focus();
+        ComposerWindow window = new ComposerWindow(composer);
+        if (focus != null) {
+            ComposerWindow focus_win = focus.get_toplevel() as ComposerWindow;
+            if (focus_win != null && focus_win == window)
+                focus.grab_focus();
+        } else {
+            composer.set_focus();
+        }
         close();
     }
     
diff --git a/ui/composer.glade b/ui/composer.glade
index ab9a94b..1f4e4fe 100644
--- a/ui/composer.glade
+++ b/ui/composer.glade
@@ -629,6 +629,7 @@
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
+                <property name="focus_on_click">False</property>
               </object>
               <packing>
                 <property name="expand">False</property>


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