ibus-anthy/ibus-anthy-HEAD.patch

2525 lines
120 KiB
Diff
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

From ffd69683443c56910e6db6d4526992a92c222275 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Tue, 18 Feb 2014 17:36:45 +0900
Subject: [PATCH] Fixed deprecated GtkHBox, GtkVBox and GtkStock since GTK+
3.10.
---
po/ibus-anthy.pot | 154 +++++++++++++++++++++-----------
setup/python2/main.py | 14 +--
setup/python2/setup.ui | 237 +++++++++++++++++++++++++------------------------
setup/python3/main.py | 10 +--
setup/python3/setup.ui | 237 +++++++++++++++++++++++++------------------------
5 files changed, 361 insertions(+), 291 deletions(-)
diff --git a/setup/python2/main.py b/setup/python2/main.py
index 98486ad..7c403b8 100644
--- a/setup/python2/main.py
+++ b/setup/python2/main.py
@@ -4,8 +4,8 @@
#
# Copyright (c) 2007-2008 Peng Huang <shawn.p.huang@gmail.com>
# Copyright (c) 2009 Hideaki ABE <abe.sendai@gmail.com>
-# Copyright (c) 2010-2013 Takao Fujiwara <takao.fujiwara1@gmail.com>
-# Copyright (c) 2007-2013 Red Hat, Inc.
+# Copyright (c) 2010-2014 Takao Fujiwara <takao.fujiwara1@gmail.com>
+# Copyright (c) 2007-2014 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -1416,14 +1416,14 @@ class AnthySetup(object):
dlg = Gtk.FileChooserDialog(title=_("Open Dictionary File"),
parent=self.__builder.get_object('main'),
action=Gtk.FileChooserAction.OPEN,
- buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
- Gtk.STOCK_OPEN, Gtk.ResponseType.OK))
+ buttons=(_("_Cancel"), Gtk.ResponseType.CANCEL,
+ _("_Open"), Gtk.ResponseType.OK))
if Gtk.Buildable.get_name(widget) == 'dict:btn_edit':
dlg = Gtk.Dialog(title=_("Edit Dictionary File"),
parent=self.__builder.get_object('main'),
flags=Gtk.DialogFlags.MODAL,
- buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
- Gtk.STOCK_OK, Gtk.ResponseType.OK))
+ buttons=(_("_Cancel"), Gtk.ResponseType.CANCEL,
+ _("_OK"), Gtk.ResponseType.OK))
vbox = self.__builder.get_object('dict:add_extra_vbox')
if Gtk.Buildable.get_name(widget) == 'dict:btn_add':
@@ -1518,7 +1518,7 @@ class AnthySetup(object):
dlg = Gtk.Dialog(title=_("View Dictionary File"),
parent=self.__builder.get_object('main'),
flags=Gtk.DialogFlags.MODAL,
- buttons=(Gtk.STOCK_OK, Gtk.ResponseType.OK))
+ buttons=(_("_OK"), Gtk.ResponseType.OK))
buffer = Gtk.TextBuffer()
buffer.set_text (lines)
text_view = Gtk.TextView.new_with_buffer(buffer)
diff --git a/setup/python2/setup.ui b/setup/python2/setup.ui
index d9ec626..dc5e7e1 100644
--- a/setup/python2/setup.ui
+++ b/setup/python2/setup.ui
@@ -195,16 +195,18 @@
<property name="type_hint">dialog</property>
<signal handler="on_main_delete" name="delete_event"/>
<child internal-child="vbox">
- <object class="GtkVBox" id="dialog-vbox1">
+ <object class="GtkBox" id="dialog-vbox1">
<property name="visible">True</property>
+ <property name="orientation">vertical</property>
<child>
<object class="GtkNotebook" id="notebook1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="border_width">6</property>
<child>
- <object class="GtkVBox" id="vbox1">
+ <object class="GtkBox" id="vbox1">
<property name="visible">True</property>
+ <property name="orientation">vertical</property>
<property name="border_width">8</property>
<child>
<object class="GtkFrame" id="frame11">
@@ -355,8 +357,9 @@
<property name="bottom_padding">8</property>
<property name="left_padding">12</property>
<child>
- <object class="GtkVBox" id="vbox12">
+ <object class="GtkBox" id="vbox12">
<property name="visible">True</property>
+ <property name="orientation">vertical</property>
<property name="border_width">4</property>
<property name="spacing">4</property>
<child>
@@ -409,8 +412,9 @@
</packing>
</child>
<child>
- <object class="GtkVBox" id="vbox2">
+ <object class="GtkBox" id="vbox2">
<property name="visible">True</property>
+ <property name="orientation">vertical</property>
<property name="border_width">8</property>
<child>
<object class="GtkFrame" id="frame21">
@@ -637,8 +641,9 @@
<property name="column_spacing">8</property>
<property name="row_spacing">4</property>
<child>
- <object class="GtkHBox" id="hbox4">
+ <object class="GtkBox" id="hbox4">
<property name="visible">True</property>
+ <property name="orientation">horizontal</property>
<property name="spacing">8</property>
<child>
<object class="GtkLabel" id="label109">
@@ -773,13 +778,15 @@
</packing>
</child>
<child>
- <object class="GtkVBox" id="vbox3">
+ <object class="GtkBox" id="vbox3">
<property name="visible">True</property>
+ <property name="orientation">vertical</property>
<property name="border_width">4</property>
<property name="spacing">4</property>
<child>
- <object class="GtkHBox" id="hbox1">
+ <object class="GtkBox" id="hbox1">
<property name="visible">True</property>
+ <property name="orientation">horizontal</property>
<property name="spacing">8</property>
<child>
<object class="GtkLabel" id="label21">
@@ -828,6 +835,7 @@
<property name="hscrollbar_policy">automatic</property>
<property name="vscrollbar_policy">automatic</property>
<property name="shadow_type">in</property>
+ <property name="height_request">300</property>
<child>
<object class="GtkTreeView" id="shortcut">
<property name="visible">True</property>
@@ -843,53 +851,20 @@
</packing>
</child>
<child>
- <object class="GtkHButtonBox" id="hbuttonbox31">
+ <object class="GtkButtonBox" id="hbuttonbox31">
<property name="visible">True</property>
+ <property name="orientation">horizontal</property>
<property name="spacing">4</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="btn_default">
+ <property name="label" translatable="yes">De_fault</property>
+ <property name="use_underline">True</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
<signal handler="on_btn_default_clicked" name="clicked"/>
- <child>
- <object class="GtkAlignment" id="alignment31">
- <property name="visible">True</property>
- <property name="xscale">0</property>
- <property name="yscale">0</property>
- <child>
- <object class="GtkHBox" id="hbox5">
- <property name="visible">True</property>
- <property name="spacing">2</property>
- <child>
- <object class="GtkImage" id="image1">
- <property name="visible">True</property>
- <property name="stock">gtk-undo</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label27">
- <property name="visible">True</property>
- <property name="label" translatable="yes">De_fault</property>
- <property name="use_underline">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
- </child>
</object>
<packing>
<property name="expand">False</property>
@@ -899,12 +874,12 @@
</child>
<child>
<object class="GtkButton" id="btn_edit">
- <property name="label">gtk-edit</property>
+ <property name="label" translatable="yes">_Edit</property>
+ <property name="use_underline">True</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
- <property name="use_stock">True</property>
<signal handler="on_btn_edit_clicked" name="clicked"/>
</object>
<packing>
@@ -1352,8 +1327,9 @@
</packing>
</child>
<child>
- <object class="GtkHBox" id="hbox51">
+ <object class="GtkBox" id="hbox51">
<property name="visible">True</property>
+ <property name="orientation">horizontal</property>
<property name="spacing">8</property>
<child>
<object class="GtkLabel" id="label30">
@@ -1393,13 +1369,14 @@
</packing>
</child>
<child>
- <object class="GtkHBox" id="hbox52">
+ <object class="GtkBox" id="hbox52">
<property name="visible">True</property>
+ <property name="orientation">horizontal</property>
<property name="spacing">8</property>
<child>
<object class="GtkImage" id="image2">
<property name="visible">True</property>
- <property name="stock">gtk-dialog-info</property>
+ <property name="icon_name">dialog-information</property>
</object>
<packing>
<property name="expand">False</property>
@@ -1429,8 +1406,9 @@
</packing>
</child>
<child>
- <object class="GtkHBox" id="hbox11">
+ <object class="GtkBox" id="hbox11">
<property name="visible">True</property>
+ <property name="orientation">horizontal</property>
<property name="spacing">8</property>
<child>
<object class="GtkLabel" id="label33">
@@ -1471,13 +1449,14 @@
</packing>
</child>
<child>
- <object class="GtkHBox" id="hbox53">
+ <object class="GtkBox" id="hbox53">
<property name="visible">True</property>
+ <property name="orientation">horizontal</property>
<property name="spacing">8</property>
<child>
<object class="GtkImage" id="image4">
<property name="visible">True</property>
- <property name="stock">gtk-dialog-info</property>
+ <property name="icon_name">dialog-information</property>
</object>
<packing>
<property name="expand">False</property>
@@ -1605,8 +1584,9 @@
</packing>
</child>
<child>
- <object class="GtkVBox" id="vbox6">
+ <object class="GtkBox" id="vbox6">
<property name="visible">True</property>
+ <property name="orientation">vertical</property>
<property name="border_width">8</property>
<property name="spacing">4</property>
<child>
@@ -1620,8 +1600,9 @@
<property name="top_padding">4</property>
<property name="left_padding">0</property>
<child>
- <object class="GtkVBox" id="vbox61">
+ <object class="GtkBox" id="vbox61">
<property name="visible">True</property>
+ <property name="orientation">vertical</property>
<property name="border_width">4</property>
<property name="spacing">4</property>
<child>
@@ -1777,8 +1758,9 @@
<property name="top_padding">4</property>
<property name="left_padding">0</property>
<child>
- <object class="GtkVBox" id="vbox71">
+ <object class="GtkBox" id="vbox71">
<property name="visible">True</property>
+ <property name="orientation">vertical</property>
<property name="border_width">4</property>
<property name="spacing">4</property>
<child>
@@ -1801,8 +1783,9 @@
</packing>
</child>
<child>
- <object class="GtkHButtonBox" id="hbuttonbox71">
+ <object class="GtkButtonBox" id="hbuttonbox71">
<property name="visible">True</property>
+ <property name="orientation">horizontal</property>
<property name="spacing">4</property>
<property name="layout_style">end</property>
<child>
@@ -1823,12 +1806,12 @@
</child>
<child>
<object class="GtkButton" id="dict:btn_add">
- <property name="label">gtk-add</property>
+ <property name="label" translatable="yes">_Add</property>
+ <property name="use_underline">True</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
- <property name="use_stock">True</property>
<signal handler="on_btn_dict_add_clicked" name="clicked"/>
</object>
<packing>
@@ -1839,12 +1822,12 @@
</child>
<child>
<object class="GtkButton" id="dict:btn_edit">
- <property name="label">gtk-edit</property>
+ <property name="label" translatable="yes">_Edit</property>
+ <property name="use_underline">True</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
- <property name="use_stock">True</property>
<signal handler="on_btn_dict_add_clicked" name="clicked"/>
</object>
<packing>
@@ -1855,12 +1838,12 @@
</child>
<child>
<object class="GtkButton" id="dict:btn_delete">
- <property name="label">gtk-delete</property>
+ <property name="label" translatable="yes">_Delete</property>
+ <property name="use_underline">True</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
- <property name="use_stock">True</property>
<signal handler="on_btn_dict_delete_clicked" name="clicked"/>
</object>
<packing>
@@ -1877,19 +1860,20 @@
</packing>
</child>
<child>
- <object class="GtkHButtonBox" id="hbuttonbox72">
+ <object class="GtkButtonBox" id="hbuttonbox72">
<property name="visible">True</property>
+ <property name="orientation">horizontal</property>
<property name="spacing">4</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="dict:btn_up">
- <property name="label">gtk-go-up</property>
+ <property name="label" translatable="yes">_Up</property>
+ <property name="use_underline">True</property>
<property name="tooltip_text" translatable="yes">You can change the order on language bar</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
- <property name="use_stock">True</property>
<signal handler="on_btn_dict_order_clicked" name="clicked"/>
</object>
<packing>
@@ -1900,13 +1884,13 @@
</child>
<child>
<object class="GtkButton" id="dict:btn_down">
- <property name="label">gtk-go-down</property>
+ <property name="label" translatable="yes">_Down</property>
+ <property name="use_underline">True</property>
<property name="tooltip_text" translatable="yes">You can change the order on language bar</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
- <property name="use_stock">True</property>
<signal handler="on_btn_dict_order_clicked" name="clicked"/>
</object>
<packing>
@@ -1953,7 +1937,7 @@
</packing>
</child>
<child>
- <object class="GtkVBox" id="about_vbox">
+ <object class="GtkBox" id="about_vbox">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="border_width">10</property>
@@ -1979,18 +1963,19 @@
</packing>
</child>
<child internal-child="action_area">
- <object class="GtkHButtonBox" id="dialog-action_area1">
+ <object class="GtkButtonBox" id="dialog-action_area1">
<property name="visible">True</property>
+ <property name="orientation">horizontal</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="btn_apply">
- <property name="label">gtk-apply</property>
+ <property name="label" translatable="yes">_Apply</property>
+ <property name="use_underline">True</property>
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
- <property name="use_stock">True</property>
<signal handler="on_btn_apply_clicked" name="clicked"/>
</object>
<packing>
@@ -2001,12 +1986,12 @@
</child>
<child>
<object class="GtkButton" id="btn_cancel">
- <property name="label">gtk-cancel</property>
+ <property name="label" translatable="yes">_Cancel</property>
+ <property name="use_underline">True</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
- <property name="use_stock">True</property>
<signal handler="on_btn_cancel_clicked" name="clicked"/>
</object>
<packing>
@@ -2017,12 +2002,12 @@
</child>
<child>
<object class="GtkButton" id="btn_ok">
- <property name="label">gtk-ok</property>
+ <property name="label" translatable="yes">_OK</property>
+ <property name="use_underline">True</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
- <property name="use_stock">True</property>
<signal handler="on_btn_ok_clicked" name="clicked"/>
</object>
<packing>
@@ -2053,11 +2038,13 @@
<property name="modal">True</property>
<property name="type_hint">dialog</property>
<child internal-child="vbox">
- <object class="GtkVBox" id="dialog-vbox2">
+ <object class="GtkBox" id="dialog-vbox2">
<property name="visible">True</property>
+ <property name="orientation">vertical</property>
<child>
- <object class="GtkVBox" id="vbox101">
+ <object class="GtkBox" id="vbox101">
<property name="visible">True</property>
+ <property name="orientation">vertical</property>
<property name="border_width">5</property>
<property name="spacing">6</property>
<child>
@@ -2068,6 +2055,7 @@
<property name="hscrollbar_policy">automatic</property>
<property name="vscrollbar_policy">automatic</property>
<property name="shadow_type">in</property>
+ <property name="height_request">150</property>
<child>
<object class="GtkTreeView" id="es:treeview">
<property name="visible">True</property>
@@ -2081,8 +2069,9 @@
</packing>
</child>
<child>
- <object class="GtkHBox" id="hbox101">
+ <object class="GtkBox" id="hbox101">
<property name="visible">True</property>
+ <property name="orientation">horizontal</property>
<property name="spacing">8</property>
<child>
<object class="GtkLabel" id="label1001">
@@ -2128,8 +2117,9 @@
</packing>
</child>
<child>
- <object class="GtkHBox" id="hbox102">
+ <object class="GtkBox" id="hbox102">
<property name="visible">True</property>
+ <property name="orientation">horizontal</property>
<property name="spacing">8</property>
<child>
<object class="GtkLabel" id="label1002">
@@ -2143,8 +2133,9 @@
</packing>
</child>
<child>
- <object class="GtkHBox" id="hbox103">
+ <object class="GtkBox" id="hbox103">
<property name="visible">True</property>
+ <property name="orientation">horizontal</property>
<child>
<object class="GtkCheckButton" id="es:checkbutton_alt">
<property name="label" translatable="yes">A_lternate</property>
@@ -2197,19 +2188,20 @@
</packing>
</child>
<child>
- <object class="GtkHButtonBox" id="hbuttonbox101">
+ <object class="GtkButtonBox" id="hbuttonbox101">
<property name="visible">True</property>
+ <property name="orientation">horizontal</property>
<property name="spacing">6</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="es:button_add">
- <property name="label">gtk-add</property>
+ <property name="label" translatable="yes">_Add</property>
+ <property name="use_underline">True</property>
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
- <property name="use_stock">True</property>
<signal handler="on_es_button_add_clicked" name="clicked"/>
</object>
<packing>
@@ -2220,12 +2212,12 @@
</child>
<child>
<object class="GtkButton" id="es:button_refresh">
- <property name="label">gtk-refresh</property>
+ <property name="label" translatable="yes">_Refresh</property>
+ <property name="use_underline">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
- <property name="use_stock">True</property>
<signal handler="on_es_button_refresh_clicked" name="clicked"/>
</object>
<packing>
@@ -2236,13 +2228,13 @@
</child>
<child>
<object class="GtkButton" id="es:button_del">
- <property name="label">gtk-delete</property>
+ <property name="label" translatable="yes">_Delete</property>
+ <property name="use_underline">True</property>
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
- <property name="use_stock">True</property>
<signal handler="on_es_button_del_clicked" name="clicked"/>
</object>
<packing>
@@ -2264,17 +2256,18 @@
</packing>
</child>
<child internal-child="action_area">
- <object class="GtkHButtonBox" id="dialog-action_area2">
+ <object class="GtkButtonBox" id="dialog-action_area2">
<property name="visible">True</property>
+ <property name="orientation">horizontal</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="cancelbutton101">
- <property name="label">gtk-cancel</property>
+ <property name="label" translatable="yes">_Cancel</property>
+ <property name="use_underline">True</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
- <property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
@@ -2284,12 +2277,12 @@
</child>
<child>
<object class="GtkButton" id="okbutton101">
- <property name="label">gtk-ok</property>
+ <property name="label" translatable="yes">_OK</property>
+ <property name="use_underline">True</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
- <property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
@@ -2318,13 +2311,15 @@
<property name="modal">True</property>
<property name="type_hint">dialog</property>
<child internal-child="vbox">
- <object class="GtkVBox" id="dialog-vbox3">
+ <object class="GtkBox" id="dialog-vbox3">
<property name="visible">True</property>
+ <property name="orientation">vertical</property>
<property name="border_width">5</property>
<property name="spacing">6</property>
<child>
- <object class="GtkHBox" id="hbox_for_combobox_custom_key_table">
+ <object class="GtkBox" id="hbox_for_combobox_custom_key_table">
<property name="visible">True</property>
+ <property name="orientation">horizontal</property>
<property name="border_width">5</property>
<property name="spacing">6</property>
<child>
@@ -2359,8 +2354,9 @@
</packing>
</child>
<child>
- <object class="GtkHBox" id="hbox301">
+ <object class="GtkBox" id="hbox301">
<property name="visible">True</property>
+ <property name="orientation">horizontal</property>
<property name="border_width">5</property>
<property name="spacing">6</property>
<child>
@@ -2371,6 +2367,8 @@
<property name="hscrollbar_policy">automatic</property>
<property name="vscrollbar_policy">automatic</property>
<property name="shadow_type">in</property>
+ <property name="width_request">250</property>
+ <property name="height_request">300</property>
<child>
<object class="GtkTreeView" id="treeview_custom_key_table">
<property name="visible">True</property>
@@ -2383,8 +2381,9 @@
</packing>
</child>
<child>
- <object class="GtkVButtonBox" id="vbutton301">
+ <object class="GtkButtonBox" id="vbutton301">
<property name="visible">True</property>
+ <property name="orientation">vertical</property>
<property name="layout_style">start</property>
<property name="spacing">6</property>
<child>
@@ -2470,12 +2469,12 @@
<child>
<object class="GtkButton" id="button_add_custom_key">
<property name="visible">True</property>
- <property name="label">gtk-add</property>
+ <property name="label" translatable="yes">_Add</property>
+ <property name="use_underline">True</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
- <property name="use_stock">True</property>
</object>
<packing>
<property name="position">8</property>
@@ -2484,12 +2483,12 @@
<child>
<object class="GtkButton" id="button_remove_custom_key">
<property name="visible">True</property>
- <property name="label">gtk-remove</property>
+ <property name="label" translatable="yes">_Remove</property>
+ <property name="use_underline">True</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
- <property name="use_stock">True</property>
</object>
<packing>
<property name="position">9</property>
@@ -2508,16 +2507,17 @@
</packing>
</child>
<child internal-child="action_area">
- <object class="GtkHButtonBox" id="dialog-action_area3">
+ <object class="GtkButtonBox" id="dialog-action_area3">
<property name="visible">True</property>
+ <property name="orientation">horizontal</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="closebutton301">
<property name="visible">True</property>
- <property name="label">gtk-close</property>
+ <property name="label" translatable="yes">_Close</property>
+ <property name="use_underline">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
- <property name="use_stock">True</property>
<property name="receives_default">True</property>
</object>
<packing>
@@ -2551,12 +2551,14 @@
<property name="text">Confirmation</property>
<property name="secondary_text">You are about to close the setup dialog, is that OK?</property>
<child internal-child="vbox">
- <object class="GtkVBox" id="dialog-vbox6">
+ <object class="GtkBox" id="dialog-vbox6">
<property name="visible">True</property>
+ <property name="orientation">vertical</property>
<property name="spacing">2</property>
<child internal-child="action_area">
- <object class="GtkHButtonBox" id="dialog-action_area6">
+ <object class="GtkButtonBox" id="dialog-action_area6">
<property name="visible">True</property>
+ <property name="orientation">horizontal</property>
<property name="layout_style">end</property>
<child>
<placeholder/>
@@ -2586,12 +2588,14 @@
<property name="text">Notice!</property>
<property name="secondary_text">You are about to close the setup dialog without saving your changes, is that OK?</property>
<child internal-child="vbox">
- <object class="GtkVBox" id="dialog-vbox7">
+ <object class="GtkBox" id="dialog-vbox7">
<property name="visible">True</property>
+ <property name="orientation">vertical</property>
<property name="spacing">2</property>
<child internal-child="action_area">
- <object class="GtkHButtonBox" id="dialog-action_area7">
+ <object class="GtkButtonBox" id="dialog-action_area7">
<property name="visible">True</property>
+ <property name="orientation">horizontal</property>
<property name="layout_style">end</property>
<child>
<placeholder/>
@@ -2622,12 +2626,14 @@
<signal handler="on_key_input_dialog_key_press_event" name="key_press_event"/>
<signal handler="on_key_input_dialog_key_release_event" name="key_release_event"/>
<child internal-child="vbox">
- <object class="GtkVBox" id="dialog-vbox8">
+ <object class="GtkBox" id="dialog-vbox8">
<property name="visible">True</property>
+ <property name="orientation">vertical</property>
<property name="spacing">2</property>
<child internal-child="action_area">
- <object class="GtkHButtonBox" id="dialog-action_area8">
+ <object class="GtkButtonBox" id="dialog-action_area8">
<property name="visible">True</property>
+ <property name="orientation">horizontal</property>
<property name="layout_style">end</property>
<child>
<placeholder/>
@@ -2657,12 +2663,14 @@
<property name="text">Invalid keysym</property>
<property name="secondary_text">This keysym is not valid</property>
<child internal-child="vbox">
- <object class="GtkVBox" id="dialog-vbox9">
+ <object class="GtkBox" id="dialog-vbox9">
<property name="visible">True</property>
+ <property name="orientation">vertical</property>
<property name="spacing">2</property>
<child internal-child="action_area">
- <object class="GtkHButtonBox" id="dialog-action_area9">
+ <object class="GtkButtonBox" id="dialog-action_area9">
<property name="visible">True</property>
+ <property name="orientation">horizontal</property>
<property name="layout_style">end</property>
<child>
<placeholder/>
@@ -2680,8 +2688,9 @@
</object>
</child>
</object>
- <object class="GtkVBox" id="dict:add_extra_vbox">
+ <object class="GtkBox" id="dict:add_extra_vbox">
<property name="visible">True</property>
+ <property name="orientation">vertical</property>
<property name="no_show_all">True</property>
<property name="spacing">10</property>
<child>
@@ -2800,8 +2809,8 @@
<property name="program-name">IBus-Anthy</property>
<property name="copyright">Copyright © 20072008 Peng Huang
Copyright © 2009 Hideaki ABE
-Copyright © 20092013 Takao Fujiwara
-Copyright © 20072013 Red Hat, Inc.</property>
+Copyright © 20092014 Takao Fujiwara
+Copyright © 20072014 Red Hat, Inc.</property>
<property name="comments" translatable="yes">The Anthy engine for the IBus input platform</property>
<property name="license">GPL</property>
<property name="website">http://code.google.com/p/ibus/</property>
diff --git a/setup/python3/main.py b/setup/python3/main.py
index fec03a6..2073f59 100644
--- a/setup/python3/main.py
+++ b/setup/python3/main.py
@@ -1410,14 +1410,14 @@ class AnthySetup(object):
dlg = Gtk.FileChooserDialog(title=_("Open Dictionary File"),
parent=self.__builder.get_object('main'),
action=Gtk.FileChooserAction.OPEN,
- buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
- Gtk.STOCK_OPEN, Gtk.ResponseType.OK))
+ buttons=(_("_Cancel"), Gtk.ResponseType.CANCEL,
+ _("_Open"), Gtk.ResponseType.OK))
if Gtk.Buildable.get_name(widget) == 'dict:btn_edit':
dlg = Gtk.Dialog(title=_("Edit Dictionary File"),
parent=self.__builder.get_object('main'),
flags=Gtk.DialogFlags.MODAL,
- buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
- Gtk.STOCK_OK, Gtk.ResponseType.OK))
+ buttons=(_("_Cancel"), Gtk.ResponseType.CANCEL,
+ _("_OK"), Gtk.ResponseType.OK))
vbox = self.__builder.get_object('dict:add_extra_vbox')
if Gtk.Buildable.get_name(widget) == 'dict:btn_add':
@@ -1512,7 +1512,7 @@ class AnthySetup(object):
dlg = Gtk.Dialog(title=_("View Dictionary File"),
parent=self.__builder.get_object('main'),
flags=Gtk.DialogFlags.MODAL,
- buttons=(Gtk.STOCK_OK, Gtk.ResponseType.OK))
+ buttons=(_("_OK"), Gtk.ResponseType.OK))
buffer = Gtk.TextBuffer()
buffer.set_text (lines)
text_view = Gtk.TextView.new_with_buffer(buffer)
diff --git a/setup/python3/setup.ui b/setup/python3/setup.ui
index d9ec626..dc5e7e1 100644
--- a/setup/python3/setup.ui
+++ b/setup/python3/setup.ui
@@ -195,16 +195,18 @@
<property name="type_hint">dialog</property>
<signal handler="on_main_delete" name="delete_event"/>
<child internal-child="vbox">
- <object class="GtkVBox" id="dialog-vbox1">
+ <object class="GtkBox" id="dialog-vbox1">
<property name="visible">True</property>
+ <property name="orientation">vertical</property>
<child>
<object class="GtkNotebook" id="notebook1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="border_width">6</property>
<child>
- <object class="GtkVBox" id="vbox1">
+ <object class="GtkBox" id="vbox1">
<property name="visible">True</property>
+ <property name="orientation">vertical</property>
<property name="border_width">8</property>
<child>
<object class="GtkFrame" id="frame11">
@@ -355,8 +357,9 @@
<property name="bottom_padding">8</property>
<property name="left_padding">12</property>
<child>
- <object class="GtkVBox" id="vbox12">
+ <object class="GtkBox" id="vbox12">
<property name="visible">True</property>
+ <property name="orientation">vertical</property>
<property name="border_width">4</property>
<property name="spacing">4</property>
<child>
@@ -409,8 +412,9 @@
</packing>
</child>
<child>
- <object class="GtkVBox" id="vbox2">
+ <object class="GtkBox" id="vbox2">
<property name="visible">True</property>
+ <property name="orientation">vertical</property>
<property name="border_width">8</property>
<child>
<object class="GtkFrame" id="frame21">
@@ -637,8 +641,9 @@
<property name="column_spacing">8</property>
<property name="row_spacing">4</property>
<child>
- <object class="GtkHBox" id="hbox4">
+ <object class="GtkBox" id="hbox4">
<property name="visible">True</property>
+ <property name="orientation">horizontal</property>
<property name="spacing">8</property>
<child>
<object class="GtkLabel" id="label109">
@@ -773,13 +778,15 @@
</packing>
</child>
<child>
- <object class="GtkVBox" id="vbox3">
+ <object class="GtkBox" id="vbox3">
<property name="visible">True</property>
+ <property name="orientation">vertical</property>
<property name="border_width">4</property>
<property name="spacing">4</property>
<child>
- <object class="GtkHBox" id="hbox1">
+ <object class="GtkBox" id="hbox1">
<property name="visible">True</property>
+ <property name="orientation">horizontal</property>
<property name="spacing">8</property>
<child>
<object class="GtkLabel" id="label21">
@@ -828,6 +835,7 @@
<property name="hscrollbar_policy">automatic</property>
<property name="vscrollbar_policy">automatic</property>
<property name="shadow_type">in</property>
+ <property name="height_request">300</property>
<child>
<object class="GtkTreeView" id="shortcut">
<property name="visible">True</property>
@@ -843,53 +851,20 @@
</packing>
</child>
<child>
- <object class="GtkHButtonBox" id="hbuttonbox31">
+ <object class="GtkButtonBox" id="hbuttonbox31">
<property name="visible">True</property>
+ <property name="orientation">horizontal</property>
<property name="spacing">4</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="btn_default">
+ <property name="label" translatable="yes">De_fault</property>
+ <property name="use_underline">True</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
<signal handler="on_btn_default_clicked" name="clicked"/>
- <child>
- <object class="GtkAlignment" id="alignment31">
- <property name="visible">True</property>
- <property name="xscale">0</property>
- <property name="yscale">0</property>
- <child>
- <object class="GtkHBox" id="hbox5">
- <property name="visible">True</property>
- <property name="spacing">2</property>
- <child>
- <object class="GtkImage" id="image1">
- <property name="visible">True</property>
- <property name="stock">gtk-undo</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label27">
- <property name="visible">True</property>
- <property name="label" translatable="yes">De_fault</property>
- <property name="use_underline">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
- </child>
</object>
<packing>
<property name="expand">False</property>
@@ -899,12 +874,12 @@
</child>
<child>
<object class="GtkButton" id="btn_edit">
- <property name="label">gtk-edit</property>
+ <property name="label" translatable="yes">_Edit</property>
+ <property name="use_underline">True</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
- <property name="use_stock">True</property>
<signal handler="on_btn_edit_clicked" name="clicked"/>
</object>
<packing>
@@ -1352,8 +1327,9 @@
</packing>
</child>
<child>
- <object class="GtkHBox" id="hbox51">
+ <object class="GtkBox" id="hbox51">
<property name="visible">True</property>
+ <property name="orientation">horizontal</property>
<property name="spacing">8</property>
<child>
<object class="GtkLabel" id="label30">
@@ -1393,13 +1369,14 @@
</packing>
</child>
<child>
- <object class="GtkHBox" id="hbox52">
+ <object class="GtkBox" id="hbox52">
<property name="visible">True</property>
+ <property name="orientation">horizontal</property>
<property name="spacing">8</property>
<child>
<object class="GtkImage" id="image2">
<property name="visible">True</property>
- <property name="stock">gtk-dialog-info</property>
+ <property name="icon_name">dialog-information</property>
</object>
<packing>
<property name="expand">False</property>
@@ -1429,8 +1406,9 @@
</packing>
</child>
<child>
- <object class="GtkHBox" id="hbox11">
+ <object class="GtkBox" id="hbox11">
<property name="visible">True</property>
+ <property name="orientation">horizontal</property>
<property name="spacing">8</property>
<child>
<object class="GtkLabel" id="label33">
@@ -1471,13 +1449,14 @@
</packing>
</child>
<child>
- <object class="GtkHBox" id="hbox53">
+ <object class="GtkBox" id="hbox53">
<property name="visible">True</property>
+ <property name="orientation">horizontal</property>
<property name="spacing">8</property>
<child>
<object class="GtkImage" id="image4">
<property name="visible">True</property>
- <property name="stock">gtk-dialog-info</property>
+ <property name="icon_name">dialog-information</property>
</object>
<packing>
<property name="expand">False</property>
@@ -1605,8 +1584,9 @@
</packing>
</child>
<child>
- <object class="GtkVBox" id="vbox6">
+ <object class="GtkBox" id="vbox6">
<property name="visible">True</property>
+ <property name="orientation">vertical</property>
<property name="border_width">8</property>
<property name="spacing">4</property>
<child>
@@ -1620,8 +1600,9 @@
<property name="top_padding">4</property>
<property name="left_padding">0</property>
<child>
- <object class="GtkVBox" id="vbox61">
+ <object class="GtkBox" id="vbox61">
<property name="visible">True</property>
+ <property name="orientation">vertical</property>
<property name="border_width">4</property>
<property name="spacing">4</property>
<child>
@@ -1777,8 +1758,9 @@
<property name="top_padding">4</property>
<property name="left_padding">0</property>
<child>
- <object class="GtkVBox" id="vbox71">
+ <object class="GtkBox" id="vbox71">
<property name="visible">True</property>
+ <property name="orientation">vertical</property>
<property name="border_width">4</property>
<property name="spacing">4</property>
<child>
@@ -1801,8 +1783,9 @@
</packing>
</child>
<child>
- <object class="GtkHButtonBox" id="hbuttonbox71">
+ <object class="GtkButtonBox" id="hbuttonbox71">
<property name="visible">True</property>
+ <property name="orientation">horizontal</property>
<property name="spacing">4</property>
<property name="layout_style">end</property>
<child>
@@ -1823,12 +1806,12 @@
</child>
<child>
<object class="GtkButton" id="dict:btn_add">
- <property name="label">gtk-add</property>
+ <property name="label" translatable="yes">_Add</property>
+ <property name="use_underline">True</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
- <property name="use_stock">True</property>
<signal handler="on_btn_dict_add_clicked" name="clicked"/>
</object>
<packing>
@@ -1839,12 +1822,12 @@
</child>
<child>
<object class="GtkButton" id="dict:btn_edit">
- <property name="label">gtk-edit</property>
+ <property name="label" translatable="yes">_Edit</property>
+ <property name="use_underline">True</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
- <property name="use_stock">True</property>
<signal handler="on_btn_dict_add_clicked" name="clicked"/>
</object>
<packing>
@@ -1855,12 +1838,12 @@
</child>
<child>
<object class="GtkButton" id="dict:btn_delete">
- <property name="label">gtk-delete</property>
+ <property name="label" translatable="yes">_Delete</property>
+ <property name="use_underline">True</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
- <property name="use_stock">True</property>
<signal handler="on_btn_dict_delete_clicked" name="clicked"/>
</object>
<packing>
@@ -1877,19 +1860,20 @@
</packing>
</child>
<child>
- <object class="GtkHButtonBox" id="hbuttonbox72">
+ <object class="GtkButtonBox" id="hbuttonbox72">
<property name="visible">True</property>
+ <property name="orientation">horizontal</property>
<property name="spacing">4</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="dict:btn_up">
- <property name="label">gtk-go-up</property>
+ <property name="label" translatable="yes">_Up</property>
+ <property name="use_underline">True</property>
<property name="tooltip_text" translatable="yes">You can change the order on language bar</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
- <property name="use_stock">True</property>
<signal handler="on_btn_dict_order_clicked" name="clicked"/>
</object>
<packing>
@@ -1900,13 +1884,13 @@
</child>
<child>
<object class="GtkButton" id="dict:btn_down">
- <property name="label">gtk-go-down</property>
+ <property name="label" translatable="yes">_Down</property>
+ <property name="use_underline">True</property>
<property name="tooltip_text" translatable="yes">You can change the order on language bar</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
- <property name="use_stock">True</property>
<signal handler="on_btn_dict_order_clicked" name="clicked"/>
</object>
<packing>
@@ -1953,7 +1937,7 @@
</packing>
</child>
<child>
- <object class="GtkVBox" id="about_vbox">
+ <object class="GtkBox" id="about_vbox">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="border_width">10</property>
@@ -1979,18 +1963,19 @@
</packing>
</child>
<child internal-child="action_area">
- <object class="GtkHButtonBox" id="dialog-action_area1">
+ <object class="GtkButtonBox" id="dialog-action_area1">
<property name="visible">True</property>
+ <property name="orientation">horizontal</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="btn_apply">
- <property name="label">gtk-apply</property>
+ <property name="label" translatable="yes">_Apply</property>
+ <property name="use_underline">True</property>
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
- <property name="use_stock">True</property>
<signal handler="on_btn_apply_clicked" name="clicked"/>
</object>
<packing>
@@ -2001,12 +1986,12 @@
</child>
<child>
<object class="GtkButton" id="btn_cancel">
- <property name="label">gtk-cancel</property>
+ <property name="label" translatable="yes">_Cancel</property>
+ <property name="use_underline">True</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
- <property name="use_stock">True</property>
<signal handler="on_btn_cancel_clicked" name="clicked"/>
</object>
<packing>
@@ -2017,12 +2002,12 @@
</child>
<child>
<object class="GtkButton" id="btn_ok">
- <property name="label">gtk-ok</property>
+ <property name="label" translatable="yes">_OK</property>
+ <property name="use_underline">True</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
- <property name="use_stock">True</property>
<signal handler="on_btn_ok_clicked" name="clicked"/>
</object>
<packing>
@@ -2053,11 +2038,13 @@
<property name="modal">True</property>
<property name="type_hint">dialog</property>
<child internal-child="vbox">
- <object class="GtkVBox" id="dialog-vbox2">
+ <object class="GtkBox" id="dialog-vbox2">
<property name="visible">True</property>
+ <property name="orientation">vertical</property>
<child>
- <object class="GtkVBox" id="vbox101">
+ <object class="GtkBox" id="vbox101">
<property name="visible">True</property>
+ <property name="orientation">vertical</property>
<property name="border_width">5</property>
<property name="spacing">6</property>
<child>
@@ -2068,6 +2055,7 @@
<property name="hscrollbar_policy">automatic</property>
<property name="vscrollbar_policy">automatic</property>
<property name="shadow_type">in</property>
+ <property name="height_request">150</property>
<child>
<object class="GtkTreeView" id="es:treeview">
<property name="visible">True</property>
@@ -2081,8 +2069,9 @@
</packing>
</child>
<child>
- <object class="GtkHBox" id="hbox101">
+ <object class="GtkBox" id="hbox101">
<property name="visible">True</property>
+ <property name="orientation">horizontal</property>
<property name="spacing">8</property>
<child>
<object class="GtkLabel" id="label1001">
@@ -2128,8 +2117,9 @@
</packing>
</child>
<child>
- <object class="GtkHBox" id="hbox102">
+ <object class="GtkBox" id="hbox102">
<property name="visible">True</property>
+ <property name="orientation">horizontal</property>
<property name="spacing">8</property>
<child>
<object class="GtkLabel" id="label1002">
@@ -2143,8 +2133,9 @@
</packing>
</child>
<child>
- <object class="GtkHBox" id="hbox103">
+ <object class="GtkBox" id="hbox103">
<property name="visible">True</property>
+ <property name="orientation">horizontal</property>
<child>
<object class="GtkCheckButton" id="es:checkbutton_alt">
<property name="label" translatable="yes">A_lternate</property>
@@ -2197,19 +2188,20 @@
</packing>
</child>
<child>
- <object class="GtkHButtonBox" id="hbuttonbox101">
+ <object class="GtkButtonBox" id="hbuttonbox101">
<property name="visible">True</property>
+ <property name="orientation">horizontal</property>
<property name="spacing">6</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="es:button_add">
- <property name="label">gtk-add</property>
+ <property name="label" translatable="yes">_Add</property>
+ <property name="use_underline">True</property>
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
- <property name="use_stock">True</property>
<signal handler="on_es_button_add_clicked" name="clicked"/>
</object>
<packing>
@@ -2220,12 +2212,12 @@
</child>
<child>
<object class="GtkButton" id="es:button_refresh">
- <property name="label">gtk-refresh</property>
+ <property name="label" translatable="yes">_Refresh</property>
+ <property name="use_underline">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
- <property name="use_stock">True</property>
<signal handler="on_es_button_refresh_clicked" name="clicked"/>
</object>
<packing>
@@ -2236,13 +2228,13 @@
</child>
<child>
<object class="GtkButton" id="es:button_del">
- <property name="label">gtk-delete</property>
+ <property name="label" translatable="yes">_Delete</property>
+ <property name="use_underline">True</property>
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
- <property name="use_stock">True</property>
<signal handler="on_es_button_del_clicked" name="clicked"/>
</object>
<packing>
@@ -2264,17 +2256,18 @@
</packing>
</child>
<child internal-child="action_area">
- <object class="GtkHButtonBox" id="dialog-action_area2">
+ <object class="GtkButtonBox" id="dialog-action_area2">
<property name="visible">True</property>
+ <property name="orientation">horizontal</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="cancelbutton101">
- <property name="label">gtk-cancel</property>
+ <property name="label" translatable="yes">_Cancel</property>
+ <property name="use_underline">True</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
- <property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
@@ -2284,12 +2277,12 @@
</child>
<child>
<object class="GtkButton" id="okbutton101">
- <property name="label">gtk-ok</property>
+ <property name="label" translatable="yes">_OK</property>
+ <property name="use_underline">True</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
- <property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
@@ -2318,13 +2311,15 @@
<property name="modal">True</property>
<property name="type_hint">dialog</property>
<child internal-child="vbox">
- <object class="GtkVBox" id="dialog-vbox3">
+ <object class="GtkBox" id="dialog-vbox3">
<property name="visible">True</property>
+ <property name="orientation">vertical</property>
<property name="border_width">5</property>
<property name="spacing">6</property>
<child>
- <object class="GtkHBox" id="hbox_for_combobox_custom_key_table">
+ <object class="GtkBox" id="hbox_for_combobox_custom_key_table">
<property name="visible">True</property>
+ <property name="orientation">horizontal</property>
<property name="border_width">5</property>
<property name="spacing">6</property>
<child>
@@ -2359,8 +2354,9 @@
</packing>
</child>
<child>
- <object class="GtkHBox" id="hbox301">
+ <object class="GtkBox" id="hbox301">
<property name="visible">True</property>
+ <property name="orientation">horizontal</property>
<property name="border_width">5</property>
<property name="spacing">6</property>
<child>
@@ -2371,6 +2367,8 @@
<property name="hscrollbar_policy">automatic</property>
<property name="vscrollbar_policy">automatic</property>
<property name="shadow_type">in</property>
+ <property name="width_request">250</property>
+ <property name="height_request">300</property>
<child>
<object class="GtkTreeView" id="treeview_custom_key_table">
<property name="visible">True</property>
@@ -2383,8 +2381,9 @@
</packing>
</child>
<child>
- <object class="GtkVButtonBox" id="vbutton301">
+ <object class="GtkButtonBox" id="vbutton301">
<property name="visible">True</property>
+ <property name="orientation">vertical</property>
<property name="layout_style">start</property>
<property name="spacing">6</property>
<child>
@@ -2470,12 +2469,12 @@
<child>
<object class="GtkButton" id="button_add_custom_key">
<property name="visible">True</property>
- <property name="label">gtk-add</property>
+ <property name="label" translatable="yes">_Add</property>
+ <property name="use_underline">True</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
- <property name="use_stock">True</property>
</object>
<packing>
<property name="position">8</property>
@@ -2484,12 +2483,12 @@
<child>
<object class="GtkButton" id="button_remove_custom_key">
<property name="visible">True</property>
- <property name="label">gtk-remove</property>
+ <property name="label" translatable="yes">_Remove</property>
+ <property name="use_underline">True</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
- <property name="use_stock">True</property>
</object>
<packing>
<property name="position">9</property>
@@ -2508,16 +2507,17 @@
</packing>
</child>
<child internal-child="action_area">
- <object class="GtkHButtonBox" id="dialog-action_area3">
+ <object class="GtkButtonBox" id="dialog-action_area3">
<property name="visible">True</property>
+ <property name="orientation">horizontal</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="closebutton301">
<property name="visible">True</property>
- <property name="label">gtk-close</property>
+ <property name="label" translatable="yes">_Close</property>
+ <property name="use_underline">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
- <property name="use_stock">True</property>
<property name="receives_default">True</property>
</object>
<packing>
@@ -2551,12 +2551,14 @@
<property name="text">Confirmation</property>
<property name="secondary_text">You are about to close the setup dialog, is that OK?</property>
<child internal-child="vbox">
- <object class="GtkVBox" id="dialog-vbox6">
+ <object class="GtkBox" id="dialog-vbox6">
<property name="visible">True</property>
+ <property name="orientation">vertical</property>
<property name="spacing">2</property>
<child internal-child="action_area">
- <object class="GtkHButtonBox" id="dialog-action_area6">
+ <object class="GtkButtonBox" id="dialog-action_area6">
<property name="visible">True</property>
+ <property name="orientation">horizontal</property>
<property name="layout_style">end</property>
<child>
<placeholder/>
@@ -2586,12 +2588,14 @@
<property name="text">Notice!</property>
<property name="secondary_text">You are about to close the setup dialog without saving your changes, is that OK?</property>
<child internal-child="vbox">
- <object class="GtkVBox" id="dialog-vbox7">
+ <object class="GtkBox" id="dialog-vbox7">
<property name="visible">True</property>
+ <property name="orientation">vertical</property>
<property name="spacing">2</property>
<child internal-child="action_area">
- <object class="GtkHButtonBox" id="dialog-action_area7">
+ <object class="GtkButtonBox" id="dialog-action_area7">
<property name="visible">True</property>
+ <property name="orientation">horizontal</property>
<property name="layout_style">end</property>
<child>
<placeholder/>
@@ -2622,12 +2626,14 @@
<signal handler="on_key_input_dialog_key_press_event" name="key_press_event"/>
<signal handler="on_key_input_dialog_key_release_event" name="key_release_event"/>
<child internal-child="vbox">
- <object class="GtkVBox" id="dialog-vbox8">
+ <object class="GtkBox" id="dialog-vbox8">
<property name="visible">True</property>
+ <property name="orientation">vertical</property>
<property name="spacing">2</property>
<child internal-child="action_area">
- <object class="GtkHButtonBox" id="dialog-action_area8">
+ <object class="GtkButtonBox" id="dialog-action_area8">
<property name="visible">True</property>
+ <property name="orientation">horizontal</property>
<property name="layout_style">end</property>
<child>
<placeholder/>
@@ -2657,12 +2663,14 @@
<property name="text">Invalid keysym</property>
<property name="secondary_text">This keysym is not valid</property>
<child internal-child="vbox">
- <object class="GtkVBox" id="dialog-vbox9">
+ <object class="GtkBox" id="dialog-vbox9">
<property name="visible">True</property>
+ <property name="orientation">vertical</property>
<property name="spacing">2</property>
<child internal-child="action_area">
- <object class="GtkHButtonBox" id="dialog-action_area9">
+ <object class="GtkButtonBox" id="dialog-action_area9">
<property name="visible">True</property>
+ <property name="orientation">horizontal</property>
<property name="layout_style">end</property>
<child>
<placeholder/>
@@ -2680,8 +2688,9 @@
</object>
</child>
</object>
- <object class="GtkVBox" id="dict:add_extra_vbox">
+ <object class="GtkBox" id="dict:add_extra_vbox">
<property name="visible">True</property>
+ <property name="orientation">vertical</property>
<property name="no_show_all">True</property>
<property name="spacing">10</property>
<child>
@@ -2800,8 +2809,8 @@
<property name="program-name">IBus-Anthy</property>
<property name="copyright">Copyright © 20072008 Peng Huang
Copyright © 2009 Hideaki ABE
-Copyright © 20092013 Takao Fujiwara
-Copyright © 20072013 Red Hat, Inc.</property>
+Copyright © 20092014 Takao Fujiwara
+Copyright © 20072014 Red Hat, Inc.</property>
<property name="comments" translatable="yes">The Anthy engine for the IBus input platform</property>
<property name="license">GPL</property>
<property name="website">http://code.google.com/p/ibus/</property>
--
1.8.0
From 4d605b873bf4b0af2a337cd076175c8d0a703346 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Thu, 27 Feb 2014 18:32:01 +0900
Subject: [PATCH] Added another status icon for input mode.
---
engine/python2/Makefile.am | 5 +-
engine/python2/engine.py | 94 ++++++++-
engine/python2/propertyicon.py | 81 ++++++++
engine/python3/Makefile.am | 5 +-
engine/python3/engine.py | 92 ++++++++-
engine/python3/propertyicon.py | 81 ++++++++
po/ibus-anthy.pot | 426 +++++++++++++++++++++--------------------
setup/python2/anthyprefs.py.in | 6 +-
setup/python2/main.py | 6 +-
setup/python2/prefs.py | 32 +++-
setup/python2/setup.ui | 19 +-
setup/python3/anthyprefs.py.in | 2 +
setup/python3/main.py | 6 +-
setup/python3/prefs.py | 28 ++-
setup/python3/setup.ui | 19 +-
15 files changed, 658 insertions(+), 244 deletions(-)
create mode 100644 engine/python2/propertyicon.py
create mode 100644 engine/python3/propertyicon.py
diff --git a/engine/python2/Makefile.am b/engine/python2/Makefile.am
index a96f831..965d534 100644
--- a/engine/python2/Makefile.am
+++ b/engine/python2/Makefile.am
@@ -3,8 +3,8 @@
# ibus-anthy - The Anthy engine for IBus
#
# Copyright (c) 2007-2008 Peng Huang <shawn.p.huang@gmail.com>
-# Copyright (c) 2010-2013 Takao Fujiwara <takao.fujiwara1@gmail.com>
-# Copyright (c) 2007-2013 Red Hat, Inc.
+# Copyright (c) 2010-2014 Takao Fujiwara <takao.fujiwara1@gmail.com>
+# Copyright (c) 2007-2014 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,6 +29,7 @@ engine_anthy_PYTHON = \
jastring.py \
kana.py \
main.py \
+ propertyicon.py \
romaji.py \
segment.py \
tables.py \
diff --git a/engine/python2/engine.py b/engine/python2/engine.py
index 90a5750..c7a6fb3 100644
--- a/engine/python2/engine.py
+++ b/engine/python2/engine.py
@@ -4,8 +4,8 @@
# ibus-anthy - The Anthy engine for IBus
#
# Copyright (c) 2007-2008 Peng Huang <shawn.p.huang@gmail.com>
-# Copyright (c) 2010-2013 Takao Fujiwara <takao.fujiwara1@gmail.com>
-# Copyright (c) 2007-2013 Red Hat, Inc.
+# Copyright (c) 2010-2014 Takao Fujiwara <takao.fujiwara1@gmail.com>
+# Copyright (c) 2007-2014 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -35,6 +35,7 @@ try:
except:
pass
+from gi.repository import Gio
from gi.repository import GLib
from gi.repository import IBus
@@ -117,6 +118,7 @@ class Engine(IBus.EngineSimple):
__keybind = {}
__thumb = None
__latin_with_shift = True
+ __input_mode_icon = None
def __init__(self, bus, object_path):
super(Engine, self).__init__(engine_name="anthy",
@@ -170,6 +172,8 @@ class Engine(IBus.EngineSimple):
ibus_config.connect('value-changed',
self.__config_value_changed_cb)
+ self.__run_input_mode_icon()
+
def __get_ibus_version(self):
if self.__ibus_version == 0.0:
self.__ibus_version = \
@@ -258,6 +262,73 @@ class Engine(IBus.EngineSimple):
signal.signal(signum, signal.SIG_DFL)
os.kill(os.getpid(), signum)
+ def __is_gnome_shell_running(self):
+ connection = None
+ variant = None
+
+ try:
+ connection = Gio.bus_get_sync(Gio.BusType.SESSION, None)
+ variant = connection.call_sync('org.gnome.Shell',
+ '/org/gnome/Shell',
+ 'org.freedesktop.DBus.Peer',
+ 'Ping',
+ None,
+ None,
+ Gio.DBusCallFlags.NONE,
+ -1,
+ None)
+ except GLib.GError as e:
+ pass
+
+ if connection != None:
+ try:
+ connection.flush_sync(None)
+ except GLib.GError as e:
+ printerr('GDBusConnection flush failed: ' + str(e))
+
+ if variant == None:
+ return False
+ return True
+
+ def __run_input_mode_icon(self):
+ self.__input_mode_icon = None
+
+ if self.__is_gnome_shell_running():
+ return
+ try:
+ from gi.repository import Gdk
+ if Gdk.Display.get_default() == None:
+ return
+ except Exception as e:
+ printerr('import Gdk failed: ' + str(e))
+ return
+
+ if not self.__prefs.get_value('common', 'show-input-mode-icon'):
+ return
+
+ rgba = Gdk.RGBA(red = 0.0, green = 0.0, blue = 0.0, alpha = 1.0)
+ spec = self.__prefs.get_value('common', 'icon-str-rgba')
+ if not rgba.parse(spec):
+ printerr('invalid icon-str-rgba: %s' % spec)
+ rgba = Gdk.RGBA(red = 0.0, green = 0.0, blue = 0.0, alpha = 1.0)
+
+ modes = {
+ INPUT_MODE_HIRAGANA : 'あ',
+ INPUT_MODE_KATAKANA : 'ア',
+ INPUT_MODE_HALF_WIDTH_KATAKANA : '_ア',
+ INPUT_MODE_LATIN : '_A',
+ INPUT_MODE_WIDE_LATIN : '',
+ }
+
+ try:
+ import propertyicon
+ self.__input_mode_icon = propertyicon.PropertyIcon(rgba)
+ self.__input_mode_icon.set_visible(True)
+ self.__input_mode_icon.set_from_symbol(modes[self.__input_mode])
+ except Exception as e:
+ printerr('import PropertyIcon failed: ' + str(e))
+ return
+
def __set_input_mode_props(self, anthy_props):
# The class method is kept even if the engine is switched.
if Engine.__input_mode == None:
@@ -847,6 +918,9 @@ class Engine(IBus.EngineSimple):
prop.set_label(IBus.Text.new_from_string(label))
self.update_property(prop)
+ if self.__input_mode_icon != None:
+ self.__input_mode_icon.set_from_symbol(symbol)
+
self.__reset()
self.__invalidate()
@@ -1030,6 +1104,7 @@ class Engine(IBus.EngineSimple):
# It seems do_destroy() is called when launch_engine() is called.
#self.__remove_dict_files()
# It seems super.destroy() does not unref the engine.
+ self.__input_mode_icon = None
def __join_all_segments(self):
while True:
@@ -1109,7 +1184,7 @@ class Engine(IBus.EngineSimple):
# fill lookup_table
self.__lookup_table.clear()
- for i in xrange(0, seg_stat.nr_predictions):
+ for i in xrange(0, nr_predictions):
buf = self.__context.get_prediction(i)
candidate = UN(buf)
self.__lookup_table.append_candidate(IBus.Text.new_from_string(candidate))
@@ -1220,6 +1295,12 @@ class Engine(IBus.EngineSimple):
def __update_anthy_convert_chars(self):
self.__convert_chars = u''
pos = 0
+
+ (seg_index, text) = self.__segments[self.__cursor_pos]
+ # prediction lookup window + BackSpace will return None
+ if text == None:
+ return
+
for i, (seg_index, text) in enumerate(self.__segments):
self.__convert_chars += text
if i < self.__cursor_pos:
@@ -2110,6 +2191,13 @@ class Engine(IBus.EngineSimple):
self.__fetch_dict_values(base_sec)
self.__prefs.set_value(base_sec, name, value)
self.__set_dict_mode_props(self.__prop_list, True)
+ elif base_sec == 'common':
+ if name == 'show_input_mode_icon':
+ name = 'show-input-mode-icon'
+ self.__prefs.set_value(base_sec, name, value)
+ self.__run_input_mode_icon()
+ else:
+ self.__prefs.set_value(base_sec, name, value)
elif base_sec:
self.__prefs.set_value(base_sec, name, value)
else:
diff --git a/engine/python2/propertyicon.py b/engine/python2/propertyicon.py
new file mode 100644
index 0000000..fa5f34f
--- /dev/null
+++ b/engine/python2/propertyicon.py
@@ -0,0 +1,81 @@
+# vim:set et sts=4 sw=4:
+# -*- coding: utf-8 -*-
+#
+# ibus-anthy - The Anthy engine for IBus
+#
+# Copyright (c) 2014 Takao Fujiwara <takao.fujiwara1@gmail.com>
+# Copyright (c) 2014 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+# for python2
+from __future__ import print_function
+
+import cairo
+import sys
+
+from gi.repository import Gdk
+from gi.repository import Gio
+from gi.repository import GLib
+from gi.repository import Gtk
+from gi.repository import Pango
+from gi.repository import PangoCairo
+
+class PropertyIcon(Gtk.StatusIcon):
+ __xkb_icon_pixbufs = {}
+ __xkb_icon_rgba = None
+
+ def __init__(self, rgba):
+ super(Gtk.StatusIcon, self).__init__()
+ self.__xkb_icon_rgba = rgba
+
+ def __context_render_string(self, cr, symbol, image_width, image_height):
+ lwidth = 0
+ lheight = 0
+ desc = Pango.FontDescription.from_string('Monospace Bold 22')
+ layout = PangoCairo.create_layout(cr)
+
+ layout.set_font_description(desc)
+ layout.set_text(symbol, -1)
+ (lwidth, lheight) = layout.get_size()
+ cr.move_to((image_width - lwidth / Pango.SCALE) / 2,
+ (image_height - lheight / Pango.SCALE) / 2)
+ cr.set_source_rgba(self.__xkb_icon_rgba.red,
+ self.__xkb_icon_rgba.green,
+ self.__xkb_icon_rgba.blue,
+ self.__xkb_icon_rgba.alpha)
+ PangoCairo.show_layout(cr, layout)
+
+ def __create_icon_pixbuf_with_string(self, symbol):
+ if symbol in self.__xkb_icon_pixbufs:
+ return self.__xkb_icon_pixbufs[symbol]
+
+ image = cairo.ImageSurface(cairo.FORMAT_ARGB32, 48, 48)
+ cr = cairo.Context(image)
+ width = image.get_width()
+ height = image.get_height()
+
+ cr.set_source_rgba(0.0, 0.0, 0.0, 0.0)
+ cr.set_operator(cairo.OPERATOR_SOURCE)
+ cr.paint()
+ cr.set_operator(cairo.OPERATOR_OVER)
+ self.__context_render_string(cr, symbol, width, height)
+ pixbuf = Gdk.pixbuf_get_from_surface(image, 0, 0, width, height)
+ self.__xkb_icon_pixbufs[symbol] = pixbuf
+ return pixbuf
+
+ def set_from_symbol(self, symbol):
+ pixbuf = self.__create_icon_pixbuf_with_string(symbol)
+ self.set_from_pixbuf(pixbuf)
diff --git a/engine/python3/Makefile.am b/engine/python3/Makefile.am
index a96f831..965d534 100644
--- a/engine/python3/Makefile.am
+++ b/engine/python3/Makefile.am
@@ -3,8 +3,8 @@
# ibus-anthy - The Anthy engine for IBus
#
# Copyright (c) 2007-2008 Peng Huang <shawn.p.huang@gmail.com>
-# Copyright (c) 2010-2013 Takao Fujiwara <takao.fujiwara1@gmail.com>
-# Copyright (c) 2007-2013 Red Hat, Inc.
+# Copyright (c) 2010-2014 Takao Fujiwara <takao.fujiwara1@gmail.com>
+# Copyright (c) 2007-2014 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,6 +29,7 @@ engine_anthy_PYTHON = \
jastring.py \
kana.py \
main.py \
+ propertyicon.py \
romaji.py \
segment.py \
tables.py \
diff --git a/engine/python3/engine.py b/engine/python3/engine.py
index 7eadf23..6563087 100644
--- a/engine/python3/engine.py
+++ b/engine/python3/engine.py
@@ -36,6 +36,7 @@ try:
except:
pass
+from gi.repository import Gio
from gi.repository import GLib
from gi.repository import IBus
@@ -118,6 +119,7 @@ class Engine(IBus.EngineSimple):
__keybind = {}
__thumb = None
__latin_with_shift = True
+ __input_mode_icon = None
def __init__(self, bus, object_path):
super(Engine, self).__init__(engine_name="anthy",
@@ -171,6 +173,8 @@ class Engine(IBus.EngineSimple):
ibus_config.connect('value-changed',
self.__config_value_changed_cb)
+ self.__run_input_mode_icon()
+
def __get_ibus_version(self):
if self.__ibus_version == 0.0:
self.__ibus_version = \
@@ -259,6 +263,73 @@ class Engine(IBus.EngineSimple):
signal.signal(signum, signal.SIG_DFL)
os.kill(os.getpid(), signum)
+ def __is_gnome_shell_running(self):
+ connection = None
+ variant = None
+
+ try:
+ connection = Gio.bus_get_sync(Gio.BusType.SESSION, None)
+ variant = connection.call_sync('org.gnome.Shell',
+ '/org/gnome/Shell',
+ 'org.freedesktop.DBus.Peer',
+ 'Ping',
+ None,
+ None,
+ Gio.DBusCallFlags.NONE,
+ -1,
+ None)
+ except GLib.GError as e:
+ pass
+
+ if connection != None:
+ try:
+ connection.flush_sync(None)
+ except GLib.GError as e:
+ printerr('GDBusConnection flush failed: ' + str(e))
+
+ if variant == None:
+ return False
+ return True
+
+ def __run_input_mode_icon(self):
+ self.__input_mode_icon = None
+
+ if self.__is_gnome_shell_running():
+ return
+ try:
+ from gi.repository import Gdk
+ if Gdk.Display.get_default() == None:
+ return
+ except Exception as e:
+ printerr('import Gdk failed: ' + str(e))
+ return
+
+ if not self.__prefs.get_value('common', 'show-input-mode-icon'):
+ return
+
+ rgba = Gdk.RGBA(red = 0.0, green = 0.0, blue = 0.0, alpha = 1.0)
+ spec = self.__prefs.get_value('common', 'icon-str-rgba')
+ if not rgba.parse(spec):
+ printerr('invalid icon-str-rgba: %s' % spec)
+ rgba = Gdk.RGBA(red = 0.0, green = 0.0, blue = 0.0, alpha = 1.0)
+
+ modes = {
+ INPUT_MODE_HIRAGANA : 'あ',
+ INPUT_MODE_KATAKANA : 'ア',
+ INPUT_MODE_HALF_WIDTH_KATAKANA : '_ア',
+ INPUT_MODE_LATIN : '_A',
+ INPUT_MODE_WIDE_LATIN : '',
+ }
+
+ try:
+ import propertyicon
+ self.__input_mode_icon = propertyicon.PropertyIcon(rgba)
+ self.__input_mode_icon.set_visible(True)
+ self.__input_mode_icon.set_from_symbol(modes[self.__input_mode])
+ except Exception as e:
+ printerr('import PropertyIcon failed: ' + str(e))
+ return
+
def __set_input_mode_props(self, anthy_props):
# The class method is kept even if the engine is switched.
if Engine.__input_mode == None:
@@ -842,6 +913,9 @@ class Engine(IBus.EngineSimple):
prop.set_label(IBus.Text.new_from_string(label))
self.update_property(prop)
+ if self.__input_mode_icon != None:
+ self.__input_mode_icon.set_from_symbol(symbol)
+
self.__reset()
self.__invalidate()
@@ -1025,6 +1099,7 @@ class Engine(IBus.EngineSimple):
# It seems do_destroy() is called when launch_engine() is called.
#self.__remove_dict_files()
# It seems super.destroy() does not unref the engine.
+ self.__input_mode_icon = None
def __join_all_segments(self):
while True:
@@ -1104,7 +1179,7 @@ class Engine(IBus.EngineSimple):
# fill lookup_table
self.__lookup_table.clear()
- for i in range(0, seg_stat.nr_predictions):
+ for i in range(0, nr_predictions):
buf = self.__context.get_prediction(i)
candidate = buf
self.__lookup_table.append_candidate(IBus.Text.new_from_string(candidate))
@@ -1215,6 +1290,12 @@ class Engine(IBus.EngineSimple):
def __update_anthy_convert_chars(self):
self.__convert_chars = ''
pos = 0
+
+ (seg_index, text) = self.__segments[self.__cursor_pos]
+ # prediction lookup window + BackSpace will return None
+ if text == None:
+ return
+
for i, (seg_index, text) in enumerate(self.__segments):
self.__convert_chars += text
if i < self.__cursor_pos:
@@ -2104,6 +2185,13 @@ class Engine(IBus.EngineSimple):
self.__fetch_dict_values(base_sec)
self.__prefs.set_value(base_sec, name, value)
self.__set_dict_mode_props(self.__prop_list, True)
+ elif base_sec == 'common':
+ if name == 'show_input_mode_icon':
+ name = 'show-input-mode-icon'
+ self.__prefs.set_value(base_sec, name, value)
+ self.__run_input_mode_icon()
+ else:
+ self.__prefs.set_value(base_sec, name, value)
elif base_sec:
self.__prefs.set_value(base_sec, name, value)
else:
@@ -2312,7 +2400,7 @@ class Engine(IBus.EngineSimple):
nr_predictions = self.__context.get_nr_predictions()
# for i in range(nr_predictions):
-# print self.__context.get_prediction(i)
+# print(self.__context.get_prediction(i))
buf = self.__context.get_prediction(0)
if not buf:
diff --git a/engine/python3/propertyicon.py b/engine/python3/propertyicon.py
new file mode 100644
index 0000000..fa5f34f
--- /dev/null
+++ b/engine/python3/propertyicon.py
@@ -0,0 +1,81 @@
+# vim:set et sts=4 sw=4:
+# -*- coding: utf-8 -*-
+#
+# ibus-anthy - The Anthy engine for IBus
+#
+# Copyright (c) 2014 Takao Fujiwara <takao.fujiwara1@gmail.com>
+# Copyright (c) 2014 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+# for python2
+from __future__ import print_function
+
+import cairo
+import sys
+
+from gi.repository import Gdk
+from gi.repository import Gio
+from gi.repository import GLib
+from gi.repository import Gtk
+from gi.repository import Pango
+from gi.repository import PangoCairo
+
+class PropertyIcon(Gtk.StatusIcon):
+ __xkb_icon_pixbufs = {}
+ __xkb_icon_rgba = None
+
+ def __init__(self, rgba):
+ super(Gtk.StatusIcon, self).__init__()
+ self.__xkb_icon_rgba = rgba
+
+ def __context_render_string(self, cr, symbol, image_width, image_height):
+ lwidth = 0
+ lheight = 0
+ desc = Pango.FontDescription.from_string('Monospace Bold 22')
+ layout = PangoCairo.create_layout(cr)
+
+ layout.set_font_description(desc)
+ layout.set_text(symbol, -1)
+ (lwidth, lheight) = layout.get_size()
+ cr.move_to((image_width - lwidth / Pango.SCALE) / 2,
+ (image_height - lheight / Pango.SCALE) / 2)
+ cr.set_source_rgba(self.__xkb_icon_rgba.red,
+ self.__xkb_icon_rgba.green,
+ self.__xkb_icon_rgba.blue,
+ self.__xkb_icon_rgba.alpha)
+ PangoCairo.show_layout(cr, layout)
+
+ def __create_icon_pixbuf_with_string(self, symbol):
+ if symbol in self.__xkb_icon_pixbufs:
+ return self.__xkb_icon_pixbufs[symbol]
+
+ image = cairo.ImageSurface(cairo.FORMAT_ARGB32, 48, 48)
+ cr = cairo.Context(image)
+ width = image.get_width()
+ height = image.get_height()
+
+ cr.set_source_rgba(0.0, 0.0, 0.0, 0.0)
+ cr.set_operator(cairo.OPERATOR_SOURCE)
+ cr.paint()
+ cr.set_operator(cairo.OPERATOR_OVER)
+ self.__context_render_string(cr, symbol, width, height)
+ pixbuf = Gdk.pixbuf_get_from_surface(image, 0, 0, width, height)
+ self.__xkb_icon_pixbufs[symbol] = pixbuf
+ return pixbuf
+
+ def set_from_symbol(self, symbol):
+ pixbuf = self.__create_icon_pixbuf_with_string(symbol)
+ self.set_from_pixbuf(pixbuf)
diff --git a/setup/python2/anthyprefs.py.in b/setup/python2/anthyprefs.py.in
index a685da1..883fb23 100644
--- a/setup/python2/anthyprefs.py.in
+++ b/setup/python2/anthyprefs.py.in
@@ -5,8 +5,8 @@
#
# Copyright (c) 2007-2008 Peng Huang <shawn.p.huang@gmail.com>
# Copyright (c) 2009 Hideaki ABE <abe.sendai@gmail.com>
-# Copyright (c) 2010-2013 Takao Fujiwara <takao.fujiwara1@gmail.com>
-# Copyright (c) 2007-2013 Red Hat, Inc.
+# Copyright (c) 2010-2014 Takao Fujiwara <takao.fujiwara1@gmail.com>
+# Copyright (c) 2007-2014 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -362,6 +362,8 @@ _config = {
'show-dict-mode': True,
'show-dict-config': False,
'show-preferences': True,
+ 'show-input-mode-icon': True,
+ 'icon-str-rgba': '#41507a',
'period_style': 0,
'symbol_style': 1,
diff --git a/setup/python2/main.py b/setup/python2/main.py
index 7c403b8..0e7c62e 100644
--- a/setup/python2/main.py
+++ b/setup/python2/main.py
@@ -144,7 +144,8 @@ class AnthySetup(object):
'half_width_symbol', 'half_width_number', 'half_width_space',
'latin_with_shift',
'thumb:keyboard_layout_mode', 'thumb:keyboard_layout',
- 'thumb:fmv_extension', 'thumb:handakuten']:
+ 'thumb:fmv_extension', 'thumb:handakuten',
+ 'show_input_mode_icon']:
section, key = self.__get_section_key(name)
builder.get_object(name).set_active(prefs.get_value(section, key))
@@ -322,6 +323,9 @@ class AnthySetup(object):
else:
section = 'common'
key = name
+ if section == 'common':
+ if name == 'show_input_mode_icon':
+ key = 'show-input-mode-icon'
return (section, key)
def __run_message_dialog(self, message, type=Gtk.MessageType.INFO):
diff --git a/setup/python2/prefs.py b/setup/python2/prefs.py
index 1b88908..9a147ee 100644
--- a/setup/python2/prefs.py
+++ b/setup/python2/prefs.py
@@ -4,8 +4,8 @@
#
# Copyright (c) 2007-2008 Peng Huang <shawn.p.huang@gmail.com>
# Copyright (c) 2009 Hideaki ABE <abe.sendai@gmail.com>
-# Copyright (c) 2010-2013 Takao Fujiwara <takao.fujiwara1@gmail.com>
-# Copyright (c) 2007-2013 Red Hat, Inc.
+# Copyright (c) 2010-2014 Takao Fujiwara <takao.fujiwara1@gmail.com>
+# Copyright (c) 2007-2014 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -145,15 +145,27 @@ class Prefs(object):
variant = self._config.get_values(s)
for key in variant.keys():
v = variant[key]
+ # FIXME: ibus-dconf converts the keys.
+ #if key.find('_') >= 0:
+ # key = key.replace('_', '-')
+ if section == 'common':
+ if key == 'show_input_mode':
+ key = 'show-input-mode'
+ elif key == 'show_typing_method':
+ key = 'show-typing-method'
+ elif key == 'show_segment_mode':
+ key = 'show-segment-mode'
+ elif key == 'show_dict_mode':
+ key = 'show-dict-mode'
+ elif key == 'show_dict_config':
+ key = 'show-dict-config'
+ elif key == 'show_preferences':
+ key = 'show-preferences'
+ elif key == 'show_input_mode_icon':
+ key = 'show-input-mode-icon'
+ elif key == 'icon_str_rgba':
+ key = 'icon-str-rgba'
self.modified.setdefault(section, {})[key] = v if v != [''] else []
- # FIXME: ibus-dconf converts the keys.
- if section == 'common':
- self.fetch_item(section, 'show-input-mode')
- self.fetch_item(section, 'show-typing-method')
- self.fetch_item(section, 'show-segment-mode')
- self.fetch_item(section, 'show-dict-mode')
- self.fetch_item(section, 'show-dict-config')
- self.fetch_item(section, 'show-preferences')
def fetch_item(self, section, key, readonly=False):
if self._config == None:
diff --git a/setup/python2/setup.ui b/setup/python2/setup.ui
index dc5e7e1..edd6cfa 100644
--- a/setup/python2/setup.ui
+++ b/setup/python2/setup.ui
@@ -346,6 +346,23 @@
</packing>
</child>
<child>
+ <object class="GtkCheckButton" id="show_input_mode_icon">
+ <property name="label" translatable="yes">_Show input mode icon</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ <signal handler="on_ck_toggled" name="toggled"/>
+ <accelerator key="S" modifiers="GDK_MOD1_MASK" signal="grab_focus"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkFrame" id="frame12">
<property name="visible">True</property>
<property name="label_xalign">0</property>
@@ -396,7 +413,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">1</property>
+ <property name="position">2</property>
</packing>
</child>
</object>
diff --git a/setup/python3/anthyprefs.py.in b/setup/python3/anthyprefs.py.in
index 53c9d1d..b9032f2 100644
--- a/setup/python3/anthyprefs.py.in
+++ b/setup/python3/anthyprefs.py.in
@@ -355,6 +355,8 @@ _config = {
'show-dict-mode': True,
'show-dict-config': False,
'show-preferences': True,
+ 'show-input-mode-icon': True,
+ 'icon-str-rgba': '#41507a',
'period_style': 0,
'symbol_style': 1,
diff --git a/setup/python3/main.py b/setup/python3/main.py
index 2073f59..f70bc1f 100644
--- a/setup/python3/main.py
+++ b/setup/python3/main.py
@@ -147,7 +147,8 @@ class AnthySetup(object):
'half_width_symbol', 'half_width_number', 'half_width_space',
'latin_with_shift',
'thumb:keyboard_layout_mode', 'thumb:keyboard_layout',
- 'thumb:fmv_extension', 'thumb:handakuten']:
+ 'thumb:fmv_extension', 'thumb:handakuten',
+ 'show_input_mode_icon']:
section, key = self.__get_section_key(name)
builder.get_object(name).set_active(prefs.get_value(section, key))
@@ -325,6 +326,9 @@ class AnthySetup(object):
else:
section = 'common'
key = name
+ if section == 'common':
+ if name == 'show_input_mode_icon':
+ key = 'show-input-mode-icon'
return (section, key)
def __run_message_dialog(self, message, type=Gtk.MessageType.INFO):
diff --git a/setup/python3/prefs.py b/setup/python3/prefs.py
index a4af88d..2b3f4ea 100644
--- a/setup/python3/prefs.py
+++ b/setup/python3/prefs.py
@@ -145,15 +145,27 @@ class Prefs(object):
variant = self._config.get_values(s)
for key in list(variant.keys()):
v = variant[key]
+ # FIXME: ibus-dconf converts the keys.
+ #if key.find('_') >= 0:
+ # key = key.replace('_', '-')
+ if section == 'common':
+ if key == 'show_input_mode':
+ key = 'show-input-mode'
+ elif key == 'show_typing_method':
+ key = 'show-typing-method'
+ elif key == 'show_segment_mode':
+ key = 'show-segment-mode'
+ elif key == 'show_dict_mode':
+ key = 'show-dict-mode'
+ elif key == 'show_dict_config':
+ key = 'show-dict-config'
+ elif key == 'show_preferences':
+ key = 'show-preferences'
+ elif key == 'show_input_mode_icon':
+ key = 'show-input-mode-icon'
+ elif key == 'icon_str_rgba':
+ key = 'icon-str-rgba'
self.modified.setdefault(section, {})[key] = v if v != [''] else []
- # FIXME: ibus-dconf converts the keys.
- if section == 'common':
- self.fetch_item(section, 'show-input-mode')
- self.fetch_item(section, 'show-typing-method')
- self.fetch_item(section, 'show-segment-mode')
- self.fetch_item(section, 'show-dict-mode')
- self.fetch_item(section, 'show-dict-config')
- self.fetch_item(section, 'show-preferences')
def fetch_item(self, section, key, readonly=False):
if self._config == None:
diff --git a/setup/python3/setup.ui b/setup/python3/setup.ui
index dc5e7e1..edd6cfa 100644
--- a/setup/python3/setup.ui
+++ b/setup/python3/setup.ui
@@ -346,6 +346,23 @@
</packing>
</child>
<child>
+ <object class="GtkCheckButton" id="show_input_mode_icon">
+ <property name="label" translatable="yes">_Show input mode icon</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ <signal handler="on_ck_toggled" name="toggled"/>
+ <accelerator key="S" modifiers="GDK_MOD1_MASK" signal="grab_focus"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkFrame" id="frame12">
<property name="visible">True</property>
<property name="label_xalign">0</property>
@@ -396,7 +413,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">1</property>
+ <property name="position">2</property>
</packing>
</child>
</object>
--
1.8.0
From c13d52a823ee2b084e57bde3859ead64f94bd437 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Mon, 21 Apr 2014 17:05:19 +0900
Subject: [PATCH] Fix to unref pixbuf when propery icon is unrefed.
---
engine/python2/engine.py | 1 +
engine/python2/propertyicon.py | 6 ++++++
engine/python3/engine.py | 1 +
engine/python3/propertyicon.py | 6 ++++++
4 files changed, 14 insertions(+)
diff --git a/engine/python2/engine.py b/engine/python2/engine.py
index c7a6fb3..68a4b48 100644
--- a/engine/python2/engine.py
+++ b/engine/python2/engine.py
@@ -1104,6 +1104,7 @@ class Engine(IBus.EngineSimple):
# It seems do_destroy() is called when launch_engine() is called.
#self.__remove_dict_files()
# It seems super.destroy() does not unref the engine.
+ self.__input_mode_icon.clear()
self.__input_mode_icon = None
def __join_all_segments(self):
diff --git a/engine/python2/propertyicon.py b/engine/python2/propertyicon.py
index fa5f34f..437e94c 100644
--- a/engine/python2/propertyicon.py
+++ b/engine/python2/propertyicon.py
@@ -76,6 +76,12 @@ class PropertyIcon(Gtk.StatusIcon):
self.__xkb_icon_pixbufs[symbol] = pixbuf
return pixbuf
+ def clear(self):
+ self.set_from_icon_name('')
+ self.set_visible(False)
+ self.__xkb_icon_pixbufs = {}
+ self.__xkb_icon_rgba = None
+
def set_from_symbol(self, symbol):
pixbuf = self.__create_icon_pixbuf_with_string(symbol)
self.set_from_pixbuf(pixbuf)
diff --git a/engine/python3/engine.py b/engine/python3/engine.py
index 6563087..67370d8 100644
--- a/engine/python3/engine.py
+++ b/engine/python3/engine.py
@@ -1099,6 +1099,7 @@ class Engine(IBus.EngineSimple):
# It seems do_destroy() is called when launch_engine() is called.
#self.__remove_dict_files()
# It seems super.destroy() does not unref the engine.
+ self.__input_mode_icon.clear()
self.__input_mode_icon = None
def __join_all_segments(self):
diff --git a/engine/python3/propertyicon.py b/engine/python3/propertyicon.py
index fa5f34f..437e94c 100644
--- a/engine/python3/propertyicon.py
+++ b/engine/python3/propertyicon.py
@@ -76,6 +76,12 @@ class PropertyIcon(Gtk.StatusIcon):
self.__xkb_icon_pixbufs[symbol] = pixbuf
return pixbuf
+ def clear(self):
+ self.set_from_icon_name('')
+ self.set_visible(False)
+ self.__xkb_icon_pixbufs = {}
+ self.__xkb_icon_rgba = None
+
def set_from_symbol(self, symbol):
pixbuf = self.__create_icon_pixbuf_with_string(symbol)
self.set_from_pixbuf(pixbuf)
--
1.8.5.3
From b852cfb6061259e4fd7198e3a2579b4495e15ecd Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Mon, 19 May 2014 12:01:22 +0900
Subject: [PATCH] Fix None object has clear() in input mode icon. (#1097364)
---
engine/python2/engine.py | 3 ++-
engine/python3/engine.py | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/engine/python2/engine.py b/engine/python2/engine.py
index 68a4b48..68e898b 100644
--- a/engine/python2/engine.py
+++ b/engine/python2/engine.py
@@ -1104,7 +1104,8 @@ class Engine(IBus.EngineSimple):
# It seems do_destroy() is called when launch_engine() is called.
#self.__remove_dict_files()
# It seems super.destroy() does not unref the engine.
- self.__input_mode_icon.clear()
+ if self.__input_mode_icon != None:
+ self.__input_mode_icon.clear()
self.__input_mode_icon = None
def __join_all_segments(self):
diff --git a/engine/python3/engine.py b/engine/python3/engine.py
index 67370d8..517a64a 100644
--- a/engine/python3/engine.py
+++ b/engine/python3/engine.py
@@ -1099,7 +1099,8 @@ class Engine(IBus.EngineSimple):
# It seems do_destroy() is called when launch_engine() is called.
#self.__remove_dict_files()
# It seems super.destroy() does not unref the engine.
- self.__input_mode_icon.clear()
+ if self.__input_mode_icon != None:
+ self.__input_mode_icon.clear()
self.__input_mode_icon = None
def __join_all_segments(self):
--
1.8.5.3