Fixed fallback icons.
authorfujiwarat <takao.fujiwara1@gmail.com>
Tue, 8 Nov 2011 01:48:42 +0000 (10:48 +0900)
committerfujiwarat <takao.fujiwara1@gmail.com>
Tue, 8 Nov 2011 01:48:42 +0000 (10:48 +0900)
1. Set 'ibus-keyboard' icon for IME off in non-GNOME theme.
People would think the application icon for non-GNONE classic desktop.
The themed icon is applied for GNOME icon theme only.

2. Set gtk-fallback-icon-theme as 'gnome'
ibus gtk panel needs gtk stock icons but some desktop does not load GNOME
icon theme. I assigned 'gnome' for gtk-fallback-icon-theme if it's none.

3. Use 'gtk-dialog-info' if 'gtk-info' is not found.
It seems the latest gtk2 does not have 'gtk-info' icon via pygtk2.

BUG=RH#711632
TEST=Linux desktop

Review URL: http://codereview.appspot.com/5320066

ibus/_config.py.in
ui/gtk/main.py
ui/gtk/panel.py

index a83013633704365371ef883c8ec95ed209d30df5..098d805af4938b0716fb304b525384d5520537c8 100644 (file)
@@ -45,10 +45,14 @@ def get_license():
 
 def get_ICON_KEYBOARD():
     import gtk
-    theme = gtk.icon_theme_get_default()
     icon = '@IBUS_ICON_KEYBOARD@'
+    fallback_icon = 'ibus-keyboard'
+    settings = gtk.settings_get_default()
+    if settings.get_property('gtk-icon-theme-name') != 'gnome':
+        return fallback_icon
+    theme = gtk.icon_theme_get_default()
     if not theme.lookup_icon(icon, 18, 0):
-        icon = 'ibus-keyboard'
+        return fallback_icon
     return icon
 
 ISOCODES_PREFIX='@ISOCODES_PREFIX@'
index 0412aeadcf677fc1f7144d5798c6379c44519df5..cadcc96ce3a7468d2fd97cca3633d338209f95d4 100644 (file)
@@ -86,6 +86,9 @@ class UIApplication:
             pass
 
 def launch_panel(replace):
+    settings = gtk.settings_get_default()
+    if settings.get_property('gtk-fallback-icon-theme') == None:
+        settings.set_property('gtk-fallback-icon-theme', 'gnome')
     # gtk.settings_get_default().props.gtk_theme_name = "/home/phuang/.themes/aud-Default/gtk-2.0/gtkrc"
     # gtk.rc_parse("./themes/default/gtkrc")
     UIApplication(replace).run()
index 90be1d5c553c69ddb61a9697a5b0f824fc24da43..f71a36da0e1d3646b8fd27a011d5add020212c37 100644 (file)
@@ -477,7 +477,7 @@ class Panel(ibus.PanelBase):
             menu = gtk.Menu()
             item = gtk.ImageMenuItem(_("No input window"))
             size = gtk.icon_size_lookup(gtk.ICON_SIZE_MENU)
-            item.set_image(_icon.IconWidget("gtk-info", size[0]))
+            item.set_image(_icon.IconWidget("gtk-dialog-info", size[0]))
             menu.add(item)
             menu.show_all()
         else: