[geary] Ensure the headerbar is visible for all detached composers
- From: Robert Schroll <rschroll src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary] Ensure the headerbar is visible for all detached composers
- Date: Thu, 12 Mar 2015 01:42:25 +0000 (UTC)
commit 221c196db8a8373d5079a42f0e5fbbb41ad9e42c
Author: Robert Schroll <rschroll gmail com>
Date: Wed Mar 11 21:36:25 2015 -0400
Ensure the headerbar is visible for all detached composers
It used to be that all embeded composers had the headerbar inside
themselves, so the ComposerWindow only had to remove it if necessary.
But the new new-composer state doesn't have this, so we have to be
sure. To assist in this, the ComposerWidget now has embed_header() and
free_header() methods.
https://bugzilla.gnome.org/show_bug.cgi?id=746061
src/client/composer/composer-box.vala | 2 +-
src/client/composer/composer-widget.vala | 15 +++++++++++++--
src/client/composer/composer-window.vala | 4 ++--
3 files changed, 16 insertions(+), 5 deletions(-)
---
diff --git a/src/client/composer/composer-box.vala b/src/client/composer/composer-box.vala
index d523ec6..b72a476 100644
--- a/src/client/composer/composer-box.vala
+++ b/src/client/composer/composer-box.vala
@@ -31,7 +31,7 @@ public class ComposerBox : Gtk.Frame, ComposerContainer {
title_binding = composer.bind_property("window-title", composer.header, "title",
BindingFlags.SYNC_CREATE);
- composer.header.parent.remove(composer.header);
+ composer.free_header();
GearyApplication.instance.controller.main_window.main_toolbar.set_conversation_header(
composer.header);
get_style_context().add_class("full-pane");
diff --git a/src/client/composer/composer-widget.vala b/src/client/composer/composer-widget.vala
index 98616a1..03d7870 100644
--- a/src/client/composer/composer-widget.vala
+++ b/src/client/composer/composer-widget.vala
@@ -369,8 +369,7 @@ public class ComposerWidget : Gtk.EventBox {
compose_as_html = GearyApplication.instance.config.compose_as_html;
header = new ComposerHeaderbar(actions);
- Gtk.Alignment header_area = (Gtk.Alignment) builder.get_object("header_area");
- header_area.add(header);
+ embed_header();
bind_property("state", header, "state", BindingFlags.SYNC_CREATE | BindingFlags.BIDIRECTIONAL);
// Listen to account signals to update from menu.
@@ -1163,6 +1162,18 @@ public class ComposerWidget : Gtk.EventBox {
state = ComposerWidget.ComposerState.PANED;
}
+ public void embed_header() {
+ if (header.parent == null) {
+ Gtk.Alignment header_area = (Gtk.Alignment) builder.get_object("header_area");
+ header_area.add(header);
+ }
+ }
+
+ public void free_header() {
+ if (header.parent != null)
+ header.parent.remove(header);
+ }
+
// compares all keys to all tokens according to user-supplied comparison function
// Returns true if found
private bool search_tokens(string[] keys, string[] tokens, CompareStringFunc cmp_func,
diff --git a/src/client/composer/composer-window.vala b/src/client/composer/composer-window.vala
index ea5048b..42ef70e 100644
--- a/src/client/composer/composer-window.vala
+++ b/src/client/composer/composer-window.vala
@@ -16,12 +16,12 @@ public class ComposerWindow : Gtk.Window, ComposerContainer {
if (!GearyApplication.instance.is_running_unity) {
composer.header.show_close_button = true;
- if (composer.header.parent != null)
- composer.header.parent.remove(composer.header);
+ composer.free_header();
set_titlebar(composer.header);
composer.bind_property("window-title", composer.header, "title",
BindingFlags.SYNC_CREATE);
} else {
+ composer.embed_header();
composer.bind_property("window-title", this, "title", BindingFlags.SYNC_CREATE);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]