Fixed Bug 1224025 - IBus radio menu items does not work

This commit is contained in:
Takao Fujiwara 2015-05-22 14:18:37 +09:00
parent b123963390
commit f39fe5b7b8
2 changed files with 95 additions and 1 deletions

View File

@ -1554,3 +1554,93 @@ index 86463cb..39a6d47 100644
_bus = ibus_bus_new_async ();
/* init the global fake context */
From 465e16e8691997fe352d3882a1f02c6455759867 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Fri, 22 May 2015 12:06:52 +0900
Subject: [PATCH] ibus-ui-gtk3: radio and check menu items work with GTK 3.16
GTK 3.16 has cleared the radio buttons' state in
gtk_radio_menu_item_set_group():
https://git.gnome.org/browse/gtk+/commit/?id=955aed9227
---
ui/gtk3/property.vala | 45 +++++++++++++++++++++++++++++++++++++++++----
1 file changed, 41 insertions(+), 4 deletions(-)
diff --git a/ui/gtk3/property.vala b/ui/gtk3/property.vala
index aef880f..419f2bf 100644
--- a/ui/gtk3/property.vala
+++ b/ui/gtk3/property.vala
@@ -2,7 +2,7 @@
*
* ibus - The Input Bus
*
- * Copyright(c) 2011-2014 Peng Huang <shawn.p.huang@gmail.com>
+ * Copyright(c) 2011-2015 Peng Huang <shawn.p.huang@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -133,7 +133,7 @@ public class PropImageMenuItem : Gtk.MenuItem, IPropItem {
}
}
-public class PropCheckMenuItem : Gtk.RadioMenuItem, IPropItem {
+public class PropCheckMenuItem : Gtk.CheckMenuItem, IPropItem {
private IBus.Property m_property;
public PropCheckMenuItem(IBus.Property property) {
assert(property != null);
@@ -173,13 +173,50 @@ public class PropCheckMenuItem : Gtk.RadioMenuItem, IPropItem {
}
}
-public class PropRadioMenuItem : PropCheckMenuItem {
+public class PropRadioMenuItem : Gtk.RadioMenuItem, IPropItem {
+ private IBus.Property m_property;
public PropRadioMenuItem(IBus.Property property,
PropRadioMenuItem ?group_source) {
- base(property);
+ assert(property != null);
+
+ m_property = property;
+ set_no_show_all(true);
if (group_source != null)
set_group(group_source.get_group());
+
+ /* Call sync() after call set_group() because
+ * gtk_radio_menu_item_set_group() sets active = 0. */
+ sync();
+ }
+
+ public void update_property(IBus.Property property) {
+ if (m_property.get_key() != property.get_key())
+ return;
+
+ m_property.set_label(property.get_label());
+ m_property.set_icon(property.get_icon());
+ m_property.set_visible(property.get_visible());
+ m_property.set_sensitive(property.get_sensitive());
+ m_property.set_tooltip(property.get_tooltip());
+ m_property.set_state(property.get_state());
+ sync();
+ }
+
+ private void sync() {
+ set_label(m_property.get_label().get_text());
+ set_visible(m_property.get_visible());
+ set_sensitive(m_property.get_sensitive());
+ set_active(m_property.get_state() == IBus.PropState.CHECKED);
+ }
+
+ public override void toggled() {
+ IBus.PropState new_state =
+ get_active() ? IBus.PropState.CHECKED : IBus.PropState.UNCHECKED;
+ if (m_property.get_state() != new_state) {
+ m_property.set_state(new_state);
+ property_activate(m_property.get_key(), m_property.get_state());
+ }
}
}
--
2.3.5

View File

@ -34,7 +34,7 @@
Name: ibus
Version: 1.5.10
Release: 4%{?dist}
Release: 5%{?dist}
Summary: Intelligent Input Bus for Linux OS
License: LGPLv2+
Group: System Environment/Libraries
@ -424,6 +424,10 @@ gtk-query-immodules-3.0-%{__isa_bits} --update-cache &> /dev/null || :
%{_datadir}/gtk-doc/html/*
%changelog
* Fri May 22 2015 Takao Fujiwara <tfujiwar@redhat.com> - 1.5.10-5
- Updated ibus-HEAD.patch
Fixed Bug 1224025 - IBus radio menu items does not work
* Fri Apr 24 2015 Takao Fujiwara <tfujiwar@redhat.com> - 1.5.10-4
- Bug 1217410 Updated ibus-xinput for KDE5.