From 6fbeb9223b4fa942933f4ceaea0c25161b1e6e55 Mon Sep 17 00:00:00 2001 From: fujiwarat Date: Thu, 12 Jul 2012 19:37:50 +0900 Subject: Added anthy themed icon. --- configure.ac | 15 +++++ engine/anthy.xml.in.in | 2 +- ibus-anthy.spec.in | 12 ++++ icons/Makefile.am | 18 +++++- icons/ibus-anthy.svg | 146 +++++++++++++++++++++++++++++++++++++++++++++++++ setup/main.py | 16 +++++- 6 files changed, 203 insertions(+), 6 deletions(-) create mode 100644 icons/ibus-anthy.svg diff --git a/configure.ac b/configure.ac index ac4532e..a6dddab 100644 --- a/configure.ac +++ b/configure.ac @@ -270,6 +270,21 @@ AC_ARG_WITH(kasumi-icon, [KASUMI_ICON_FILE="$datadir/pixmaps/kasumi.png"]) AC_SUBST(KASUMI_ICON_FILE) +dnl - check private png +AC_MSG_CHECKING([if you install the private png file]) +AC_ARG_ENABLE(private-png, + AS_HELP_STRING([--enable-private-png=no/yes], + [Install ibus-anthy.png default=no]), + enable_private_png=yes, + enable_private_png=no) +AC_MSG_RESULT($enable_private_png) + +if test x"$enable_private_png" = xyes; then + AM_CONDITIONAL(HAVE_PRIVATE_PNG, true) +else + AM_CONDITIONAL(HAVE_PRIVATE_PNG, false) +fi + dnl - check hotkeys for ibus-anthy which is used for ibus bridge mode. dnl - Normally you don't need this so could be HOTKEYS="no" AC_ARG_WITH(hotkeys, diff --git a/engine/anthy.xml.in.in b/engine/anthy.xml.in.in index 28bfa89..0162cf6 100644 --- a/engine/anthy.xml.in.in +++ b/engine/anthy.xml.in.in @@ -17,7 +17,7 @@ ja GPL Peng Huang <shawn.p.huang@gmail.com> - ${pkgdatadir}/icons/ibus-anthy.png + ibus-anthy @LAYOUT_XML@ Anthy Anthy Input Method diff --git a/ibus-anthy.spec.in b/ibus-anthy.spec.in index 5fbe6df..faeed8f 100644 --- a/ibus-anthy.spec.in +++ b/ibus-anthy.spec.in @@ -65,6 +65,18 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libanthygobject-%{sub_version}.la %clean rm -rf $RPM_BUILD_ROOT +%post +# recreate icon cache +touch --no-create %{_datadir}/icons/hicolor || : +[ -x %{_bindir}/gtk-update-icon-cache ] && \ + %{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || : + +%postun +# recreate icon cache +touch --no-create %{_datadir}/icons/hicolor || : +[ -x %{_bindir}/gtk-update-icon-cache ] && \ + %{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || : + %files -f %{name}.lang %defattr(-,root,root,-) %doc AUTHORS COPYING README diff --git a/icons/Makefile.am b/icons/Makefile.am index 0f933b0..fe97bde 100644 --- a/icons/Makefile.am +++ b/icons/Makefile.am @@ -20,12 +20,24 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -icons_DATA = \ +pngicons_DATA = \ ibus-anthy.png \ $(NULL) -iconsdir = $(pkgdatadir)/icons +if HAVE_PRIVATE_PNG +pngiconsdir = $(pkgdatadir)/icons +else +pngiconsdir = /tmp +endif + +scalable_icons_DATA = \ + ibus-anthy.svg \ + $(NULL) + +# You need to run gtk-update-icon-cache after the icons are installed. +scalable_iconsdir = $(datadir)/icons/hicolor/scalable/apps/ EXTRA_DIST = \ - ibus-anthy.png \ + $(pngicons_DATA) \ + $(scalable_icons_DATA) \ $(NULL) diff --git a/icons/ibus-anthy.svg b/icons/ibus-anthy.svg new file mode 100644 index 0000000..5668dcc --- /dev/null +++ b/icons/ibus-anthy.svg @@ -0,0 +1,146 @@ + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/setup/main.py b/setup/main.py index 65fc88f..5811976 100644 --- a/setup/main.py +++ b/setup/main.py @@ -88,6 +88,9 @@ class AnthySetup(object): icon_path = path.join(anthydir, 'icons', 'ibus-anthy.png') if path.exists(icon_path): builder.get_object('main').set_icon_from_file(icon_path) + else: + icon_path = 'ibus-anthy' + builder.get_object('main').set_icon_name(icon_path) for name in ['input_mode', 'typing_method', 'conversion_segment_mode', 'period_style', 'symbol_style', 'ten_key_mode', @@ -217,8 +220,17 @@ class AnthySetup(object): except: pass if icon_path != None: - image = Gtk.Image.new_from_file(icon_path) - about_dialog.set_logo(image.get_pixbuf()) + if icon_path[0] == '/': + image = Gtk.Image.new_from_file(icon_path) + about_dialog.set_logo(image.get_pixbuf()) + else: + icon_theme = Gtk.IconTheme.get_default() + try: + pixbuf = icon_theme.load_icon(icon_path, 48, 0) + about_dialog.set_logo(pixbuf) + except Exception, err: + print >> sys.stderr, 'Not found icon', str(err) + print >> sys.stderr, 'Need to run gtk-update-icon-cache' content_area = about_dialog.get_content_area() list = content_area.get_children() vbox = list[0] -- cgit v1.2.1