[geary] Update Archive/Trash/Delete/Empty buttons on toolbar: Bug #742686
- From: Jim Nelson <jnelson src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary] Update Archive/Trash/Delete/Empty buttons on toolbar: Bug #742686
- Date: Tue, 13 Jan 2015 22:44:24 +0000 (UTC)
commit 09a15914dad487041bdcf1de9aa570d8287913ea
Author: Jim Nelson <jim yorba org>
Date: Tue Jan 13 14:42:34 2015 -0800
Update Archive/Trash/Delete/Empty buttons on toolbar: Bug #742686
With the Empty button now attached to Archive/Trash/Delete, it's now
less lopsided for only Archive to have a label. This removes the
label from Trash/Delete (which also makes it more innocuous when the
user presses Shift a lot, i.e. while editing in the inline composer),
which in turns simplifies building the main toolbar.
src/client/application/geary-controller.vala | 10 ++----
src/client/components/main-toolbar.vala | 42 +++++--------------------
src/client/components/main-window.vala | 3 --
3 files changed, 13 insertions(+), 42 deletions(-)
---
diff --git a/src/client/application/geary-controller.vala b/src/client/application/geary-controller.vala
index 52bb68f..998fc72 100644
--- a/src/client/application/geary-controller.vala
+++ b/src/client/application/geary-controller.vala
@@ -56,13 +56,11 @@ public class GearyController : Geary.BaseObject {
public const int MIN_CONVERSATION_COUNT = 50;
- private const string DELETE_MESSAGE_LABEL = _("_Delete");
private const string DELETE_MESSAGE_TOOLTIP_SINGLE = _("Delete conversation (Shift+Delete)");
private const string DELETE_MESSAGE_TOOLTIP_MULTIPLE = _("Delete conversations (Shift+Delete)");
private const string DELETE_MESSAGE_ICON_NAME = "edit-delete-symbolic";
// This refers to the action ("move email to the trash"), not the Trash folder itself
- private const string TRASH_MESSAGE_LABEL = _("_Trash");
private const string TRASH_MESSAGE_TOOLTIP_SINGLE = _("Move conversation to trash (Delete, Backspace)");
private const string TRASH_MESSAGE_TOOLTIP_MULTIPLE = _("Move conversations to trash (Delete,
Backspace)");
private const string TRASH_MESSAGE_ICON_NAME = "user-trash-symbolic";
@@ -381,13 +379,13 @@ public class GearyController : Geary.BaseObject {
// although this action changes according to the account's capabilities, set to Delete
// until they're known so the "translatable" string doesn't first appear
Gtk.ActionEntry trash_message = { ACTION_TRASH_MESSAGE, TRASH_MESSAGE_ICON_NAME,
- TRASH_MESSAGE_LABEL, "Delete", null, on_trash_message };
+ null, "Delete", null, on_trash_message };
trash_message.tooltip = TRASH_MESSAGE_TOOLTIP_SINGLE;
entries += trash_message;
add_accelerator("BackSpace", ACTION_TRASH_MESSAGE);
Gtk.ActionEntry delete_message = { ACTION_DELETE_MESSAGE, DELETE_MESSAGE_ICON_NAME,
- DELETE_MESSAGE_LABEL, "<Shift>Delete", null, on_delete_message };
+ null, "<Shift>Delete", null, on_delete_message };
delete_message.tooltip = DELETE_MESSAGE_TOOLTIP_SINGLE;
entries += delete_message;
add_accelerator("<Shift>BackSpace", ACTION_DELETE_MESSAGE);
@@ -1208,7 +1206,7 @@ public class GearyController : Geary.BaseObject {
// by other utility methods
private void update_ui() {
update_tooltips();
- main_window.main_toolbar.update_trash_buttons(
+ main_window.main_toolbar.update_trash_archive_buttons(
current_folder_supports_trash() || !(current_folder is Geary.FolderSupport.Remove),
current_account.can_support_archive);
}
@@ -1624,7 +1622,7 @@ public class GearyController : Geary.BaseObject {
private void on_shift_key(bool pressed) {
if (main_window != null && main_window.main_toolbar != null
&& current_account != null && current_folder != null) {
- main_window.main_toolbar.update_trash_buttons(
+ main_window.main_toolbar.update_trash_archive_buttons(
(!pressed && current_folder_supports_trash()) || !(current_folder is
Geary.FolderSupport.Remove),
current_account.can_support_archive);
}
diff --git a/src/client/components/main-toolbar.vala b/src/client/components/main-toolbar.vala
index 9dbf2d5..6b787e8 100644
--- a/src/client/components/main-toolbar.vala
+++ b/src/client/components/main-toolbar.vala
@@ -16,8 +16,7 @@ public class MainToolbar : PillHeaderbar {
public bool search_entry_has_focus { get { return search_entry.has_focus; } }
private Gtk.Button archive_button;
- private Gtk.Button trash_buttons[2];
- private Gtk.MenuButton empty_buttons[2];
+ private Gtk.Button trash_delete_button;
private Gtk.SearchEntry search_entry = new Gtk.SearchEntry();
private Geary.ProgressMonitor? search_upgrade_progress_monitor = null;
private MonitoredProgressBar search_upgrade_progress_bar = new MonitoredProgressBar();
@@ -67,19 +66,11 @@ public class MainToolbar : PillHeaderbar {
Gtk.Menu empty_menu = (Gtk.Menu)
GearyApplication.instance.ui_manager.get_widget("/ui/ToolbarEmptyMenu");
empty_menu.foreach(GtkUtil.show_menuitem_accel_labels);
- // 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_buttons[0] = create_toolbar_button(null, GearyController.ACTION_TRASH_MESSAGE,
true));
- insert.add(empty_buttons[0] = create_menu_button(null, empty_menu,
GearyController.ACTION_EMPTY_MENU));
- Gtk.Box trash_archive_empty = create_pill_buttons(insert);
- insert.clear();
- insert.add(trash_buttons[1] = create_toolbar_button(null, GearyController.ACTION_TRASH_MESSAGE,
true));
- insert.add(empty_buttons[1] = create_menu_button(null, empty_menu,
GearyController.ACTION_EMPTY_MENU));
- Gtk.Box trash_empty = create_pill_buttons(insert, false);
+ insert.add(trash_delete_button = create_toolbar_button(null, GearyController.ACTION_TRASH_MESSAGE,
false));
+ insert.add(create_menu_button(null, empty_menu, GearyController.ACTION_EMPTY_MENU));
+ Gtk.Box archive_trash_delete_empty = create_pill_buttons(insert);
// Search bar.
search_entry.width_chars = 28;
@@ -96,8 +87,7 @@ public class MainToolbar : PillHeaderbar {
// pack_end() ordering is reversed in GtkHeaderBar in 3.12 and above
#if !GTK_3_12
- add_end(trash_archive_empty);
- add_end(trash_empty);
+ add_end(archive_trash_delete_empty);
add_end(search_upgrade_progress_bar);
add_end(search_entry);
#endif
@@ -113,33 +103,19 @@ public class MainToolbar : PillHeaderbar {
#if GTK_3_12
add_end(search_entry);
add_end(search_upgrade_progress_bar);
- add_end(trash_empty);
- add_end(trash_archive_empty);
+ add_end(archive_trash_delete_empty);
#endif
set_search_placeholder_text(DEFAULT_SEARCH_TEXT);
}
- private void show_archive_button(bool show) {
- if (show) {
- archive_button.show();
- trash_buttons[0].visible = empty_buttons[0].visible = true;
- trash_buttons[1].visible = empty_buttons[1].visible = false;
- } else {
- archive_button.hide();
- trash_buttons[0].visible = empty_buttons[0].visible = false;
- trash_buttons[1].visible = empty_buttons[1].visible = true;
- }
- }
-
/// Updates the trash button as trash or delete, and shows or hides the archive button.
- public void update_trash_buttons(bool trash, bool archive) {
+ public void update_trash_archive_buttons(bool trash, bool archive) {
string action_name = (trash ? GearyController.ACTION_TRASH_MESSAGE
: GearyController.ACTION_DELETE_MESSAGE);
- foreach (Gtk.Button b in trash_buttons)
- setup_button(b, null, action_name, true);
+ setup_button(trash_delete_button, null, action_name, false);
- show_archive_button(archive);
+ archive_button.visible = archive;
}
public void set_search_text(string text) {
diff --git a/src/client/components/main-window.vala b/src/client/components/main-window.vala
index ee80bc8..51d1c22 100644
--- a/src/client/components/main-window.vala
+++ b/src/client/components/main-window.vala
@@ -94,9 +94,6 @@ public class MainWindow : Gtk.ApplicationWindow {
maximize();
base.show_all();
-
- // Some buttons need to be hidden, so we have to do this after we show everything.
- main_toolbar.update_trash_buttons(true, true);
}
private bool on_delete_event() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]