[geary/wip/trash-714212] Fix wrong looking only-trash state, icon spacing
- From: Charles Lindsay <clindsay src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/wip/trash-714212] Fix wrong looking only-trash state, icon spacing
- Date: Fri, 20 Dec 2013 02:36:00 +0000 (UTC)
commit 63ebf123a0674b942519a47a72a0cbc8f577301c
Author: Charles Lindsay <chaz yorba org>
Date: Thu Dec 19 16:47:43 2013 -0800
Fix wrong looking only-trash state, icon spacing
src/client/components/main-toolbar.vala | 26 ++++++++++++++++++--------
src/client/components/main-window.vala | 4 +++-
src/client/components/pill-toolbar.vala | 2 +-
3 files changed, 22 insertions(+), 10 deletions(-)
---
diff --git a/src/client/components/main-toolbar.vala b/src/client/components/main-toolbar.vala
index aef1474..53ec620 100644
--- a/src/client/components/main-toolbar.vala
+++ b/src/client/components/main-toolbar.vala
@@ -15,7 +15,7 @@ public class MainToolbar : PillToolbar {
public string search_text { get { return search_entry.text; } }
private Gtk.Button archive_button;
- private Gtk.Button trash_button;
+ private Gtk.Button trash_buttons[2];
private Gtk.ToolItem search_container = new Gtk.ToolItem();
private Gtk.Entry search_entry = new Gtk.Entry();
private Geary.ProgressMonitor? search_upgrade_progress_monitor = null;
@@ -63,10 +63,17 @@ public class MainToolbar : PillToolbar {
insert.add(create_menu_button("folder-symbolic", move_folder_menu,
GearyController.ACTION_MOVE_MENU));
add(create_pill_buttons(insert));
+ // The toolbar looks bad when you hide one of a pair of pill buttons.
+ // Unfortunately, this means we have to have one pair for archive/trash
+ // and one single button for just trash, for when the archive button is
+ // hidden.
insert.clear();
insert.add(archive_button = create_toolbar_button(null, GearyController.ACTION_ARCHIVE_MESSAGE,
true));
- insert.add(trash_button = create_toolbar_button(null, GearyController.ACTION_TRASH_MESSAGE, true));
+ insert.add(trash_buttons[0] = create_toolbar_button(null, GearyController.ACTION_TRASH_MESSAGE,
true));
add(create_pill_buttons(insert));
+ insert.clear();
+ insert.add(trash_buttons[1] = create_toolbar_button(null, GearyController.ACTION_TRASH_MESSAGE,
true));
+ add(create_pill_buttons(insert, false));
// Spacer.
add(create_spacer());
@@ -108,18 +115,21 @@ public class MainToolbar : PillToolbar {
}
public void show_archive_button(bool show) {
- if (show)
+ if (show) {
archive_button.show();
- else
+ trash_buttons[0].show();
+ trash_buttons[1].hide();
+ } else {
archive_button.hide();
+ trash_buttons[0].hide();
+ trash_buttons[1].show();
+ }
}
public void replace_trash_with_delete(bool replace) {
string action_name = (replace ? GearyController.ACTION_DELETE_MESSAGE :
GearyController.ACTION_TRASH_MESSAGE);
- Gtk.Action action = GearyApplication.instance.get_action(action_name);
- trash_button.related_action = action;
- trash_button.tooltip_text = action.tooltip;
- trash_button.image = new Gtk.Image.from_icon_name(action.icon_name, Gtk.IconSize.MENU);
+ foreach (Gtk.Button b in trash_buttons)
+ setup_button(b, null, action_name, true);
}
public void set_search_text(string text) {
diff --git a/src/client/components/main-window.vala b/src/client/components/main-window.vala
index 3880c22..e400e1d 100644
--- a/src/client/components/main-window.vala
+++ b/src/client/components/main-window.vala
@@ -66,12 +66,14 @@ public class MainWindow : Gtk.ApplicationWindow {
}
public override void show_all() {
- set_default_size(GearyApplication.instance.config.window_width,
+ set_default_size(GearyApplication.instance.config.window_width,
GearyApplication.instance.config.window_height);
if (GearyApplication.instance.config.window_maximize)
maximize();
base.show_all();
+
+ main_toolbar.show_archive_button(true);
}
private bool on_delete_event() {
diff --git a/src/client/components/pill-toolbar.vala b/src/client/components/pill-toolbar.vala
index 4d5ec66..6cb41b0 100644
--- a/src/client/components/pill-toolbar.vala
+++ b/src/client/components/pill-toolbar.vala
@@ -14,7 +14,7 @@ public class PillToolbar : Gtk.Toolbar {
action_group = toolbar_action_group;
}
- private void setup_button(Gtk.Button b, string? icon_name, string action_name,
+ protected void setup_button(Gtk.Button b, string? icon_name, string action_name,
bool show_label = false) {
b.related_action = action_group.get_action(action_name);
b.tooltip_text = b.related_action.tooltip;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]