[geary/wip/743960-split-header-3: 2/9] Use composer headerbar for main window when composing new messages



commit 78205520118c0f6f722262eb901541a352688933
Author: Robert Schroll <rschroll gmail com>
Date:   Wed Feb 11 01:47:42 2015 -0500

    Use composer headerbar for main window when composing new messages

 src/client/components/main-toolbar.vala  |   14 ++++++++++++++
 src/client/components/main-window.vala   |    9 ++++++---
 src/client/composer/composer-box.vala    |    9 +++++++++
 src/client/composer/composer-window.vala |    3 ++-
 4 files changed, 31 insertions(+), 4 deletions(-)
---
diff --git a/src/client/components/main-toolbar.vala b/src/client/components/main-toolbar.vala
index 1e49c40..79c5563 100644
--- a/src/client/components/main-toolbar.vala
+++ b/src/client/components/main-toolbar.vala
@@ -170,6 +170,20 @@ public class MainToolbar : Gtk.Box {
         search_entry.placeholder_text = placeholder;
     }
     
+    public void set_conversation_header(Gtk.Widget header) {
+        conversation_header.hide();
+        header.get_style_context().add_class("titlebar");
+        header.get_style_context().add_class("geary-titlebar-right");
+        pack_start(header, true, true);
+    }
+    
+    public void remove_conversation_header(Gtk.Widget header) {
+        remove(header);
+        header.get_style_context().remove_class("titlebar");
+        header.get_style_context().remove_class("geary-titlebar-right");
+        conversation_header.show();
+    }
+    
     private void on_search_entry_changed() {
         search_text_changed(search_entry.text);
         // Enable/disable clear button.
diff --git a/src/client/components/main-window.vala b/src/client/components/main-window.vala
index 021ae5a..a4035c6 100644
--- a/src/client/components/main-window.vala
+++ b/src/client/components/main-window.vala
@@ -159,9 +159,12 @@ public class MainWindow : Gtk.ApplicationWindow {
                 border-left-width: 0px;
             }
             ComposerBox {
-                border: 16px solid #ccc;
-                box-shadow: 0 0 0 1px rgba(0,0,0,0.4) inset;
-                padding: 1px;
+                border-left-width: 0px;
+                border-right-width: 0px;
+                border-bottom-width: 0px;
+            }
+            ComposerBox.full-pane {
+                border-top-width: 0px;
             }
             ComposerEmbed GtkHeaderBar,
             ComposerBox GtkHeaderBar {
diff --git a/src/client/composer/composer-box.vala b/src/client/composer/composer-box.vala
index a5dfc38..3fc423c 100644
--- a/src/client/composer/composer-box.vala
+++ b/src/client/composer/composer-box.vala
@@ -27,6 +27,11 @@ public class ComposerBox : Gtk.Frame, ComposerContainer {
                 instance.controller.main_window).conversation_list_view;
             prev_selection = conversation_list_view.get_selected_conversations();
             conversation_list_view.get_selection().unselect_all();
+            
+            composer.header.parent.remove(composer.header);
+            GearyApplication.instance.controller.main_window.main_toolbar.set_conversation_header(
+                composer.header);
+            get_style_context().add_class("full-pane");
         }
     }
     
@@ -66,6 +71,10 @@ public class ComposerBox : Gtk.Frame, ComposerContainer {
     public void vanish() {
         hide();
         parent.hide();
+        if (get_style_context().has_class("full-pane"))
+            GearyApplication.instance.controller.main_window.main_toolbar.remove_conversation_header(
+                composer.header);
+        
         composer.state = ComposerWidget.ComposerState.DETACHED;
         composer.editor.focus_in_event.disconnect(on_focus_in);
         composer.editor.focus_out_event.disconnect(on_focus_out);
diff --git a/src/client/composer/composer-window.vala b/src/client/composer/composer-window.vala
index 4c06cef..1f80853 100644
--- a/src/client/composer/composer-window.vala
+++ b/src/client/composer/composer-window.vala
@@ -27,7 +27,8 @@ public class ComposerWindow : Gtk.Window, ComposerContainer {
         
         if (!GearyApplication.instance.is_running_unity) {
             composer.header.show_close_button = true;
-            composer.header.parent.remove(composer.header);
+            if (composer.header.parent != null)
+                composer.header.parent.remove(composer.header);
             set_titlebar(composer.header);
         }
         


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