--- ibus-1.5.11/ui/gtk3/panel.vala.org 2015-07-26 00:33:34.593235534 +0900 +++ ibus-1.5.11/ui/gtk3/panel.vala 2015-07-26 00:47:19.476663700 +0900 @@ -1179,12 +1179,48 @@ private new void set_property(IBus.Property prop, bool all_update) { string symbol = prop.get_symbol().get_text(); + + if (prop.key == "InputMode") { + update_input_mode_icon(prop.icon); + } if (m_icon_prop_key != "" && prop.get_key() == m_icon_prop_key && symbol != "") animate_icon(symbol, all_update); } + // If InputMode has an icon, use it instead of engine's icon. + public void update_input_mode_icon(string icon) { + var icon_name = icon; + if (icon == "") { + var engine = m_bus.get_global_engine(); + icon_name = engine.get_icon(); + } + + if (icon_name[0] == '/') { + if (m_icon_type == IconType.STATUS_ICON) { + try { + // + // Do not need to scale icons for ibus 1.5.10+ indicator + var icon_img = new Gdk.Pixbuf.from_file(icon_name); + m_status_icon.set_from_pixbuf(icon_img); + } catch (Error e) { + warning("could not load icon: %s", icon_name); + } + } + else if (m_icon_type == IconType.INDICATOR) { + m_indicator.set_icon_full(icon_name, ""); + } + } else { + var theme = Gtk.IconTheme.get_default(); + if (theme.lookup_icon(icon_name, 48, 0) != null) { + m_status_icon.set_from_icon_name(icon_name); + } else { + m_status_icon.set_from_icon_name("ibus-engine"); + } + } + } + private void animate_icon(string symbol, bool all_update) { if (m_property_icon_delay_time < 0) return;