summaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorfujiwarat <takao.fujiwara1@gmail.com>2013-12-18 11:39:40 +0900
committerfujiwarat <takao.fujiwara1@gmail.com>2013-12-18 11:39:40 +0900
commit8ce7ac6088e440ee539ed3299d9a219aac1c8089 (patch)
tree75f20bf62374e41e8b8445059ae6bb3581333762 /ui
parentdddd29edaf32d31e1c98047288c54a23edb5979b (diff)
downloadibus-8ce7ac6088e440ee539ed3299d9a219aac1c8089.tar.gz
Hide Property Panel if engines have no properties.
If engines have no properites, Property Panel does not have to be shown. Also resize the topdevel window when engines are switched. TEST=ui/gtk3/ibus-ui-gtk3 Review URL: https://codereview.appspot.com/43260043
Diffstat (limited to 'ui')
-rw-r--r--ui/gtk3/propertypanel.vala22
1 files changed, 18 insertions, 4 deletions
diff --git a/ui/gtk3/propertypanel.vala b/ui/gtk3/propertypanel.vala
index 762e18e2..114d5317 100644
--- a/ui/gtk3/propertypanel.vala
+++ b/ui/gtk3/propertypanel.vala
@@ -62,6 +62,7 @@ public class PropertyPanel : Gtk.Box {
m_props = props;
create_menu_items();
+ show();
}
public void update_property(IBus.Property prop) {
@@ -86,8 +87,10 @@ public class PropertyPanel : Gtk.Box {
}
public new void show() {
- if (m_show == PanelShow.DO_NOT_SHOW)
+ if (m_show == PanelShow.DO_NOT_SHOW || m_items.length == 0) {
+ m_toplevel.hide();
return;
+ }
m_toplevel.show_all();
}
@@ -109,7 +112,19 @@ public class PropertyPanel : Gtk.Box {
m_timeout = timeout;
}
- private int create_menu_items() {
+ public override void get_preferred_width(out int minimum_width,
+ out int natural_width) {
+ base.get_preferred_width(out minimum_width, out natural_width);
+ m_toplevel.resize(1, 1);
+ }
+
+ public override void get_preferred_height(out int minimum_width,
+ out int natural_width) {
+ base.get_preferred_height(out minimum_width, out natural_width);
+ m_toplevel.resize(1, 1);
+ }
+
+ private void create_menu_items() {
int i = 0;
while (true) {
IBus.Property prop = m_props.get(i);
@@ -143,7 +158,6 @@ public class PropertyPanel : Gtk.Box {
property_activate(k, s));
}
}
- return i;
}
private void move(int x, int y) {
@@ -188,7 +202,7 @@ public class PropertyPanel : Gtk.Box {
if (m_timeout_id != 0)
GLib.Source.remove(m_timeout_id);
- m_toplevel.show_all();
+ show();
/* Change the priority because IME typing sometimes freezes. */
m_timeout_id = GLib.Timeout.add(m_timeout, () => {