Fix Search box clear button for RTL: Closes #7640

This commit is contained in:
Yosef Or Boczko 2013-11-08 13:04:59 -08:00 committed by Jim Nelson
parent 288eaee831
commit 6c00520015

View file

@ -7,6 +7,7 @@
// Draws the main toolbar.
public class MainToolbar : PillToolbar {
private const string ICON_CLEAR_NAME = "edit-clear-symbolic";
private const string ICON_CLEAR_RTL_NAME = "edit-clear-rtl-symbolic";
private const string DEFAULT_SEARCH_TEXT = _("Search");
public FolderMenu copy_folder_menu { get; private set; default = new FolderMenu(); }
@ -72,7 +73,7 @@ public class MainToolbar : PillToolbar {
// Search bar.
search_entry.width_chars = 32;
search_entry.primary_icon_name = "edit-find-symbolic";
search_entry.secondary_icon_name = "edit-clear-symbolic";
search_entry.secondary_icon_name = rtl ? "edit-clear-rtl-symbolic" : "edit-clear-symbolic";
search_entry.secondary_icon_activatable = true;
search_entry.secondary_icon_sensitive = true;
search_entry.tooltip_text = _("Search all mail in account for keywords (Ctrl+S)");
@ -118,7 +119,8 @@ public class MainToolbar : PillToolbar {
private void on_search_entry_changed() {
search_text_changed(search_entry.text);
// Enable/disable clear button.
search_entry.secondary_icon_name = search_entry.text != "" ? ICON_CLEAR_NAME : null;
search_entry.secondary_icon_name = search_entry.text != "" ?
(get_direction() == Gtk.TextDirection.RTL ? ICON_CLEAR_RTL_NAME : ICON_CLEAR_NAME) : null;
}
private void on_search_entry_icon_release(Gtk.EntryIconPosition icon_pos, Gdk.Event event) {