summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfujiwarat <takao.fujiwara1@gmail.com>2014-02-18 15:07:35 +0900
committerfujiwarat <takao.fujiwara1@gmail.com>2014-02-18 15:07:35 +0900
commit5c25f8c6218847f56829338479d4f1af866fa6f2 (patch)
tree36fdc1cdde6e57c668e8acacd33619eea7ce70ad
parent02f18ee424e14cbe592fbb293097fd8a7f0f0324 (diff)
Fix deprecated GtkStock in ibus-setup
Review URL: https://codereview.appspot.com/65300043
-rw-r--r--setup/engineabout.py19
-rw-r--r--setup/keyboardshortcut.py24
-rw-r--r--setup/main.py4
3 files changed, 28 insertions, 19 deletions
diff --git a/setup/engineabout.py b/setup/engineabout.py
index 897ca69b..50ab001b 100644
--- a/setup/engineabout.py
+++ b/setup/engineabout.py
@@ -2,8 +2,8 @@
#
# ibus - The Input Bus
#
-# Copyright (c) 2007-2010 Peng Huang <shawn.p.huang@gmail.com>
-# Copyright (c) 2007-2010 Red Hat, Inc.
+# Copyright (c) 2007-2014 Peng Huang <shawn.p.huang@gmail.com>
+# Copyright (c) 2007-2014 Red Hat, Inc.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -33,7 +33,7 @@ class EngineAbout(Gtk.Dialog):
self.__engine_desc = enginedesc
super(EngineAbout, self).__init__(_("About"), None,
Gtk.DialogFlags.MODAL,
- (Gtk.STOCK_CLOSE, Gtk.ResponseType.CLOSE))
+ (_("_Close"), Gtk.ResponseType.CLOSE))
self.__init_ui()
@@ -99,14 +99,19 @@ class EngineAbout(Gtk.Dialog):
text_buffer.create_tag("left_margin_32",
left_margin=32)
- def __load_icon(self, icon):
+ def __load_icon(self, icon_name):
try:
- pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(icon, 48, 48, True)
+ pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(icon_name,
+ 48,
+ 48,
+ True)
except:
theme = Gtk.IconTheme.get_default()
- icon = theme.lookup_icon("ibus-engine", 48, 0)
+ icon = theme.lookup_icon(icon_name, 48, 0)
if icon == None:
- icon = theme.lookup_icon(Gtk.STOCK_MISSING_IMAGE, 48, 0)
+ icon = theme.lookup_icon("ibus-engine", 48, 0)
+ if icon == None:
+ icon = theme.lookup_icon("image-missing", 48, 0)
pixbuf = icon.load_icon()
return pixbuf
diff --git a/setup/keyboardshortcut.py b/setup/keyboardshortcut.py
index 26bd77fc..d82fea86 100644
--- a/setup/keyboardshortcut.py
+++ b/setup/keyboardshortcut.py
@@ -35,9 +35,10 @@ from i18n import _, N_
MAX_HOTKEY = 6
-class KeyboardShortcutSelection(Gtk.VBox):
+class KeyboardShortcutSelection(Gtk.Box):
def __init__(self, shortcuts = None):
- super(KeyboardShortcutSelection, self).__init__()
+ super(KeyboardShortcutSelection, self).__init__(
+ orientation=Gtk.Orientation.VERTICAL)
self.__init_ui()
self.set_shortcuts(shortcuts)
@@ -61,7 +62,7 @@ class KeyboardShortcutSelection(Gtk.VBox):
self.pack_start(scrolledwindow, True, True, 4)
# key code
- hbox = Gtk.HBox()
+ hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
label = Gtk.Label(_("Key code:"))
label.set_justify(Gtk.Justification.LEFT)
label.set_alignment(0.0, 0.5)
@@ -76,7 +77,7 @@ class KeyboardShortcutSelection(Gtk.VBox):
self.pack_start(hbox, False, True, 4)
# modifiers
- hbox = Gtk.HBox()
+ hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
label = Gtk.Label(_("Modifiers:"))
label.set_justify(Gtk.Justification.LEFT)
label.set_alignment(0.0, 0.5)
@@ -121,19 +122,22 @@ class KeyboardShortcutSelection(Gtk.VBox):
self.pack_start(hbox, False, True, 4)
# buttons
- hbox = Gtk.HBox()
+ hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
# add button
- self.__add_button = Gtk.Button(stock = Gtk.STOCK_ADD)
+ self.__add_button = Gtk.Button(label = _("_Add"),
+ use_underline = True)
self.__add_button.set_sensitive(False)
self.__add_button.connect("clicked", self.__add_button_clicked_cb)
hbox.pack_start(self.__add_button, False, True, 0)
# apply button
- self.__apply_button = Gtk.Button(stock = Gtk.STOCK_APPLY)
+ self.__apply_button = Gtk.Button(label = _("_Apply"),
+ use_underline = True)
self.__apply_button.set_sensitive(False)
self.__apply_button.connect("clicked", self.__apply_button_clicked_cb)
hbox.pack_start(self.__apply_button, False, True, 0)
# delete button
- self.__delete_button = Gtk.Button(stock = Gtk.STOCK_DELETE)
+ self.__delete_button = Gtk.Button(label = _("_Delete"),
+ use_underline = True)
self.__delete_button.set_sensitive(False)
self.__delete_button.connect("clicked", self.__delete_button_clicked_cb)
hbox.pack_start(self.__delete_button, False, True, 0)
@@ -331,8 +335,8 @@ class KeyboardShortcutSelectionDialog(Gtk.Dialog):
if __name__ == "__main__":
dlg = KeyboardShortcutSelectionDialog(
title = "Select test",
- buttons = (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
- Gtk.STOCK_OK, Gtk.ResponseType.OK))
+ buttons = (_("_Cancel"), Gtk.ResponseType.CANCEL,
+ _("_OK"), Gtk.ResponseType.OK))
dlg.add_shortcut("Control+Shift+space")
dlg.set_shortcuts(None)
print((dlg.run()))
diff --git a/setup/main.py b/setup/main.py
index cac10dec..699ba0e8 100644
--- a/setup/main.py
+++ b/setup/main.py
@@ -371,8 +371,8 @@ class Setup(object):
sys.exit(0)
def __shortcut_button_clicked_cb(self, button, name, section, _name, entry):
- buttons = (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
- Gtk.STOCK_OK, Gtk.ResponseType.OK)
+ buttons = (_("_Cancel"), Gtk.ResponseType.CANCEL,
+ _("_OK"), Gtk.ResponseType.OK)
title = _("Select keyboard shortcut for %s") % \
_("switching input methods")
dialog = keyboardshortcut.KeyboardShortcutSelectionDialog(buttons = buttons, title = title)