091af5e71b
fix bug in the patch added by the previous commit OBS-URL: https://build.opensuse.org/request/show/202973 OBS-URL: https://build.opensuse.org/package/show/M17N/ibus?expand=0&rev=78
70 lines
2.3 KiB
Diff
70 lines
2.3 KiB
Diff
From 8dcad73926dfed30b1aae6bcb6c0ecae35d13777 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 | 41 +++++++++++++++++++++++++++++++++++++++++
|
|
1 file changed, 41 insertions(+)
|
|
|
|
diff --git a/ui/gtk3/panel.vala b/ui/gtk3/panel.vala
|
|
index 9c1fef5..1d38bfe 100644
|
|
--- a/ui/gtk3/panel.vala
|
|
+++ b/ui/gtk3/panel.vala
|
|
@@ -1098,10 +1098,51 @@ 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;
|
|
+ }
|
|
+ i++;
|
|
+ }
|
|
}
|
|
|
|
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
|
|
+ // use 24 px because icons are wrongly cropped on KDE
|
|
+ var icon_img = new Gdk.Pixbuf.from_file_at_size(icon_name, 24, 24);
|
|
+ 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
|
|
|