ibus/show-input-mode-icon.patch
Fuminobu Takeyama 521e2d454a Accepting request 202437 from home:ftake:branches:M17N
Please pick this package for 13.1.

Update to 1.5.4 which includes bug fix and re-implementation of feature that was in openSUSE 12.3.

This update also contains a patch for usability improvement for 13.1.

OBS-URL: https://build.opensuse.org/request/show/202437
OBS-URL: https://build.opensuse.org/package/show/M17N/ibus?expand=0&rev=76
2013-10-06 18:30:30 +00:00

68 lines
2.3 KiB
Diff

From f671355e97f7de3e866f942e5c69f72b0c97fddb Mon Sep 17 00:00:00 2001
From: Fuminobu TAKEYAMA <ftake@geeko.jp>
Date: Sun, 6 Oct 2013 15:29:43 +0900
Subject: [PATCH] If icons for input modes are available, use those icons
instead of engine's icons.
---
ui/gtk3/panel.vala | 39 +++++++++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+)
diff --git a/ui/gtk3/panel.vala b/ui/gtk3/panel.vala
index 9c1fef5..51864c4 100644
--- a/ui/gtk3/panel.vala
+++ b/ui/gtk3/panel.vala
@@ -1098,10 +1098,49 @@ class Panel : IBus.PanelService {
public override void register_properties(IBus.PropList props) {
m_property_manager.set_properties(props);
+ int i = 0;
+ while (true) {
+ IBus.Property prop = props.get(i);
+ if (prop == null)
+ break;
+ if (prop.key == "InputMode") {
+ update_input_mode_icon(prop.icon);
+ break;
+ }
+ }
}
public override void update_property(IBus.Property prop) {
m_property_manager.update_property(prop);
+ if (prop.key == "InputMode") {
+ update_input_mode_icon(prop.icon);
+ }
+ }
+
+ // 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] == '/') {
+ try {
+ // resize icon because icons were desinged for ibus tool bar of 1.4.x
+ var icon_img = new Gdk.Pixbuf.from_file_at_size(icon_name, m_status_icon.size, m_status_icon.size);
+ m_status_icon.set_from_pixbuf(icon_img);
+ } catch (Error e) {
+ warning("could not load icon: %s", 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");
+ }
+ }
}
public override void update_preedit_text(IBus.Text text,
--
1.8.4