debian/0000755000000000000000000000000012156557614007202 5ustar debian/README0000644000000000000000000000016112156552261010051 0ustar a good HOWTO introduction on scim-anthy is available at http://www.h4.dion.ne.jp/~apricots/scim-anthy/howto.html debian/changelog0000644000000000000000000002631512156552261011054 0ustar scim-anthy (1.2.7-6) unstable; urgency=low * control: - drop obsolete DMUA field - bump standard to 3.9.4 - switch roles of maintainer and uploader between Ikuya-san and me -- Rolf Leggewie Fri, 14 Jun 2013 17:24:56 +0900 scim-anthy (1.2.7-5) unstable; urgency=low [ Tz-Huan Huang ] * debian/rules: - make sure the package builds against a multi-archified libscim-dev - use hardened build flags * Update gtk3.patch to include the UI part fixes. Closes: #682601 [ Rolf Leggewie ] * debian/control: bump build dependency to multi-archified libscim-dev -- Rolf Leggewie Thu, 09 Aug 2012 01:37:40 +0800 scim-anthy (1.2.7-4) unstable; urgency=low [ Tz-Huan Huang ] * make scim-anthy build-able with gtk3. Closes: #677408 [ Rolf Leggewie ] * debian/copyright: update my copyright * debian/control: - bump to latest standard - update homepage field. Closes: #649879 -- Rolf Leggewie Sat, 30 Jun 2012 13:42:22 +0800 scim-anthy (1.2.7-3) unstable; urgency=low * debian/rules: drop installchangelogs override * debian/rules: disable *.a and *.la * debian/rules: use autotools-dev * debian/control: use popular order * fixed typo in source. Closes: #583230 * fixed src/Makefile.am for no rpath * debian/rules: use dh-autoreconf. Closes: #539584 -- Osamu Aoki Sun, 04 Jul 2010 00:02:16 +0900 scim-anthy (1.2.7-2) unstable; urgency=low [Rolf Leggewie] * debian/watch: add watch file * debian/rules: profit from dh7 build logic and radically simplify * debian/control: - update to standard 3.8.4 - add ${misc:Depends} to Depends - set DMUA field * debian/patches: drop all patches, they weren't used for a while now * debian/source: Switch to dpkg-source 3.0 (quilt) format * debian/copyright: add information about packaging copyright * debian/README: add pointer to scim-anthy HOWTO available online [Osamu Aoki] * debian/rules: streamline some of the overrides -- Rolf Leggewie Wed, 05 May 2010 20:07:13 +0900 scim-anthy (1.2.7-1) unstable; urgency=low * new upstream release, push back from Ubuntu Jaunty. (Closes: #503764) * debian/control - drop Tagoh-san from uploaders. (Closes: #508203) - add myself to uploaders - add Homepage and Vcs-* fields - recommend instead of suggest kasumi (LP: #332041) * update standards to 3.8.2 - update to debhelper 5 - use config.sub and config.guess from host instead of patching - better error handling for distclean -- Rolf Leggewie Tue, 21 Jul 2009 17:34:03 +0200 scim-anthy (1.2.7-0ubuntu1) jaunty; urgency=low * New upstream release (LP: #329435) * debian/patches/00list: removed 11_gcc-4.3_fixes.dpatch Already included by upstream. -- Ikuya Awashiro Sat, 14 Feb 2009 15:12:42 +0000 scim-anthy (1.2.4-1.1) unstable; urgency=low * Non-maintainer upload. * Fix gcc-4.3 FBTFS, patch by KiBi (Closes: #441585) -- Marc 'HE' Brockschmidt Sun, 16 Mar 2008 23:26:54 +0100 scim-anthy (1.2.4-1) unstable; urgency=low * New upstream release -- Ikuya Awashiro Sun, 03 Jun 2007 01:39:53 +0900 scim-anthy (1.2.3-1) unstable; urgency=low * New upstream release * debian/patches/10_scim-plugin-module-install-dir: removed. (Closes: #422950) -- Ikuya Awashiro Sat, 12 May 2007 22:28:13 +0900 scim-anthy (1.2.2-1) unstable; urgency=low * New upstream release -- Ikuya Awashiro Tue, 14 Nov 2006 22:37:40 +0900 scim-anthy (1.2.1-1) unstable; urgency=low * New upstream release -- Ikuya Awashiro Sat, 30 Sep 2006 15:55:00 +0900 scim-anthy (1.2.0-1) unstable; urgency=low * New upstream release -- Ikuya Awashiro Sun, 30 Jul 2006 00:19:14 +0900 scim-anthy (1.0.0-3) unstable; urgency=low * Acknowledge the NMU fix (Closes: #368173) * Standards-Version bumped to 3.7.2 (no changes requied) -- Ikuya Awashiro Sun, 18 Jun 2006 21:58:20 +0900 scim-anthy (1.0.0-2.0.1) unstable; urgency=low * NMU * im-switch configuration files are moved to scim (and scim-bridge) packages. -- Osamu Aoki Sat, 17 Jun 2006 06:32:37 +0900 scim-anthy (1.0.0-2) unstable; urgency=low * debian/im-switch/scim-anthy: scim-bridge support. -- Ikuya Awashiro Mon, 10 Apr 2006 22:02:19 +0900 scim-anthy (1.0.0-1) unstable; urgency=low * New upstream release * debian/im-switch/scim-anthy: auto-detect for libqscim.so. -- Ikuya Awashiro Thu, 30 Mar 2006 23:31:23 +0900 scim-anthy (0.9.0-1) unstable; urgency=low * New upstream release * debian/patches/02_atok_sty_predict_key.dpatch: Removed. Already included by upstream. -- Ikuya Awashiro Fri, 20 Jan 2006 04:20:17 +0000 scim-anthy (0.8.0-1) unstable; urgency=low * New upstream release * debian/patches/10_scim-plugin-module-install-dir.dpatch: Updated. * debian/patches/02_atok_sty_predict_key.dpatch: Add predict keys to data/atok.sty. -- Ikuya Awashiro Wed, 14 Dec 2005 15:39:01 +0900 scim-anthy (0.7.1-1) unstable; urgency=low * New upstream release * debian/patches/01_fix_scim-setup_crash_bug: removed. New release contains this fix. * fixed build issue. (closes: #336579) -- Ikuya Awashiro Tue, 1 Nov 2005 11:35:55 +0900 scim-anthy (0.7.0-1) unstable; urgency=low * New upstream release * debian/patches/01_fix_scim-setup_crash_bug.dpatch: fix scim-setup crash bug. -- Ikuya Awashiro Tue, 4 Oct 2005 14:24:11 +0000 scim-anthy (0.6.1-3) unstable; urgency=low * debian/im-switch/scim-anthy: Quoted DEPENDS line. (closes: #324956) -- Ikuya Awashiro Thu, 25 Aug 2005 13:51:03 +0000 scim-anthy (0.6.1-2) unstable; urgency=low * closes: #323394 (ITP) -- Ikuya Awashiro Thu, 18 Aug 2005 14:40:28 +0000 scim-anthy (0.6.1-1) unstable; urgency=low * New upstream release * debian/rules: do not make wrong directory. * Bump Standards-Version to 3.6.2 (no changes required). -- Ikuya Awashiro Tue, 16 Aug 2005 13:26:27 +0900 scim-anthy (0.5.3-1) unstable; urgency=low * New upstream release -- Ikuya Awashiro Sun, 31 Jul 2005 12:51:31 +0000 scim-anthy (0.5.2-3) unstable; urgency=low * add im-switch support. -- Ikuya Awashiro Thu, 28 Jul 2005 17:43:51 +0900 scim-anthy (0.5.2-2) unstable; urgency=low * This package is for SCIM 1.3.x or later. * debian/control: changed Depends and Build-Depends for SCIM 1.3.x. -- Ikuya Awashiro Tue, 19 Jul 2005 17:43:33 +0900 scim-anthy (0.5.2-1) unstable; urgency=low * New upstream release -- Ikuya Awashiro Mon, 18 Jul 2005 12:51:57 +0000 scim-anthy (0.5.1-1) unstable; urgency=low * New upstream release * debian/rules: get SCIM's version automatically. * debian/control: add pkg-config to Build-depends. * debian/patches/01_henkan_muhenkan.dpatch: dropped. This fix contains 0.5.1. -- Ikuya Awashiro Sun, 10 Jul 2005 15:58:00 +0900 scim-anthy (0.5.0-4) unstable; urgency=low * rebuild on gcc 4.0. -- Ikuya Awashiro Thu, 7 Jul 2005 12:23:42 +0900 scim-anthy (0.5.0-3) unstable; urgency=low * debian/01_henkan_muhenkan.dpatch: added. Because fixed some bugs like: Fixed typo. Raise priority of PageUp and PageDown. Thanks AWASHIRO Ikuya. and improve Henkan and Muhenkan key bind on ATOK style. -- Ikuya Awashiro Mon, 4 Jul 2005 01:13:17 +0900 scim-anthy (0.5.0-2) unstable; urgency=low * debian/rules: enable dh_strip. Thanks to Yukiharu Yabuki . -- Ikuya Awashiro Fri, 1 Jul 2005 15:12:22 +0900 scim-anthy (0.5.0-1) unstable; urgency=low * New upstream release -- Ikuya Awashiro Thu, 30 Jun 2005 22:17:46 +0900 scim-anthy (0.4.3-1) unstable; urgency=low * New upstream release * debian/control: changed Build-dep and Depends for SCIM 1.2.x. -- Ikuya Awashiro Mon, 6 Jun 2005 22:28:11 +0900 scim-anthy (0.4.2-1) unstable; urgency=low * New upstream release -- Ikuya Awashiro Wed, 18 May 2005 00:22:30 +0900 scim-anthy (0.4.0-1) unstable; urgency=low * New upstream release * debian/rules: add the copy of config.sub and config.guess files from /usr/share/misc, and the CFLAGS to the configure call. * debian/control: add autotools-dev to Build-depends. * debian/patches/10_scim-plugin-module-install-dir.dpatch: fixed SetupUI files are misplaced probrem. above all Thanks to Mike Hommey of cource except New upstream release. * debian/control: add scim (<< 1.1) to Depends. This binary is for 1.0.x only. -- Ikuya Awashiro Sun, 15 May 2005 21:35:28 +0900 scim-anthy (0.3.2-1) unstable; urgency=low * New upstream release * debian/patches/01_scim-plugin-module-install-dir.dpatch get scim's version automatically. thanks to zoe -- Ikuya Awashiro Mon, 9 May 2005 18:03:29 +0900 scim-anthy (0.3.1-5) unstable; urgency=low * debian/control: add libgtk2.0-dev to Build-Depends. -- Ikuya Awashiro Tue, 19 Apr 2005 13:26:02 +0000 scim-anthy (0.3.1-4) unstable; urgency=low * delete some build errors. -- Ikuya Awashiro Sun, 3 Apr 2005 09:06:27 +0000 scim-anthy (0.3.1-3) unstable; urgency=low * debian/control: delete libanthy-dev's version. -- Ikuya Awashiro Sun, 3 Apr 2005 08:45:11 +0000 scim-anthy (0.3.1-2) unstable; urgency=low * debian/control: depends on anthy. -- Ikuya Awashiro Sun, 3 Apr 2005 17:25:00 +0900 scim-anthy (0.3.1-1) unstable; urgency=low * New upstream release * Delete NEWS and COPYING in debian/docs * add Suggests: kasumi to debian/control -- Ikuya Awashiro Wed, 2 Feb 2005 20:48:36 +0900 scim-anthy (0.2.0+cvs20050109-2) unstable; urgency=low * Use make update-gmo instead msgfmt -o po/ja.gmo po/ja.po -- Ikuya Awashiro Tue, 11 Jan 2005 23:17:58 +0900 scim-anthy (0.2.0+cvs20050109-1) unstable; urgency=low * New upstream release -- Ikuya Awashiro Sun, 9 Jan 2005 01:04:04 +0900 scim-anthy (0.2.0-1) unstable; urgency=low * New upstream release -- Ikuya Awashiro Mon, 29 Nov 2004 10:47:30 +0900 scim-anthy (0.1.8-1) unstable; urgency=low * New upstream release -- Ikuya Awashiro Mon, 22 Nov 2004 08:40:51 +0900 scim-anthy (0.1.5-1) unstable; urgency=low * New upstream release -- Ikuya Awashiro Fri, 19 Nov 2004 11:25:45 +0900 scim-anthy (0.1.4-1) unstable; urgency=low * New upstream release -- Ikuya Awashiro Thu, 18 Nov 2004 19:02:46 +0900 scim-anthy (0.1.3-1) unstable; urgency=low * New upstream release -- Ikuya Awashiro Wed, 17 Nov 2004 11:14:36 +0900 scim-anthy (0.1.2-1) unstable; urgency=low * Initial Release. -- Ikuya Awashiro Tue, 16 Nov 2004 16:18:17 +0900 debian/compat0000644000000000000000000000000212156552261010371 0ustar 7 debian/control0000644000000000000000000000166012156552261010601 0ustar Source: scim-anthy Section: utils Priority: optional Maintainer: Rolf Leggewie Uploaders: Ikuya Awashiro , Osamu Aoki Build-Depends: debhelper (>= 7.0.50~), libanthy-dev, scim (>= 1.4.6), libscim-dev (>= 1.4.14-2), autotools-dev, pkg-config, dh-autoreconf, libltdl-dev Standards-Version: 3.9.4 Homepage: http://sourceforge.jp/projects/scim-imengine/ Vcs-Git: git://git.debian.org/collab-maint/scim-anthy.git Vcs-Browser: http://git.debian.org/?p=collab-maint/scim-anthy.git Package: scim-anthy Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, anthy, scim (<< 1.5) Recommends: kasumi Description: SCIM IMEngine module for Anthy Smart Common Input Method platform (SCIM) is an input method server and a development platform to make Input Method developers' lives easier. . Anthy is a simple and secure input method in Japanese. scim-anthy connects Anthy to SCIM. debian/copyright0000644000000000000000000000122512156552261011126 0ustar This package was initially debianized by Ikuya Awashiro on Tue, 16 Nov 2004 16:18:17 +0900. It was downloaded from http://sourceforge.jp/projects/scim-imengine/ Copyright: Upstream Author: Hiroyuki Ikezoe Takuro Ashie License: You are free to distribute this software under the terms of the GNU General Public License. On Debian systems, the complete text of the GNU General Public License can be found in the file `/usr/share/common-licenses/GPL'. The Debian packaging is © 2004-2009 Ikuya Awashiro and © 2009-2012 Rolf Leggewie and released under the GPL v2 or later. debian/docs0000644000000000000000000000001712156552261010044 0ustar README AUTHORS debian/patches/0000755000000000000000000000000012156552261010622 5ustar debian/patches/commited.patch0000644000000000000000000000235712156552261013453 0ustar Description: spell s/commited/committed/ From: Osamu Aoki --- a/po/de.po +++ b/po/de.po @@ -1124,7 +1124,7 @@ msgstr "Tasten zum zurückkonvertieren wählen" #: src/scim_anthy_prefs.cpp:732 -msgid "The key events to reconvert the commited string in selection. " +msgid "The key events to reconvert the committed string in selection. " msgstr "" "Die Tastatureignisse, die die übergebene Zeichenkette wieder in eine Auswahl " "zurückkonvertieren" --- a/po/ja.po +++ b/po/ja.po @@ -1066,7 +1066,7 @@ msgstr "再変換キーの設定" #: src/scim_anthy_prefs.cpp:732 -msgid "The key events to reconvert the commited string in selection. " +msgid "The key events to reconvert the committed string in selection. " msgstr "セレクション内の確定済み文字列を再変換するキーイベント" #: src/scim_anthy_prefs.cpp:741 --- a/src/scim_anthy_prefs.cpp +++ b/src/scim_anthy_prefs.cpp @@ -729,7 +729,7 @@ SCIM_ANTHY_CONFIG_RECONVERT_KEY_DEFAULT, N_("Reconvert"), N_("Select reconvert keys"), - N_("The key events to reconvert the commited string in selection. "), + N_("The key events to reconvert the committed string in selection. "), NULL, false, }, debian/patches/gtk3.patch0000644000000000000000000024231412156552261012521 0ustar diff --git a/configure.ac b/configure.ac index 5f5ba1d..082818f 100644 --- a/configure.ac +++ b/configure.ac @@ -60,14 +60,18 @@ PKG_CHECK_MODULES(SCIM_GTKUTILS,[scim-gtkutils >= $SCIM_VERSION], AC_SUBST(SCIM_VERSION) AM_CONDITIONAL(SCIM_BUILD_SETUP, [test "$SCIM_HAS_GTKUTILS" = "yes"]) +AM_CONDITIONAL(SCIM_BUILD_HELPER, [test "$SCIM_HAS_GTKUTILS" = "yes"]) if test "$SCIM_HAS_GTKUTILS" = "yes"; then SCIM_BUILD_SETUP=1 + SCIM_BUILD_HELPER=1 else SCIM_BUILD_SETUP=0 + SCIM_BUILD_HELPER=0 fi AC_SUBST(SCIM_BUILD_SETUP) +AC_SUBST(SCIM_BUILD_HELPER) # Checks for header files. AC_HEADER_STDC @@ -84,21 +88,6 @@ ANTHY_CFLAGS="" AC_SUBST(ANTHY_LIBS) AC_SUBST(ANTHY_CFLAGS) -# Check gtk2 -PKG_CHECK_MODULES(GTK2, [gtk+-2.0 >= 2.4.0], - [HAS_GTK=yes], - [HAS_GTK=no]) - -AM_CONDITIONAL(SCIM_BUILD_HELPER, [test "$HAS_GTK" = "yes"]) - -if test "$HAS_GTK" = "yes"; then - SCIM_BUILD_HELPER=1 -else - SCIM_BUILD_HELPER=0 -fi - -AC_SUBST(SCIM_BUILD_HELPER) - # libtool option to control which symbols are exported # right now, symbols starting with _ are not exported LIBTOOL_EXPORT_OPTIONS='-export-symbols-regex "^[[^_]].*"' diff --git a/src/Makefile.am b/src/Makefile.am index aac7849..3f48b3b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -127,15 +127,15 @@ helpermoduledir = @SCIM_MODULEDIR@/Helper helpermodule_LTLIBRARIES = $(HELPER_MODULE) anthy_imengine_helper_la_SOURCES = scim_anthy_helper.cpp -anthy_imengine_helper_la_CFLAGS = @GTK2_CFLAGS@ \ +anthy_imengine_helper_la_CFLAGS = @SCIM_GTKUTILS_CFLAGS@ \ @SCIM_CFLAGS@ \ @SCIM_DEBUG_FLAGS@ -anthy_imengine_helper_la_CXXFLAGS = @GTK2_CFLAGS@ \ +anthy_imengine_helper_la_CXXFLAGS = @SCIM_GTKUTILS_CFLAGS@ \ @SCIM_CFLAGS@ \ @SCIM_DEBUG_FLAGS@ anthy_imengine_helper_la_LDFLAGS = -avoid-version \ -module \ @LIBTOOL_EXPORT_OPTIONS@ \ - @GTK2_LIBS@ \ + @SCIM_GTKUTILS_LIBS@ \ @INTLLIBS@ \ @SCIM_LIBS@ diff --git a/src/scim_anthy_color_button.cpp b/src/scim_anthy_color_button.cpp index 841c9aa..7606523 100644 --- a/src/scim_anthy_color_button.cpp +++ b/src/scim_anthy_color_button.cpp @@ -58,9 +58,14 @@ typedef enum static void scim_anthy_color_button_class_init (ScimAnthyColorButtonClass *klass); static void scim_anthy_color_button_init (ScimAnthyColorButton *object); +#if GTK_CHECK_VERSION(3, 0, 0) +static void scim_anthy_color_button_destroy (GtkWidget *object); +static gboolean scim_anthy_color_button_draw (GtkWidget *widget, cairo_t *cr); +#else static void scim_anthy_color_button_destroy (GtkObject *object); static gboolean scim_anthy_color_button_expose (GtkWidget *widget, GdkEventExpose *eevent); +#endif static gboolean scim_anthy_color_button_button_press (GtkWidget *widget, GdkEventButton *bevent); static gboolean scim_anthy_color_button_button_release (GtkWidget *widget, @@ -100,7 +105,6 @@ scim_anthy_color_button_get_type (void) static void scim_anthy_color_button_class_init (ScimAnthyColorButtonClass *klass) { - GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (klass); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); parent_class = (GtkDrawingAreaClass *) g_type_class_peek_parent (klass); @@ -114,9 +118,15 @@ scim_anthy_color_button_class_init (ScimAnthyColorButtonClass *klass) g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); +#if GTK_CHECK_VERSION(3, 0, 0) + widget_class->destroy = scim_anthy_color_button_destroy; + widget_class->draw = scim_anthy_color_button_draw; +#else + GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (klass); gtk_object_class->destroy = scim_anthy_color_button_destroy; - widget_class->expose_event = scim_anthy_color_button_expose; +#endif + widget_class->button_press_event = scim_anthy_color_button_button_press; widget_class->button_release_event = scim_anthy_color_button_button_release; } @@ -125,8 +135,13 @@ static void scim_anthy_color_button_init (ScimAnthyColorButton *object) { /*set default color */ +#if GTK_CHECK_VERSION(3, 0, 0) + gdk_rgba_parse (&object->fg_color, "#000000"); + gdk_rgba_parse (&object->bg_color, "#ffffff"); +#else gdk_color_parse ("#000000", &object->fg_color); gdk_color_parse ("#ffffff", &object->bg_color); +#endif gtk_widget_add_events (GTK_WIDGET (object), GDK_BUTTON_PRESS_MASK | @@ -135,7 +150,11 @@ scim_anthy_color_button_init (ScimAnthyColorButton *object) static void +#if GTK_CHECK_VERSION(3, 0, 0) +scim_anthy_color_button_destroy (GtkWidget *object) +#else scim_anthy_color_button_destroy (GtkObject *object) +#endif { ScimAnthyColorButton *button = SCIM_ANTHY_COLOR_BUTTON (object); @@ -150,19 +169,38 @@ scim_anthy_color_button_destroy (GtkObject *object) button->swap_icon = NULL; } +#if GTK_CHECK_VERSION(3, 0, 0) + GTK_WIDGET_CLASS (parent_class)->destroy (object); +#else GTK_OBJECT_CLASS (parent_class)->destroy (object); +#endif } static void scim_anthy_color_button_draw_rect (ScimAnthyColorButton *button, +#if GTK_CHECK_VERSION(3, 0, 0) + GdkWindow *drawable, + cairo_t *cr, +#else GdkDrawable *drawable, GdkGC *gc, +#endif gint x, gint y, gint width, gint height, - GdkColor *color) +#if GTK_CHECK_VERSION(3, 0, 0) + GdkRGBA *color +#else + GdkColor *color +#endif + ) { +#if GTK_CHECK_VERSION(3, 0, 0) + gdk_cairo_set_source_rgba (cr, color); + cairo_rectangle (cr, x, y, width, height); + cairo_fill (cr); +#else gint rowstride; guchar r, g, b; gint xx, yy; @@ -201,23 +239,38 @@ scim_anthy_color_button_draw_rect (ScimAnthyColorButton *button, GDK_RGB_DITHER_MAX, button->render_buf, rowstride); +#endif } static gboolean +#if GTK_CHECK_VERSION(3, 0, 0) +scim_anthy_color_button_draw (GtkWidget *widget, + cairo_t *cr) +#else scim_anthy_color_button_expose (GtkWidget *widget, GdkEventExpose *eevent) +#endif { ScimAnthyColorButton *button = SCIM_ANTHY_COLOR_BUTTON (widget); gint width, height; gint swap_w = 0, swap_h = 0; gint rect_w, rect_h; +#if GTK_CHECK_VERSION(2, 18, 0) + if (!gtk_widget_is_drawable (widget)) +#else if (!GTK_WIDGET_DRAWABLE (widget)) +#endif return FALSE; - + +#if GTK_CHECK_VERSION(3, 0, 0) + width = gdk_window_get_width(gtk_widget_get_window (widget)); + height = gdk_window_get_height(gtk_widget_get_window (widget)); +#else width = widget->allocation.width; height = widget->allocation.height; - +#endif + /* draw the swap colors pixbuf */ if (!button->swap_icon) { button->swap_icon @@ -231,9 +284,14 @@ scim_anthy_color_button_expose (GtkWidget *widget, } if (swap_w < width / 2 && swap_h < height / 2) { +#if GTK_CHECK_VERSION(3, 0, 0) + gdk_cairo_set_source_pixbuf (cr, button->swap_icon, width - swap_w, 0); + cairo_paint (cr); +#else gdk_draw_pixbuf (widget->window, NULL, button->swap_icon, 0, 0, width - swap_w, 0, swap_w, swap_h, GDK_RGB_DITHER_NORMAL, 0, 0); +#endif } else { swap_w = swap_h = 0; } @@ -249,37 +307,78 @@ scim_anthy_color_button_expose (GtkWidget *widget, button->rect_width = rect_w; button->rect_height = rect_h; - /* draw the background area */ scim_anthy_color_button_draw_rect (button, +#if GTK_CHECK_VERSION(2, 14, 0) + gtk_widget_get_window (widget), +#else widget->window, +#endif +#if GTK_CHECK_VERSION(3, 0, 0) + cr, +#else widget->style->fg_gc[0], +#endif (width - rect_w), (height - rect_h), rect_w, rect_h, &button->bg_color); - gtk_paint_shadow (widget->style, widget->window, GTK_STATE_NORMAL, +#if GTK_CHECK_VERSION(3, 0, 0) + GtkStyleContext *style = gtk_widget_get_style_context(widget); + gtk_style_context_save (style); + gtk_style_context_set_state (style, GTK_STATE_FLAG_NORMAL); + gtk_render_frame (style, cr, width - rect_w, height - rect_h, rect_w, rect_h); +#else + gtk_paint_shadow (widget->style, +#if GTK_CHECK_VERSION(2, 14, 0) + gtk_widget_get_window (widget), +#else + widget->window, +#endif + GTK_STATE_NORMAL, GTK_SHADOW_IN, NULL, widget, NULL, (width - rect_w), (height - rect_h), rect_w, rect_h); - +#endif /* draw the foreground area */ scim_anthy_color_button_draw_rect (button, +#if GTK_CHECK_VERSION(2, 14, 0) + gtk_widget_get_window (widget), +#else widget->window, +#endif +#if GTK_CHECK_VERSION(3, 0, 0) + cr, +#else widget->style->fg_gc[0], +#endif 0, 0, rect_w, rect_h, &button->fg_color); - gtk_paint_shadow (widget->style, widget->window, GTK_STATE_NORMAL, - GTK_SHADOW_IN, - NULL, widget, NULL, - 0, 0, - rect_w, rect_h); +#if GTK_CHECK_VERSION(3, 0, 0) + style = gtk_widget_get_style_context(widget); + gtk_style_context_save (style); + gtk_style_context_set_state (style, GTK_STATE_FLAG_NORMAL); + gtk_render_frame (style, cr, 0, 0, rect_w, rect_h); +#else + gtk_paint_shadow ( + widget->style, +#if GTK_CHECK_VERSION(2, 14, 0) + gtk_widget_get_window (widget), +#else + widget->window, +#endif + GTK_STATE_NORMAL, + GTK_SHADOW_IN, + NULL, widget, NULL, + 0, 0, + rect_w, rect_h); +#endif return TRUE; } @@ -289,11 +388,16 @@ scim_anthy_color_button_target (ScimAnthyColorButton *button, gint x, gint y) { +#if GTK_CHECK_VERSION(3, 0, 0) + gint width = gdk_window_get_width(gtk_widget_get_window (GTK_WIDGET(button))); + gint height = gdk_window_get_height(gtk_widget_get_window (GTK_WIDGET(button))); +#else gint width = GTK_WIDGET (button)->allocation.width; gint height = GTK_WIDGET (button)->allocation.height; +#endif gint rect_w = button->rect_width; gint rect_h = button->rect_height; - + if (x > 0 && x < rect_w && y > 0 && y < rect_h) return FOREGROUND_AREA; else if (x > (width - rect_w) && x < width && @@ -314,7 +418,11 @@ scim_anthy_color_button_open_color_dialog (ScimAnthyColorButton *button, gboolea { GtkWidget *dialog; const gchar *title; +#if GTK_CHECK_VERSION(3, 0, 0) + GdkRGBA *color; +#else GdkColor *color; +#endif gint result; title = fg ? _("Foreground color") : _("Background color"); @@ -322,16 +430,38 @@ scim_anthy_color_button_open_color_dialog (ScimAnthyColorButton *button, gboolea dialog = gtk_color_selection_dialog_new (title); - gtk_color_selection_set_current_color (GTK_COLOR_SELECTION (GTK_COLOR_SELECTION_DIALOG (dialog)->colorsel), - color); +#if GTK_CHECK_VERSION(3, 0, 0) + gtk_color_selection_set_current_rgba ( + GTK_COLOR_SELECTION (gtk_color_selection_dialog_get_color_selection (GTK_COLOR_SELECTION_DIALOG (dialog))), + color); +#else + gtk_color_selection_set_current_color ( +#if GTK_CHECK_VERSION(2, 14, 0) + GTK_COLOR_SELECTION (gtk_color_selection_dialog_get_color_selection (GTK_COLOR_SELECTION_DIALOG (dialog))), +#else + GTK_COLOR_SELECTION (GTK_COLOR_SELECTION_DIALOG (dialog)->colorsel), +#endif + color); +#endif gtk_widget_show (dialog); result = gtk_dialog_run (GTK_DIALOG (dialog)); switch (result) { case GTK_RESPONSE_OK: - gtk_color_selection_get_current_color (GTK_COLOR_SELECTION (GTK_COLOR_SELECTION_DIALOG (dialog)->colorsel), - color); +#if GTK_CHECK_VERSION(3, 0, 0) + gtk_color_selection_get_current_rgba ( + GTK_COLOR_SELECTION (gtk_color_selection_dialog_get_color_selection (GTK_COLOR_SELECTION_DIALOG (dialog))), + color); +#else + gtk_color_selection_get_current_color ( +#if GTK_CHECK_VERSION(2, 14, 0) + GTK_COLOR_SELECTION (gtk_color_selection_dialog_get_color_selection (GTK_COLOR_SELECTION_DIALOG (dialog))), +#else + GTK_COLOR_SELECTION (GTK_COLOR_SELECTION_DIALOG (dialog)->colorsel), +#endif + color); +#endif g_signal_emit (button, button_signals[COLOR_CHANGED], 0); break; default: @@ -345,6 +475,11 @@ scim_anthy_color_button_open_color_dialog (ScimAnthyColorButton *button, gboolea static void scim_anthy_color_button_swap_color (ScimAnthyColorButton *button) { +#if GTK_CHECK_VERSION(3, 0, 0) + GdkRGBA tmp = button->fg_color; + button->fg_color = button->bg_color; + button->bg_color = tmp; +#else GdkColor tmp; tmp.red = button->fg_color.red; tmp.green = button->fg_color.green; @@ -357,6 +492,7 @@ scim_anthy_color_button_swap_color (ScimAnthyColorButton *button) button->bg_color.red = tmp.red; button->bg_color.green = tmp.green; button->bg_color.blue = tmp.blue; +#endif g_signal_emit (button, button_signals[COLOR_CHANGED], 0); } @@ -447,14 +583,29 @@ scim_anthy_color_button_get_colors (ScimAnthyColorButton *button, g_snprintf (fg_color_str, G_N_ELEMENTS (fg_color_str), "#%02X%02X%02X", +#if GTK_CHECK_VERSION(3, 0, 0) + static_cast(255*button->fg_color.red), + static_cast(255*button->fg_color.green), + static_cast(255*button->fg_color.blue) +#else ((button->fg_color.red)>>8), ((button->fg_color.green)>>8), - ((button->fg_color.blue)>>8)); + ((button->fg_color.blue)>>8) +#endif + ); g_snprintf (bg_color_str, G_N_ELEMENTS (bg_color_str), "#%02X%02X%02X", +#if GTK_CHECK_VERSION(3, 0, 0) + static_cast(255*button->bg_color.red), + static_cast(255*button->bg_color.green), + static_cast(255*button->bg_color.blue) +#else ((button->bg_color.red)>>8), ((button->bg_color.green)>>8), - ((button->bg_color.blue)>>8)); + ((button->bg_color.blue)>>8) +#endif + ); + *fg_value = String (fg_color_str); *bg_value = String (bg_color_str); @@ -466,6 +617,10 @@ scim_anthy_color_button_set_colors (ScimAnthyColorButton *button, const String &fg_value, const String &bg_value) { +#if GTK_CHECK_VERSION(3, 0, 0) + gdk_rgba_parse (&button->fg_color, fg_value.c_str()); + gdk_rgba_parse (&button->bg_color, bg_value.c_str()); +#else GdkColor fg_color, bg_color; gdk_color_parse (fg_value.c_str (), &fg_color); gdk_color_parse (bg_value.c_str (), &bg_color); @@ -476,6 +631,7 @@ scim_anthy_color_button_set_colors (ScimAnthyColorButton *button, button->bg_color.red = bg_color.red; button->bg_color.green = bg_color.green; button->bg_color.blue = bg_color.blue; +#endif return TRUE; } diff --git a/src/scim_anthy_color_button.h b/src/scim_anthy_color_button.h index f55083a..8d96ae7 100644 --- a/src/scim_anthy_color_button.h +++ b/src/scim_anthy_color_button.h @@ -53,8 +53,13 @@ struct _ScimAnthyColorButton gint rect_height; gint click_target; +#if GTK_CHECK_VERSION(3, 0, 0) + GdkRGBA fg_color; + GdkRGBA bg_color; +#else GdkColor fg_color; - GdkColor bg_color; + GdkColor bg_color; +#endif }; struct _ScimAnthyColorButtonClass diff --git a/src/scim_anthy_helper.cpp b/src/scim_anthy_helper.cpp index a0c0d30..5925d70 100644 --- a/src/scim_anthy_helper.cpp +++ b/src/scim_anthy_helper.cpp @@ -175,9 +175,9 @@ slot_imengine_event (const HelperAgent *agent, int ic, if (!reader.get_data (id) || !reader.get_data (time_msec)) break; TimeoutContext *ctx = new TimeoutContext (ic, uuid, id); - guint timeout_id = gtk_timeout_add_full (time_msec, + guint timeout_id = g_timeout_add_full (G_PRIORITY_DEFAULT, + time_msec, timeout_func, - NULL, (gpointer) ctx, timeout_ctx_destroy_func); timeout_ids[ic][id] = timeout_id; @@ -191,7 +191,7 @@ slot_imengine_event (const HelperAgent *agent, int ic, timeout_ids[ic].find (id) != timeout_ids[ic].end ()) { guint tid = timeout_ids[ic][id]; - gtk_timeout_remove (tid); + g_source_remove (tid); } break; } @@ -234,8 +234,8 @@ run (const String &display, const ConfigPointer &config) char **argv = new char * [4]; int argc = 3; - argv [0] = "anthy-imengine-helper"; - argv [1] = "--display"; + argv [0] = const_cast ("anthy-imengine-helper"); + argv [1] = const_cast ("--display"); argv [2] = const_cast (display.c_str ()); argv [3] = 0; diff --git a/src/scim_anthy_prefs.cpp b/src/scim_anthy_prefs.cpp index 7d58ef1..596f990 100644 --- a/src/scim_anthy_prefs.cpp +++ b/src/scim_anthy_prefs.cpp @@ -95,6 +95,7 @@ BoolConfigData config_bool_common [] = N_("A_llow spliting romaji on editing preedit string"), NULL, N_("If this check is enabled, you can delete each letter."), + NULL, false, }, { @@ -104,6 +105,7 @@ BoolConfigData config_bool_common [] = N_("_Entering the pseudo ASCII input mode with capital letters."), NULL, N_("If this check is enabled, capital letters will becomes a trigger to enter the pseudo ASCII input mode."), + NULL, false, }, { @@ -113,6 +115,7 @@ BoolConfigData config_bool_common [] = N_("Insert a _blank with a blank key."), NULL, N_("If this check is enabled, a blank key will works to insert a blank when entering the pseudo ASCII input mode."), + NULL, false, }, { @@ -122,6 +125,7 @@ BoolConfigData config_bool_common [] = N_("_Show predicted candidates while inputting letters"), NULL, NULL, + NULL, false, }, { @@ -131,6 +135,7 @@ BoolConfigData config_bool_common [] = N_("Use _direct select keys while predicting"), NULL, NULL, + NULL, false, }, { @@ -215,8 +220,8 @@ BoolConfigData config_bool_common [] = }, { NULL, - "", - "", + false, + false, NULL, NULL, NULL, @@ -273,6 +278,7 @@ IntConfigData config_int_common [] = NULL, NULL, NULL, + NULL, false, }, }; diff --git a/src/scim_anthy_setup.cpp b/src/scim_anthy_setup.cpp index 942e852..2ee5358 100644 --- a/src/scim_anthy_setup.cpp +++ b/src/scim_anthy_setup.cpp @@ -174,7 +174,10 @@ static GtkWidget * __widget_key_filter_button = NULL; static GtkWidget * __widget_key_theme_menu = NULL; static GtkWidget * __widget_key_list_view = NULL; static GtkWidget * __widget_choose_keys_button = NULL; +#if GTK_CHECK_VERSION(3, 0, 0) +#else static GtkTooltips * __widget_tooltips = NULL; +#endif static String __config_key_theme = SCIM_ANTHY_CONFIG_KEY_THEME_DEFAULT; static String __config_key_theme_file = SCIM_ANTHY_CONFIG_KEY_THEME_FILE_DEFAULT; @@ -295,7 +298,7 @@ static ComboConfigCandidate preedit_style[] = }; -static void setup_key_theme_menu (GtkOptionMenu *omenu); +static void setup_key_theme_menu (GtkWidget *omenu); static void setup_widget_value (void); static void on_default_editable_changed (GtkEditable *editable, @@ -308,15 +311,15 @@ static void on_default_key_selection_clicked (GtkButton *button, gpointer user_data); static void on_default_combo_changed (GtkEditable *editable, gpointer user_data); -static void on_default_option_menu_changed (GtkOptionMenu *omenu, +static void on_default_option_menu_changed (GtkWidget *omenu, gpointer user_data); -static void on_preedit_style_menu_changed (GtkOptionMenu *omenu, +static void on_preedit_style_menu_changed (GtkWidget *omenu, gpointer user_data); static void on_key_filter_selection_clicked (GtkButton *button, gpointer user_data); static void on_dict_menu_label_toggled (GtkToggleButton *togglebutton, gpointer user_data); -static void on_key_category_menu_changed (GtkOptionMenu *omenu, +static void on_key_category_menu_changed (GtkWidget *omenu, gpointer user_data); static gboolean on_key_list_view_key_press (GtkWidget *widget, GdkEventKey *event, @@ -324,7 +327,7 @@ static gboolean on_key_list_view_key_press (GtkWidget *widget, static gboolean on_key_list_view_button_press (GtkWidget *widget, GdkEventButton *event, gpointer user_data); -static void on_key_theme_menu_changed (GtkOptionMenu *omenu, +static void on_key_theme_menu_changed (GtkWidget *omenu, gpointer user_data); static void on_key_list_selection_changed (GtkTreeSelection *selection, gpointer data); @@ -364,11 +367,19 @@ create_check_button (const char *config_key) entry); gtk_widget_show (GTK_WIDGET (entry->widget)); +#if GTK_CHECK_VERSION(3, 0, 0) +#else if (!__widget_tooltips) __widget_tooltips = gtk_tooltips_new(); +#endif if (entry->tooltip) +#if GTK_CHECK_VERSION(3, 0, 0) + gtk_widget_set_tooltip_text (GTK_WIDGET (entry->widget), + _(entry->tooltip)); +#else gtk_tooltips_set_tip (__widget_tooltips, GTK_WIDGET (entry->widget), _(entry->tooltip), NULL); +#endif return GTK_WIDGET (entry->widget); } @@ -389,7 +400,11 @@ create_spin_button (const char *config_key, GtkTable *table, int idx) 4, 4); gtk_widget_show (GTK_WIDGET (label)); +#if GTK_CHECK_VERSION(3, 0, 0) + GtkWidget *hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); +#else GtkWidget *hbox = gtk_hbox_new (FALSE, 0); +#endif gtk_table_attach (GTK_TABLE (table), GTK_WIDGET (hbox), 1, 2, idx, idx + 1, (GtkAttachOptions) GTK_FILL, @@ -417,11 +432,18 @@ create_spin_button (const char *config_key, GtkTable *table, int idx) gtk_widget_show (GTK_WIDGET (label)); } +#if GTK_CHECK_VERSION(3, 0, 0) +#else if (!__widget_tooltips) __widget_tooltips = gtk_tooltips_new(); +#endif if (entry->tooltip) +#if GTK_CHECK_VERSION(3, 0, 0) + gtk_widget_set_tooltip_text (GTK_WIDGET (entry->widget), _(entry->tooltip)); +#else gtk_tooltips_set_tip (__widget_tooltips, GTK_WIDGET (entry->widget), _(entry->tooltip), NULL); +#endif return GTK_WIDGET (entry->widget); } @@ -453,11 +475,18 @@ create_entry (const char *config_key, GtkTable *table, int idx) (GtkAttachOptions) (GTK_FILL|GTK_EXPAND), (GtkAttachOptions) (GTK_FILL), 4, 4); +#if GTK_CHECK_VERSION(3, 0, 0) +#else if (!__widget_tooltips) __widget_tooltips = gtk_tooltips_new(); +#endif if (entry->tooltip) +#if GTK_CHECK_VERSION(3, 0, 0) + gtk_widget_set_tooltip_text (GTK_WIDGET (entry->widget), _(entry->tooltip)); +#else gtk_tooltips_set_tip (__widget_tooltips, GTK_WIDGET (entry->widget), _(entry->tooltip), NULL); +#endif return GTK_WIDGET (entry->widget); } @@ -480,12 +509,31 @@ create_combo (const char *config_key, gpointer candidates_p, (GtkAttachOptions) (GTK_FILL), 4, 4); gtk_widget_show (label); +#if GTK_CHECK_VERSION(2, 24, 0) + entry->widget = gtk_combo_box_text_new_with_entry (); + GtkWidget *combo_box_entry = gtk_bin_get_child (GTK_BIN (entry->widget)); + gtk_label_set_mnemonic_widget (GTK_LABEL (label), combo_box_entry); + gtk_editable_set_editable (GTK_EDITABLE (combo_box_entry), FALSE); + + gtk_widget_show (GTK_WIDGET (entry->widget)); + gtk_table_attach (GTK_TABLE (table), GTK_WIDGET (entry->widget), + 1, 2, idx, idx + 1, + (GtkAttachOptions) (GTK_FILL|GTK_EXPAND), + (GtkAttachOptions) (GTK_FILL), 4, 4); + g_object_set_data (G_OBJECT (combo_box_entry), + DATA_POINTER_KEY, + (gpointer) candidates_p); + + g_signal_connect (G_OBJECT (combo_box_entry), "changed", + G_CALLBACK (on_default_combo_changed), + entry); +#else entry->widget = gtk_combo_new (); gtk_label_set_mnemonic_widget (GTK_LABEL (label), GTK_COMBO (entry->widget)->entry); gtk_combo_set_value_in_list (GTK_COMBO (entry->widget), TRUE, FALSE); gtk_combo_set_case_sensitive (GTK_COMBO (entry->widget), TRUE); - gtk_entry_set_editable (GTK_ENTRY (GTK_COMBO (entry->widget)->entry), + gtk_editable_set_editable (GTK_EDITABLE (GTK_COMBO (entry->widget)->entry), FALSE); gtk_widget_show (GTK_WIDGET (entry->widget)); gtk_table_attach (GTK_TABLE (table), GTK_WIDGET (entry->widget), @@ -499,13 +547,22 @@ create_combo (const char *config_key, gpointer candidates_p, g_signal_connect ((gpointer) GTK_COMBO (entry->widget)->entry, "changed", G_CALLBACK (on_default_combo_changed), entry); +#endif +#if GTK_CHECK_VERSION(3, 0, 0) +#else if (!__widget_tooltips) __widget_tooltips = gtk_tooltips_new(); +#endif if (entry->tooltip) +#if GTK_CHECK_VERSION(3, 0, 0) + gtk_widget_set_tooltip_text ( + gtk_bin_get_child (GTK_BIN (entry->widget)), _(entry->tooltip)); +#else gtk_tooltips_set_tip (__widget_tooltips, GTK_WIDGET (GTK_COMBO (entry->widget)->entry), _(entry->tooltip), NULL); +#endif return GTK_WIDGET (entry->widget); } @@ -528,6 +585,29 @@ create_option_menu (const char *config_key, gpointer candidates_p, (GtkAttachOptions) (GTK_FILL), 4, 4); gtk_widget_show (label); +#if GTK_CHECK_VERSION(2, 24, 0) + entry->widget = gtk_combo_box_text_new (); + gtk_label_set_mnemonic_widget (GTK_LABEL (label), + GTK_WIDGET (entry->widget)); + gtk_widget_show (GTK_WIDGET (entry->widget)); + gtk_table_attach (GTK_TABLE (table), GTK_WIDGET (entry->widget), + 1, 2, idx, idx + 1, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (GTK_FILL), 4, 4); + g_object_set_data (G_OBJECT (entry->widget), + DATA_POINTER_KEY, + (gpointer) candidates_p); + + for (unsigned int i = 0; data[i].label; i++) { + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (entry->widget), _(data[i].label)); + } + + gtk_combo_box_set_active (GTK_COMBO_BOX (entry->widget), 0); + + g_signal_connect (G_OBJECT (entry->widget), "changed", + G_CALLBACK (on_default_option_menu_changed), + entry); +#else entry->widget = gtk_option_menu_new (); gtk_label_set_mnemonic_widget (GTK_LABEL (label), GTK_WIDGET (entry->widget)); @@ -555,12 +635,20 @@ create_option_menu (const char *config_key, gpointer candidates_p, g_signal_connect ((gpointer) GTK_OPTION_MENU (entry->widget), "changed", G_CALLBACK (on_default_option_menu_changed), entry); +#endif +#if GTK_CHECK_VERSION(3, 0, 0) +#else if (!__widget_tooltips) __widget_tooltips = gtk_tooltips_new(); +#endif if (entry->tooltip) +#if GTK_CHECK_VERSION(3, 0, 0) + gtk_widget_set_tooltip_text (GTK_WIDGET (entry->widget), _(entry->tooltip)); +#else gtk_tooltips_set_tip (__widget_tooltips, GTK_WIDGET (entry->widget), _(entry->tooltip), NULL); +#endif return GTK_WIDGET (entry->widget); } @@ -590,7 +678,11 @@ create_color_button (const char *config_key) if (!entry) return NULL; +#if GTK_CHECK_VERSION(3, 0, 0) + GtkWidget *hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); +#else GtkWidget *hbox = gtk_hbox_new (FALSE, 0); +#endif gtk_container_set_border_width (GTK_CONTAINER (hbox), 4); gtk_widget_show (hbox); @@ -614,11 +706,18 @@ create_color_button (const char *config_key) gtk_label_set_mnemonic_widget (GTK_LABEL (label), GTK_WIDGET (entry->widget)); +#if GTK_CHECK_VERSION(3, 0, 0) +#else if (!__widget_tooltips) __widget_tooltips = gtk_tooltips_new(); +#endif if (entry->tooltip) +#if GTK_CHECK_VERSION(3, 0, 0) + gtk_widget_set_tooltip_text (GTK_WIDGET (entry->widget), _(entry->tooltip)); +#else gtk_tooltips_set_tip (__widget_tooltips, GTK_WIDGET (entry->widget), _(entry->tooltip), NULL); +#endif return hbox; } @@ -701,9 +800,15 @@ key_list_view_popup_key_selection (GtkTreeView *treeview) gtk_list_store_set (GTK_LIST_STORE (model), &iter, COLUMN_VALUE, data->value.c_str(), -1); +#if GTK_CHECK_VERSION(2, 24, 0) + gtk_combo_box_set_active( + GTK_COMBO_BOX (__widget_key_theme_menu), + KEY_THEME_INDEX_USER_DEFINED); +#else gtk_option_menu_set_history ( GTK_OPTION_MENU (__widget_key_theme_menu), KEY_THEME_INDEX_USER_DEFINED); +#endif data->changed = true; __config_changed = true; } @@ -718,7 +823,11 @@ create_common_page (void) { GtkWidget *vbox, *table, *widget; +#if GTK_CHECK_VERSION(3, 0, 0) + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); +#else vbox = gtk_vbox_new (FALSE, 0); +#endif gtk_widget_show (vbox); table = gtk_table_new (7, 2, FALSE); @@ -753,7 +862,11 @@ create_symbols_page (void) { GtkWidget *vbox, *table, *widget; +#if GTK_CHECK_VERSION(3, 0, 0) + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); +#else vbox = gtk_vbox_new (FALSE, 0); +#endif gtk_widget_show (vbox); table = gtk_table_new (7, 2, FALSE); @@ -793,10 +906,18 @@ create_keyboard_page (void) { GtkWidget *vbox, *hbox; +#if GTK_CHECK_VERSION(3, 0, 0) + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); +#else vbox = gtk_vbox_new (FALSE, 0); +#endif gtk_widget_show (vbox); +#if GTK_CHECK_VERSION(3, 0, 0) + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); +#else hbox = gtk_hbox_new (FALSE, 0); +#endif gtk_container_set_border_width (GTK_CONTAINER (hbox), 4); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); gtk_widget_show(hbox); @@ -806,6 +927,28 @@ create_keyboard_page (void) gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 2); gtk_widget_show (label); +#if GTK_CHECK_VERSION(2, 24, 0) + GtkWidget *omenu = gtk_combo_box_text_new (); + __widget_key_categories_menu = omenu; + gtk_box_pack_start (GTK_BOX (hbox), omenu, FALSE, FALSE, 2); + gtk_widget_show (omenu); + + gtk_label_set_mnemonic_widget (GTK_LABEL (label), omenu); + + gtk_combo_box_text_append_text + (GTK_COMBO_BOX_TEXT (omenu), + _("All")); + + for (unsigned int i = 0; i < __key_conf_pages_num; i++) { + gtk_combo_box_text_append_text + (GTK_COMBO_BOX_TEXT (omenu), + _(__key_conf_pages[i].label)); + } + + gtk_combo_box_text_append_text + (GTK_COMBO_BOX_TEXT (omenu), + _("Search by key")); +#else GtkWidget *omenu = gtk_option_menu_new (); __widget_key_categories_menu = omenu; gtk_box_pack_start (GTK_BOX (hbox), omenu, FALSE, FALSE, 2); @@ -833,10 +976,11 @@ create_keyboard_page (void) gtk_option_menu_set_menu (GTK_OPTION_MENU (omenu), menu); gtk_widget_show (menu); +#endif GtkWidget *entry = gtk_entry_new (); __widget_key_filter = entry; - gtk_entry_set_editable (GTK_ENTRY (entry), FALSE); + gtk_editable_set_editable (GTK_EDITABLE (entry), FALSE); gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 2); gtk_widget_show(entry); @@ -905,7 +1049,11 @@ create_keyboard_page (void) g_signal_connect (G_OBJECT (selection), "changed", G_CALLBACK (on_key_list_selection_changed), treeview); +#if GTK_CHECK_VERSION(3, 0, 0) + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); +#else hbox = gtk_hbox_new (FALSE, 0); +#endif gtk_container_set_border_width (GTK_CONTAINER (hbox), 4); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); gtk_widget_show(hbox); @@ -915,7 +1063,11 @@ create_keyboard_page (void) gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 2); gtk_widget_show (label); +#if GTK_CHECK_VERSION(2, 24, 0) + omenu = gtk_combo_box_text_new (); +#else omenu = gtk_option_menu_new (); +#endif __widget_key_theme_menu = omenu; g_signal_connect (G_OBJECT (omenu), "changed", G_CALLBACK (on_key_theme_menu_changed), NULL); @@ -945,10 +1097,18 @@ create_learning_page () GtkWidget *vbox, *vbox2, *hbox, *alignment, *table; GtkWidget *widget, *label; +#if GTK_CHECK_VERSION(3, 0, 0) + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); +#else vbox = gtk_vbox_new (FALSE, 0); +#endif gtk_widget_show (vbox); +#if GTK_CHECK_VERSION(3, 0, 0) + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); +#else hbox = gtk_hbox_new (FALSE, 0); +#endif gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 4); gtk_widget_show (hbox); @@ -962,7 +1122,11 @@ create_learning_page () gtk_box_pack_start (GTK_BOX (vbox), alignment, FALSE, FALSE, 0); gtk_widget_show (alignment); +#if GTK_CHECK_VERSION(3, 0, 0) + vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); +#else vbox2 = gtk_vbox_new (FALSE, 0); +#endif gtk_container_add (GTK_CONTAINER (alignment), vbox2); gtk_widget_show (vbox2); @@ -975,7 +1139,11 @@ create_learning_page () gtk_box_pack_start (GTK_BOX (vbox2), widget, FALSE, FALSE, 4); /* key preference */ +#if GTK_CHECK_VERSION(3, 0, 0) + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); +#else hbox = gtk_hbox_new (FALSE, 0); +#endif gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 4); gtk_widget_show (hbox); @@ -1008,7 +1176,7 @@ create_learning_page () { StringConfigData *entry = entries[i]; widget = create_entry (entry->key, GTK_TABLE (table), i); - gtk_entry_set_editable (GTK_ENTRY (widget), FALSE); + gtk_editable_set_editable (GTK_EDITABLE (widget), FALSE); create_key_select_button (entry->key, GTK_TABLE (table), i); } @@ -1020,7 +1188,11 @@ create_prediction_page () { GtkWidget *vbox, *widget; +#if GTK_CHECK_VERSION(3, 0, 0) + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); +#else vbox = gtk_vbox_new (FALSE, 0); +#endif gtk_widget_show (vbox); /* predict while inputting */ @@ -1084,7 +1256,11 @@ create_candidates_window_page (void) { GtkWidget *vbox, *widget, *table; +#if GTK_CHECK_VERSION(3, 0, 0) + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); +#else vbox = gtk_vbox_new (FALSE, 0); +#endif gtk_widget_show (vbox); /* show candidates label */ @@ -1115,7 +1291,11 @@ create_toolbar_page (void) { GtkWidget *vbox, *hbox, *label, *widget; +#if GTK_CHECK_VERSION(3, 0, 0) + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); +#else vbox = gtk_vbox_new (FALSE, 0); +#endif gtk_widget_show (vbox); /* show/hide toolbar label */ @@ -1141,7 +1321,11 @@ create_toolbar_page (void) NULL); gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 2); +#if GTK_CHECK_VERSION(3, 0, 0) + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); +#else hbox = gtk_hbox_new (FALSE, 0); +#endif gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 2); gtk_widget_show (hbox); label = gtk_label_new (" "); @@ -1166,7 +1350,11 @@ create_appearance_page (void) { GtkWidget *vbox, *table, *omenu, *widget, *hbox; +#if GTK_CHECK_VERSION(3, 0, 0) + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); +#else vbox = gtk_vbox_new (FALSE, 0); +#endif gtk_widget_show (vbox); table = gtk_table_new (2, 3, FALSE); @@ -1178,7 +1366,11 @@ create_appearance_page (void) &preedit_style, GTK_TABLE (table), 0); /* preedit color */ +#if GTK_CHECK_VERSION(3, 0, 0) + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); +#else hbox = gtk_hbox_new (FALSE, 0); +#endif gtk_widget_show (hbox); widget = create_color_button (SCIM_ANTHY_CONFIG_PREEDIT_FG_COLOR); gtk_box_pack_start (GTK_BOX (hbox), widget, FALSE, FALSE, 0); @@ -1187,15 +1379,24 @@ create_appearance_page (void) (GtkAttachOptions) (GTK_FILL), 4, 4); gtk_widget_set_sensitive (hbox, FALSE); +#if GTK_CHECK_VERSION(2, 24, 0) + g_signal_connect (G_OBJECT (omenu), "changed", + G_CALLBACK (on_preedit_style_menu_changed), hbox); +#else g_signal_connect ((gpointer) GTK_OPTION_MENU (omenu), "changed", G_CALLBACK (on_preedit_style_menu_changed), hbox); +#endif /* conversion style */ omenu = create_option_menu (SCIM_ANTHY_CONFIG_CONVERSION_STYLE, &preedit_style, GTK_TABLE (table), 1); /* conversion color */ +#if GTK_CHECK_VERSION(3, 0, 0) + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); +#else hbox = gtk_hbox_new (FALSE, 0); +#endif gtk_widget_show (hbox); widget = create_color_button (SCIM_ANTHY_CONFIG_CONVERSION_FG_COLOR); gtk_box_pack_start (GTK_BOX (hbox), widget, FALSE, FALSE, 0); @@ -1204,15 +1405,24 @@ create_appearance_page (void) (GtkAttachOptions) (GTK_FILL), 4, 4); gtk_widget_set_sensitive (hbox, FALSE); +#if GTK_CHECK_VERSION(2, 24, 0) + g_signal_connect (G_OBJECT (omenu), "changed", + G_CALLBACK (on_preedit_style_menu_changed), hbox); +#else g_signal_connect ((gpointer) GTK_OPTION_MENU (omenu), "changed", G_CALLBACK (on_preedit_style_menu_changed), hbox); +#endif /* selected segment style */ omenu = create_option_menu (SCIM_ANTHY_CONFIG_SELECTED_SEGMENT_STYLE, &preedit_style, GTK_TABLE (table), 2); /* selected segment color */ +#if GTK_CHECK_VERSION(3, 0, 0) + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); +#else hbox = gtk_hbox_new (FALSE, 0); +#endif gtk_widget_show (hbox); widget = create_color_button (SCIM_ANTHY_CONFIG_SELECTED_SEGMENT_FG_COLOR); gtk_box_pack_start (GTK_BOX (hbox), widget, FALSE, FALSE, 0); @@ -1221,8 +1431,13 @@ create_appearance_page (void) (GtkAttachOptions) (GTK_FILL), 4, 4); gtk_widget_set_sensitive (hbox, FALSE); +#if GTK_CHECK_VERSION(2, 24, 0) + g_signal_connect (G_OBJECT (omenu), "changed", + G_CALLBACK (on_preedit_style_menu_changed), hbox); +#else g_signal_connect ((gpointer) GTK_OPTION_MENU (omenu), "changed", G_CALLBACK (on_preedit_style_menu_changed), hbox); +#endif return vbox; } @@ -1233,7 +1448,11 @@ create_about_page () GtkWidget *vbox, *label; gchar str[256]; +#if GTK_CHECK_VERSION(3, 0, 0) + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); +#else vbox = gtk_vbox_new (FALSE, 0); +#endif gtk_widget_show (vbox); g_snprintf ( @@ -1355,8 +1574,24 @@ create_setup_window (void) } static void -setup_combo_value (GtkCombo *combo, const String & str) +setup_combo_value (GtkWidget *combo, const String & str) { +#if GTK_CHECK_VERSION(2, 24, 0) + ComboConfigCandidate *data + = static_cast + (g_object_get_data (G_OBJECT (gtk_bin_get_child (GTK_BIN (combo))), + DATA_POINTER_KEY)); + + gint default_index = -1; + for (unsigned int i = 0; data[i].label; i++) { + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), _(data[i].label)); + if (!strcmp (data[i].data, str.c_str ())) + default_index = i; + } + + if (default_index != -1) + gtk_combo_box_set_active (GTK_COMBO_BOX (combo), default_index); +#else GList *list = NULL; const char *defval = NULL; @@ -1371,15 +1606,16 @@ setup_combo_value (GtkCombo *combo, const String & str) defval = _(data[i].label); } - gtk_combo_set_popdown_strings (combo, list); + gtk_combo_set_popdown_strings (GTK_COMBO (combo), list); g_list_free (list); if (defval) - gtk_entry_set_text (GTK_ENTRY (combo->entry), defval); + gtk_entry_set_text (GTK_ENTRY (GTK_COMBO(combo)->entry), defval); +#endif } static void -setup_option_menu_value (GtkOptionMenu *omenu, const String & str) +setup_option_menu_value (GtkWidget *omenu, const String & str) { ComboConfigCandidate *data = static_cast @@ -1387,15 +1623,55 @@ setup_option_menu_value (GtkOptionMenu *omenu, const String & str) for (unsigned int i = 0; data[i].label; i++) { if (!strcmp (data[i].data, str.c_str ())) { - gtk_option_menu_set_history (omenu, i); +#if GTK_CHECK_VERSION(2, 24, 0) + gtk_combo_box_set_active (GTK_COMBO_BOX (omenu), i); +#else + gtk_option_menu_set_history (GTK_OPTION_MENU (omenu), i); +#endif return; } } } static void -setup_key_theme_menu (GtkOptionMenu *omenu) +setup_key_theme_menu (GtkWidget *omenu) { +#if GTK_CHECK_VERSION(2, 24, 0) + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (omenu), _("User defined")); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (omenu), _("Default")); + + gint active_index = KEY_THEME_INDEX_DEFAULT; + bool check_list = false; + if (__config_key_theme_file == __user_style_file.get_file_name () || + __config_key_theme == __user_style_file.get_title ()) { + active_index = KEY_THEME_INDEX_USER_DEFINED; + } else { + check_list = true; + } + + StyleFiles::iterator it; + gint i; + for (i = 0, it = __style_list.begin (); + it != __style_list.end (); + i++, it++) + { + const char *section_name = "KeyBindings"; + StyleLines section; + if (!it->get_entry_list (section, section_name)) + continue; + + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (omenu), _(it->get_title().c_str())); + + if (check_list) { + if (it->get_file_name () == __config_key_theme_file) { + active_index = i + 2; // 2: user-define + default + check_list = false; + } + } + } + + gtk_combo_box_set_active (GTK_COMBO_BOX (omenu), active_index); +#else GtkWidget *menu = gtk_menu_new (); gtk_option_menu_set_menu (GTK_OPTION_MENU (omenu), menu); @@ -1459,6 +1735,7 @@ setup_key_theme_menu (GtkOptionMenu *omenu) g_signal_handlers_unblock_by_func (G_OBJECT (omenu), (gpointer) (on_key_theme_menu_changed), NULL); +#endif } static void @@ -1480,12 +1757,22 @@ setup_widget_value (void) for (unsigned int i = 0; config_string_common[i].key; i++) { StringConfigData &entry = config_string_common[i]; +#if GTK_CHECK_VERSION(2, 24, 0) + if (entry.widget && GTK_IS_COMBO_BOX (entry.widget)) { + if (gtk_combo_box_get_has_entry (GTK_COMBO_BOX (entry.widget))) { + setup_combo_value (GTK_WIDGET (entry.widget), entry.value); + } else { + setup_option_menu_value (GTK_WIDGET (entry.widget), entry.value); + } + } +#else if (entry.widget && GTK_IS_OPTION_MENU (entry.widget)) { - setup_option_menu_value (GTK_OPTION_MENU (entry.widget), - entry.value); + setup_option_menu_value (GTK_WIDGET (entry.widget), entry.value); } else if (entry.widget && GTK_IS_COMBO (entry.widget)) { - setup_combo_value (GTK_COMBO (entry.widget), entry.value); - } else if (entry.widget && GTK_IS_ENTRY (entry.widget)) { + setup_combo_value (GTK_WIDGET (entry.widget), entry.value); + } +#endif + else if (entry.widget && GTK_IS_ENTRY (entry.widget)) { gtk_entry_set_text (GTK_ENTRY (entry.widget), entry.value.c_str ()); } @@ -1509,9 +1796,15 @@ setup_widget_value (void) } } +#if GTK_CHECK_VERSION(2, 24, 0) + gtk_combo_box_set_active + (GTK_COMBO_BOX (__widget_key_categories_menu), + KEY_CATEGORY_INDEX_ALL); +#else gtk_option_menu_set_history (GTK_OPTION_MENU (__widget_key_categories_menu), KEY_CATEGORY_INDEX_ALL); +#endif GtkTreeView *treeview = GTK_TREE_VIEW (__widget_key_list_view); GtkListStore *store = GTK_LIST_STORE (gtk_tree_view_get_model (treeview)); gtk_list_store_clear (store); @@ -1521,7 +1814,7 @@ setup_widget_value (void) gtk_widget_set_sensitive (__widget_key_filter_button, FALSE); // setup option menu - setup_key_theme_menu (GTK_OPTION_MENU (__widget_key_theme_menu)); + setup_key_theme_menu (__widget_key_theme_menu); } bool operator < (const StyleFile &left, const StyleFile &right) @@ -1822,7 +2115,7 @@ on_default_combo_changed (GtkEditable *editable, } static void -on_default_option_menu_changed (GtkOptionMenu *omenu, gpointer user_data) +on_default_option_menu_changed (GtkWidget *omenu, gpointer user_data) { StringConfigData *entry = static_cast (user_data); ComboConfigCandidate *data = static_cast @@ -1833,7 +2126,11 @@ on_default_option_menu_changed (GtkOptionMenu *omenu, gpointer user_data) if (!data) return; for (int i = 0; data[i].label; i++) { - if (i == gtk_option_menu_get_history (omenu)) { +#if GTK_CHECK_VERSION(2, 24, 0) + if (i == gtk_combo_box_get_active (GTK_COMBO_BOX (omenu))) { +#else + if (i == gtk_option_menu_get_history (GTK_OPTION_MENU (omenu))) { +#endif entry->value = data[i].data; entry->changed = true; __config_changed = true; @@ -1843,11 +2140,15 @@ on_default_option_menu_changed (GtkOptionMenu *omenu, gpointer user_data) } static void -on_preedit_style_menu_changed (GtkOptionMenu *omenu, gpointer user_data) +on_preedit_style_menu_changed (GtkWidget *omenu, gpointer user_data) { GtkWidget *widget = GTK_WIDGET (user_data); - gint idx = gtk_option_menu_get_history (omenu); +#if GTK_CHECK_VERSION(2, 24, 0) + gint idx = gtk_combo_box_get_active (GTK_COMBO_BOX (omenu)); +#else + gint idx = gtk_option_menu_get_history (GTK_OPTION_MENU (omenu)); +#endif for (int i = 0; preedit_style[i].data && i <= idx; i++) { if (i == idx && @@ -1879,14 +2180,18 @@ on_dict_menu_label_toggled (GtkToggleButton *togglebutton, } static void -on_key_category_menu_changed (GtkOptionMenu *omenu, gpointer user_data) +on_key_category_menu_changed (GtkWidget *omenu, gpointer user_data) { GtkTreeView *treeview = GTK_TREE_VIEW (user_data); GtkListStore *store = GTK_LIST_STORE (gtk_tree_view_get_model (treeview)); gtk_list_store_clear (store); - gint idx = gtk_option_menu_get_history (omenu); +#if GTK_CHECK_VERSION(2, 24, 0) + gint idx = gtk_combo_box_get_active (GTK_COMBO_BOX (omenu)); +#else + gint idx = gtk_option_menu_get_history (GTK_OPTION_MENU (omenu)); +#endif bool use_filter = false; @@ -1911,10 +2216,14 @@ on_key_category_menu_changed (GtkOptionMenu *omenu, gpointer user_data) } static void -on_key_theme_menu_changed (GtkOptionMenu *omenu, gpointer user_data) +on_key_theme_menu_changed (GtkWidget *omenu, gpointer user_data) { - gint idx = gtk_option_menu_get_history (omenu); - GtkWidget *menu = gtk_option_menu_get_menu (omenu); +#if GTK_CHECK_VERSION(2, 24, 0) + gint idx = gtk_combo_box_get_active (GTK_COMBO_BOX (omenu)); + gint theme_idx = idx - 2; // user definad and default +#else + gint idx = gtk_option_menu_get_history (GTK_OPTION_MENU (omenu)); + GtkWidget *menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (omenu)); GList *list = gtk_container_get_children (GTK_CONTAINER (menu)); GtkWidget *menuitem = GTK_WIDGET (g_list_nth_data (list, idx)); @@ -1923,6 +2232,7 @@ on_key_theme_menu_changed (GtkOptionMenu *omenu, gpointer user_data) gint theme_idx = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (menuitem), INDEX_KEY)); +#endif // clear all key bindings if (idx != 0) { @@ -1974,9 +2284,15 @@ on_key_theme_menu_changed (GtkOptionMenu *omenu, gpointer user_data) // sync widgets if (idx != KEY_THEME_INDEX_USER_DEFINED) { +#if GTK_CHECK_VERSION(2, 24, 0) + gtk_combo_box_set_active + (GTK_COMBO_BOX (__widget_key_categories_menu), + KEY_CATEGORY_INDEX_ALL); +#else gtk_option_menu_set_history (GTK_OPTION_MENU (__widget_key_categories_menu), KEY_CATEGORY_INDEX_ALL); +#endif gtk_widget_set_sensitive (__widget_key_filter, FALSE); gtk_widget_set_sensitive (__widget_key_filter_button, FALSE); GtkTreeModel *model; @@ -2041,8 +2357,13 @@ on_key_list_view_key_press (GtkWidget *widget, GdkEventKey *event, GtkTreeView *treeview = GTK_TREE_VIEW (widget); switch (event->keyval) { +#if GTK_CHECK_VERSION(3, 0, 0) + case GDK_KEY_Return: + case GDK_KEY_KP_Enter: +#else case GDK_Return: case GDK_KP_Enter: +#endif key_list_view_popup_key_selection (treeview); break; } diff --git a/src/scim_anthy_setup_kana.cpp b/src/scim_anthy_setup_kana.cpp index 1cc4740..4d3c2cc 100644 --- a/src/scim_anthy_setup_kana.cpp +++ b/src/scim_anthy_setup_kana.cpp @@ -65,15 +65,15 @@ static GtkWidget *create_kana_window (GtkWindow *pare static GtkWidget *create_nicola_window (GtkWindow *parent); static void setup_kana_page (void); -static void setup_kana_layout_menu (GtkOptionMenu *omenu); -static void setup_nicola_layout_menu (GtkOptionMenu *omenu); +static void setup_kana_layout_menu (GtkWidget *omenu); +static void setup_nicola_layout_menu (GtkWidget *omenu); static void setup_kana_window_value (ScimAnthyTableEditor *editor); static void setup_nicola_window_value (ScimAnthyTableEditor *editor); static bool load_kana_layout (void); static bool load_nicola_layout (void); -static void on_kana_layout_menu_changed (GtkOptionMenu *omenu, +static void on_kana_layout_menu_changed (GtkWidget *omenu, gpointer user_data); static void on_kana_customize_button_clicked (GtkWidget *button, gpointer data); @@ -85,7 +85,7 @@ static void on_kana_table_editor_remove_entry (ScimAnthyTableEditor *edit gpointer data); static void on_kana_table_editor_removed_entry (ScimAnthyTableEditor *editor, gpointer data); -static void on_nicola_layout_menu_changed (GtkOptionMenu *omenu, +static void on_nicola_layout_menu_changed (GtkWidget *omenu, gpointer user_data); static void on_nicola_customize_button_clicked (GtkWidget *button, gpointer data); @@ -103,11 +103,19 @@ kana_page_create_ui (void) { GtkWidget *vbox; +#if GTK_CHECK_VERSION(3, 0, 0) + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); +#else vbox = gtk_vbox_new (FALSE, 0); +#endif gtk_widget_show (vbox); // JIS Kana Layout +#if GTK_CHECK_VERSION(3, 0, 0) + GtkWidget *hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); +#else GtkWidget *hbox = gtk_hbox_new (FALSE, 0); +#endif gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 4); gtk_widget_show (hbox); @@ -122,7 +130,11 @@ kana_page_create_ui (void) gtk_widget_show (alignment); /* kana table */ +#if GTK_CHECK_VERSION(3, 0, 0) + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); +#else hbox = gtk_hbox_new (FALSE, 0); +#endif gtk_container_set_border_width (GTK_CONTAINER (hbox), 4); gtk_container_add (GTK_CONTAINER (alignment), hbox); gtk_widget_show(hbox); @@ -131,7 +143,11 @@ kana_page_create_ui (void) gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 2); gtk_widget_show (label); +#if GTK_CHECK_VERSION(2, 24, 0) + GtkWidget *omenu = gtk_combo_box_text_new (); +#else GtkWidget *omenu = gtk_option_menu_new (); +#endif __widget_kana_layout_menu = omenu; g_signal_connect (G_OBJECT (omenu), "changed", G_CALLBACK (on_kana_layout_menu_changed), NULL); @@ -148,7 +164,11 @@ kana_page_create_ui (void) // Thumb Shift Layout +#if GTK_CHECK_VERSION(3, 0, 0) + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); +#else hbox = gtk_hbox_new (FALSE, 0); +#endif gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 4); gtk_widget_show (hbox); @@ -162,12 +182,20 @@ kana_page_create_ui (void) gtk_box_pack_start (GTK_BOX (vbox), alignment, FALSE, FALSE, 0); gtk_widget_show (alignment); +#if GTK_CHECK_VERSION(3, 0, 0) + GtkWidget *vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); +#else GtkWidget *vbox2 = gtk_vbox_new (FALSE, 0); +#endif gtk_container_add (GTK_CONTAINER (alignment), vbox2); gtk_widget_show (vbox2); /* nicola table */ +#if GTK_CHECK_VERSION(3, 0, 0) + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); +#else hbox = gtk_hbox_new (FALSE, 0); +#endif gtk_container_set_border_width (GTK_CONTAINER (hbox), 4); gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0); gtk_widget_show(hbox); @@ -176,7 +204,11 @@ kana_page_create_ui (void) gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 2); gtk_widget_show (label); +#if GTK_CHECK_VERSION(2, 24, 0) + omenu = gtk_combo_box_text_new (); +#else omenu = gtk_option_menu_new (); +#endif __widget_nicola_layout_menu = omenu; g_signal_connect (G_OBJECT (omenu), "changed", G_CALLBACK (on_nicola_layout_menu_changed), NULL); @@ -192,7 +224,11 @@ kana_page_create_ui (void) gtk_widget_show (button); /* thumb shift keys */ +#if GTK_CHECK_VERSION(3, 0, 0) + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); +#else hbox = gtk_hbox_new (FALSE, 0); +#endif gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0); gtk_widget_show (hbox); @@ -203,14 +239,14 @@ kana_page_create_ui (void) // left GtkWidget *widget = create_entry (SCIM_ANTHY_CONFIG_LEFT_THUMB_SHIFT_KEY, GTK_TABLE (table), 0); - gtk_entry_set_editable (GTK_ENTRY (widget), FALSE); + gtk_editable_set_editable (GTK_EDITABLE (widget), FALSE); widget = create_key_select_button (SCIM_ANTHY_CONFIG_LEFT_THUMB_SHIFT_KEY, GTK_TABLE (table), 0); // right widget = create_entry (SCIM_ANTHY_CONFIG_RIGHT_THUMB_SHIFT_KEY, GTK_TABLE (table), 1); - gtk_entry_set_editable (GTK_ENTRY (widget), FALSE); + gtk_editable_set_editable (GTK_EDITABLE (widget), FALSE); widget = create_key_select_button (SCIM_ANTHY_CONFIG_RIGHT_THUMB_SHIFT_KEY, GTK_TABLE (table), 1); @@ -270,27 +306,50 @@ create_kana_window (GtkWindow *parent) _("Customize kana layout table")); // option menu area +#if GTK_CHECK_VERSION(3, 0, 0) + GtkWidget *hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); +#else GtkWidget *hbox = gtk_hbox_new (FALSE, 0); +#endif gtk_container_set_border_width (GTK_CONTAINER (hbox), 4); +#if GTK_CHECK_VERSION(3, 0, 0) + gtk_box_pack_start + (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), + hbox, FALSE, FALSE, 0); + gtk_box_reorder_child + (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), + hbox, 0); +#else gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox, FALSE, FALSE, 0); gtk_box_reorder_child (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox, 0); +#endif gtk_widget_show(hbox); GtkWidget *label = gtk_label_new_with_mnemonic (_("Layout _table:")); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 2); gtk_widget_show (label); +#if GTK_CHECK_VERSION(2, 24, 0) + GtkWidget *omenu = gtk_combo_box_text_new (); +#else GtkWidget *omenu = gtk_option_menu_new (); +#endif __widget_kana_layout_menu2 = omenu; g_object_add_weak_pointer (G_OBJECT (omenu), (gpointer*) &__widget_kana_layout_menu2); gtk_box_pack_start (GTK_BOX (hbox), omenu, FALSE, FALSE, 2); - setup_kana_layout_menu (GTK_OPTION_MENU (omenu)); + setup_kana_layout_menu (omenu); +#if GTK_CHECK_VERSION(2, 24, 0) + gtk_combo_box_set_active ( + GTK_COMBO_BOX (omenu), + gtk_combo_box_get_active (GTK_COMBO_BOX (__widget_kana_layout_menu))); +#else gtk_option_menu_set_history (GTK_OPTION_MENU (omenu), gtk_option_menu_get_history ( GTK_OPTION_MENU (__widget_kana_layout_menu))); +#endif gtk_widget_show (omenu); gtk_label_set_mnemonic_widget (GTK_LABEL(label), omenu); @@ -342,27 +401,50 @@ create_nicola_window (GtkWindow *parent) _("Customize thumb shift layout table")); // option menu area +#if GTK_CHECK_VERSION(3, 0, 0) + GtkWidget *hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); +#else GtkWidget *hbox = gtk_hbox_new (FALSE, 0); +#endif gtk_container_set_border_width (GTK_CONTAINER (hbox), 4); +#if GTK_CHECK_VERSION(3, 0, 0) + gtk_box_pack_start + (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), + hbox, FALSE, FALSE, 0); + gtk_box_reorder_child + (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), + hbox, 0); +#else gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox, FALSE, FALSE, 0); gtk_box_reorder_child (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox, 0); +#endif gtk_widget_show(hbox); GtkWidget *label = gtk_label_new_with_mnemonic (_("Layout _table:")); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 2); gtk_widget_show (label); +#if GTK_CHECK_VERSION(2, 24, 0) + GtkWidget *omenu = gtk_combo_box_text_new (); +#else GtkWidget *omenu = gtk_option_menu_new (); +#endif __widget_nicola_layout_menu2 = omenu; g_object_add_weak_pointer (G_OBJECT (omenu), (gpointer*) &__widget_nicola_layout_menu2); gtk_box_pack_start (GTK_BOX (hbox), omenu, FALSE, FALSE, 2); - setup_nicola_layout_menu (GTK_OPTION_MENU (omenu)); + setup_nicola_layout_menu (omenu); +#if GTK_CHECK_VERSION(2, 24, 0) + gtk_combo_box_set_active ( + GTK_COMBO_BOX (omenu), + gtk_combo_box_get_active (GTK_COMBO_BOX (__widget_nicola_layout_menu))); +#else gtk_option_menu_set_history (GTK_OPTION_MENU (omenu), gtk_option_menu_get_history ( GTK_OPTION_MENU (__widget_nicola_layout_menu))); +#endif gtk_widget_show (omenu); gtk_label_set_mnemonic_widget (GTK_LABEL(label), omenu); @@ -397,13 +479,48 @@ create_nicola_window (GtkWindow *parent) static void setup_kana_page (void) { - setup_kana_layout_menu (GTK_OPTION_MENU (__widget_kana_layout_menu)); - setup_nicola_layout_menu (GTK_OPTION_MENU (__widget_nicola_layout_menu)); + setup_kana_layout_menu (__widget_kana_layout_menu); + setup_nicola_layout_menu (__widget_nicola_layout_menu); } static void -setup_kana_layout_menu (GtkOptionMenu *omenu) +setup_kana_layout_menu (GtkWidget *omenu) { +#if GTK_CHECK_VERSION(2, 24, 0) + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (omenu), _("User defined")); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (omenu), _("Default")); + + gint active_index = KANA_LAYOUT_INDEX_DEFAULT; + bool check_list = false; + if (__config_kana_layout_file == __user_style_file.get_file_name ()) { + active_index = KANA_LAYOUT_INDEX_USER_DEFINED; + } else { + check_list = true; + } + + StyleFiles::iterator it; + gint i; + for (i = 0, it = __style_list.begin (); + it != __style_list.end (); + i++, it++) + { + StyleLines section; + if (!it->get_entry_list (section, __kana_fund_table)) + continue; + + gtk_combo_box_text_append_text + (GTK_COMBO_BOX_TEXT (omenu), _(it->get_title().c_str())); + + if (check_list) { + if (it->get_file_name () == __config_kana_layout_file) { + active_index = i + 2; // 2: user-define + default + check_list = false; + } + } + } + + gtk_combo_box_set_active (GTK_COMBO_BOX (omenu), active_index); +#else GtkWidget *menu = gtk_menu_new (); gtk_option_menu_set_menu (GTK_OPTION_MENU (omenu), menu); @@ -466,11 +583,47 @@ setup_kana_layout_menu (GtkOptionMenu *omenu) G_OBJECT (omenu), (gpointer) (on_kana_layout_menu_changed), NULL); +#endif } static void -setup_nicola_layout_menu (GtkOptionMenu *omenu) +setup_nicola_layout_menu (GtkWidget *omenu) { +#if GTK_CHECK_VERSION(2, 24, 0) + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (omenu), _("User defined")); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (omenu), _("Default")); + + gint active_index = NICOLA_LAYOUT_INDEX_DEFAULT; + bool check_list = false; + if (__config_nicola_layout_file == __user_style_file.get_file_name ()) { + active_index = NICOLA_LAYOUT_INDEX_USER_DEFINED; + } else { + check_list = true; + } + + StyleFiles::iterator it; + gint i; + for (i = 0, it = __style_list.begin (); + it != __style_list.end (); + i++, it++) + { + StyleLines section; + if (!it->get_entry_list (section, __nicola_fund_table)) + continue; + + gtk_combo_box_text_append_text ( + GTK_COMBO_BOX_TEXT (omenu), _(it->get_title().c_str())); + + if (check_list) { + if (it->get_file_name () == __config_nicola_layout_file) { + active_index = i + 2; // 2: user-define + default + check_list = false; + } + } + } + + gtk_combo_box_set_active (GTK_COMBO_BOX (omenu), active_index); +#else GtkWidget *menu = gtk_menu_new (); gtk_option_menu_set_menu (GTK_OPTION_MENU (omenu), menu); @@ -533,6 +686,7 @@ setup_nicola_layout_menu (GtkOptionMenu *omenu) G_OBJECT (omenu), (gpointer) (on_nicola_layout_menu_changed), NULL); +#endif } static void @@ -647,6 +801,10 @@ setup_default_nicola_table (void) static bool load_kana_layout (void) { +#if GTK_CHECK_VERSION(2, 24, 0) + gint idx = gtk_combo_box_get_active (GTK_COMBO_BOX (__widget_kana_layout_menu)); + gint theme_idx = idx - 2; // user definad and default +#else GtkOptionMenu *omenu = GTK_OPTION_MENU (__widget_kana_layout_menu); gint idx = gtk_option_menu_get_history (omenu); GtkWidget *menu = gtk_option_menu_get_menu (omenu); @@ -658,6 +816,7 @@ load_kana_layout (void) gint theme_idx = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (menuitem), INDEX_KEY)); +#endif // set new kana table if (idx == KANA_LAYOUT_INDEX_USER_DEFINED) { @@ -707,6 +866,10 @@ load_kana_layout (void) static bool load_nicola_layout (void) { +#if GTK_CHECK_VERSION(2, 24, 0) + gint idx = gtk_combo_box_get_active (GTK_COMBO_BOX (__widget_nicola_layout_menu)); + gint theme_idx = idx - 2; // user definad and default +#else GtkOptionMenu *omenu = GTK_OPTION_MENU (__widget_nicola_layout_menu); gint idx = gtk_option_menu_get_history (omenu); GtkWidget *menu = gtk_option_menu_get_menu (omenu); @@ -718,6 +881,7 @@ load_nicola_layout (void) gint theme_idx = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (menuitem), INDEX_KEY)); +#endif // set new NICOLA table if (idx == NICOLA_LAYOUT_INDEX_USER_DEFINED) { @@ -785,7 +949,7 @@ has_voiced_consonant (String str) } static void -on_kana_layout_menu_changed (GtkOptionMenu *omenu, gpointer user_data) +on_kana_layout_menu_changed (GtkWidget *omenu, gpointer user_data) { bool success; @@ -794,9 +958,15 @@ on_kana_layout_menu_changed (GtkOptionMenu *omenu, gpointer user_data) G_OBJECT (__widget_kana_layout_menu), (gpointer) (on_kana_layout_menu_changed), NULL); +#if GTK_CHECK_VERSION(2, 24, 0) + gtk_combo_box_set_active ( + GTK_COMBO_BOX (__widget_kana_layout_menu), + gtk_combo_box_get_active (GTK_COMBO_BOX (omenu))); +#else gtk_option_menu_set_history ( GTK_OPTION_MENU (__widget_kana_layout_menu), - gtk_option_menu_get_history (omenu)); + gtk_option_menu_get_history (GTK_OPTION_MENU (omenu))); +#endif g_signal_handlers_unblock_by_func ( G_OBJECT (__widget_kana_layout_menu), (gpointer) (on_kana_layout_menu_changed), @@ -844,9 +1014,15 @@ static void on_kana_table_editor_added_entry (ScimAnthyTableEditor *editor, gpointer data) { // change menu item to "User defined" +#if GTK_CHECK_VERSION(2, 24, 0) + gtk_combo_box_set_active ( + GTK_COMBO_BOX (__widget_kana_layout_menu2), + KANA_LAYOUT_INDEX_USER_DEFINED); +#else gtk_option_menu_set_history ( GTK_OPTION_MENU (__widget_kana_layout_menu2), KANA_LAYOUT_INDEX_USER_DEFINED); +#endif __style_changed = true; } @@ -865,15 +1041,21 @@ static void on_kana_table_editor_removed_entry (ScimAnthyTableEditor *editor, gpointer data) { // change menu item to "User deined" +#if GTK_CHECK_VERSION(2, 24, 0) + gtk_combo_box_set_active ( + GTK_COMBO_BOX (__widget_kana_layout_menu2), + KANA_LAYOUT_INDEX_USER_DEFINED); +#else gtk_option_menu_set_history ( GTK_OPTION_MENU (__widget_kana_layout_menu2), KANA_LAYOUT_INDEX_USER_DEFINED); +#endif __style_changed = true; } static void -on_nicola_layout_menu_changed (GtkOptionMenu *omenu, gpointer user_data) +on_nicola_layout_menu_changed (GtkWidget *omenu, gpointer user_data) { bool success; @@ -882,9 +1064,15 @@ on_nicola_layout_menu_changed (GtkOptionMenu *omenu, gpointer user_data) G_OBJECT (__widget_nicola_layout_menu), (gpointer) (on_nicola_layout_menu_changed), NULL); +#if GTK_CHECK_VERSION(2, 24, 0) + gtk_combo_box_set_active ( + GTK_COMBO_BOX (__widget_nicola_layout_menu), + gtk_combo_box_get_active (GTK_COMBO_BOX (omenu))); +#else gtk_option_menu_set_history ( GTK_OPTION_MENU (__widget_nicola_layout_menu), - gtk_option_menu_get_history (omenu)); + gtk_option_menu_get_history (GTK_OPTION_MENU (omenu))); +#endif g_signal_handlers_unblock_by_func ( G_OBJECT (__widget_nicola_layout_menu), (gpointer) (on_nicola_layout_menu_changed), @@ -928,9 +1116,15 @@ static void on_nicola_table_editor_added_entry (ScimAnthyTableEditor *editor, gpointer data) { // change menu item to "User defined" +#if GTK_CHECK_VERSION(2, 24, 0) + gtk_combo_box_set_active ( + GTK_COMBO_BOX (__widget_nicola_layout_menu2), + NICOLA_LAYOUT_INDEX_USER_DEFINED); +#else gtk_option_menu_set_history ( GTK_OPTION_MENU (__widget_nicola_layout_menu2), NICOLA_LAYOUT_INDEX_USER_DEFINED); +#endif __style_changed = true; } @@ -949,9 +1143,15 @@ static void on_nicola_table_editor_removed_entry (ScimAnthyTableEditor *editor, gpointer data) { // change menu item to "User deined" +#if GTK_CHECK_VERSION(2, 24, 0) + gtk_combo_box_set_active ( + GTK_COMBO_BOX (__widget_nicola_layout_menu2), + NICOLA_LAYOUT_INDEX_USER_DEFINED); +#else gtk_option_menu_set_history ( GTK_OPTION_MENU (__widget_nicola_layout_menu2), NICOLA_LAYOUT_INDEX_USER_DEFINED); +#endif __style_changed = true; } diff --git a/src/scim_anthy_setup_romaji.cpp b/src/scim_anthy_setup_romaji.cpp index 5739c57..6ead177 100644 --- a/src/scim_anthy_setup_romaji.cpp +++ b/src/scim_anthy_setup_romaji.cpp @@ -55,14 +55,14 @@ static String __config_romaji_theme_file = SCIM_ANTHY_CONFIG_ROMAJI_THEME_FILE_D static GtkWidget *create_romaji_window (GtkWindow *parent); static void setup_romaji_page (void); -static void setup_romaji_theme_menu (GtkOptionMenu *omenu); +static void setup_romaji_theme_menu (GtkWidget *omenu); static void setup_romaji_window_value (ScimAnthyTableEditor *editor); static bool load_romaji_theme (void); static void on_romaji_pseudo_ascii_mode_toggled(GtkToggleButton *togglebutton, gpointer user_data); -static void on_romaji_theme_menu_changed (GtkOptionMenu *omenu, +static void on_romaji_theme_menu_changed (GtkWidget *omenu, gpointer user_data); static void on_romaji_customize_button_clicked (GtkWidget *button, gpointer data); @@ -80,7 +80,11 @@ romaji_page_create_ui (void) { GtkWidget *vbox, *widget, *hbox, *label; +#if GTK_CHECK_VERSION(3, 0, 0) + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); +#else vbox = gtk_vbox_new (FALSE, 0); +#endif gtk_widget_show (vbox); /* romaji splitting */ @@ -103,7 +107,11 @@ romaji_page_create_ui (void) gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 4); /* pseudo ascii: blank behavior */ +#if GTK_CHECK_VERSION(3, 0, 0) + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); +#else hbox = gtk_hbox_new (FALSE, 0); +#endif gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 4); gtk_widget_show (hbox); label = gtk_label_new (" "); @@ -116,7 +124,11 @@ romaji_page_create_ui (void) on_romaji_pseudo_ascii_mode_toggled (GTK_TOGGLE_BUTTON (widget), NULL); /* romaji table */ +#if GTK_CHECK_VERSION(3, 0, 0) + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); +#else hbox = gtk_hbox_new (FALSE, 0); +#endif gtk_container_set_border_width (GTK_CONTAINER (hbox), 4); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); gtk_widget_show(hbox); @@ -125,7 +137,11 @@ romaji_page_create_ui (void) gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 2); gtk_widget_show (label); +#if GTK_CHECK_VERSION(2, 24, 0) + GtkWidget *omenu = gtk_combo_box_text_new (); +#else GtkWidget *omenu = gtk_option_menu_new (); +#endif __widget_romaji_theme_menu = omenu; g_signal_connect (G_OBJECT (omenu), "changed", G_CALLBACK (on_romaji_theme_menu_changed), NULL); @@ -185,27 +201,52 @@ create_romaji_window (GtkWindow *parent) _("Customize romaji table")); // option menu area +#if GTK_CHECK_VERSION(3, 0, 0) + GtkWidget *hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); +#else GtkWidget *hbox = gtk_hbox_new (FALSE, 0); +#endif + gtk_container_set_border_width (GTK_CONTAINER (hbox), 4); + +#if GTK_CHECK_VERSION(3, 0, 0) + gtk_box_pack_start + (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), + hbox, FALSE, FALSE, 0); + gtk_box_reorder_child + (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), + hbox, 0); +#else gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox, FALSE, FALSE, 0); gtk_box_reorder_child (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox, 0); +#endif + gtk_widget_show(hbox); GtkWidget *label = gtk_label_new_with_mnemonic (_("Romaji _table:")); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 2); gtk_widget_show (label); +#if GTK_CHECK_VERSION(2, 24, 0) + GtkWidget *omenu = gtk_combo_box_text_new (); +#else GtkWidget *omenu = gtk_option_menu_new (); +#endif __widget_romaji_theme_menu2 = omenu; g_object_add_weak_pointer (G_OBJECT (omenu), (gpointer*) &__widget_romaji_theme_menu2); gtk_box_pack_start (GTK_BOX (hbox), omenu, FALSE, FALSE, 2); - setup_romaji_theme_menu (GTK_OPTION_MENU (omenu)); + setup_romaji_theme_menu (omenu); +#if GTK_CHECK_VERSION(2, 24, 0) + gtk_combo_box_set_active (GTK_COMBO_BOX (omenu), + gtk_combo_box_get_active (GTK_COMBO_BOX (__widget_romaji_theme_menu))); +#else gtk_option_menu_set_history (GTK_OPTION_MENU (omenu), gtk_option_menu_get_history ( GTK_OPTION_MENU (__widget_romaji_theme_menu))); +#endif gtk_widget_show (omenu); gtk_label_set_mnemonic_widget (GTK_LABEL(label), omenu); @@ -240,12 +281,47 @@ create_romaji_window (GtkWindow *parent) static void setup_romaji_page (void) { - setup_romaji_theme_menu (GTK_OPTION_MENU (__widget_romaji_theme_menu)); + setup_romaji_theme_menu (__widget_romaji_theme_menu); } static void -setup_romaji_theme_menu (GtkOptionMenu *omenu) +setup_romaji_theme_menu (GtkWidget *omenu) { +#if GTK_CHECK_VERSION(2, 24, 0) + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (omenu), _("User defined")); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (omenu), _("Default")); + + gint active_index = ROMAJI_THEME_INDEX_DEFAULT; + bool check_list = false; + if (__config_romaji_theme_file == __user_style_file.get_file_name ()) { + active_index = ROMAJI_THEME_INDEX_USER_DEFINED; + } else { + check_list = true; + } + + StyleFiles::iterator it; + unsigned int i; + for (i = 0, it = __style_list.begin (); + it != __style_list.end (); + i++, it++) + { + StyleLines section; + if (!it->get_entry_list (section, __romaji_fund_table)) + continue; + + gtk_combo_box_text_append_text + (GTK_COMBO_BOX_TEXT (omenu), _(it->get_title().c_str())); + + if (check_list) { + if (it->get_file_name () == __config_romaji_theme_file) { + active_index = i + 2; // 2: user-define + default + check_list = false; + } + } + } + + gtk_combo_box_set_active (GTK_COMBO_BOX (omenu), active_index); +#else GtkWidget *menu = gtk_menu_new (); gtk_option_menu_set_menu (GTK_OPTION_MENU (omenu), menu); @@ -308,6 +384,7 @@ setup_romaji_theme_menu (GtkOptionMenu *omenu) G_OBJECT (omenu), (gpointer) (on_romaji_theme_menu_changed), NULL); +#endif } static void @@ -367,6 +444,11 @@ setup_default_romaji_table (void) static bool load_romaji_theme (void) { +#if GTK_CHECK_VERSION(2, 24, 0) + GtkWidget *omenu = __widget_romaji_theme_menu; + gint idx = gtk_combo_box_get_active (GTK_COMBO_BOX (omenu)); + gint theme_idx = idx - 2; // 2: user-defined + default +#else GtkOptionMenu *omenu = GTK_OPTION_MENU (__widget_romaji_theme_menu); gint idx = gtk_option_menu_get_history (omenu); GtkWidget *menu = gtk_option_menu_get_menu (omenu); @@ -378,6 +460,7 @@ load_romaji_theme (void) gint theme_idx = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (menuitem), INDEX_KEY)); +#endif // set new romaji table if (idx == ROMAJI_THEME_INDEX_USER_DEFINED) { @@ -437,7 +520,7 @@ on_romaji_pseudo_ascii_mode_toggled (GtkToggleButton *togglebutton, } static void -on_romaji_theme_menu_changed (GtkOptionMenu *omenu, gpointer user_data) +on_romaji_theme_menu_changed (GtkWidget *omenu, gpointer user_data) { bool success; @@ -446,9 +529,15 @@ on_romaji_theme_menu_changed (GtkOptionMenu *omenu, gpointer user_data) G_OBJECT (__widget_romaji_theme_menu), (gpointer) (on_romaji_theme_menu_changed), NULL); +#if GTK_CHECK_VERSION(2, 24, 0) + gtk_combo_box_set_active ( + GTK_COMBO_BOX (__widget_romaji_theme_menu), + gtk_combo_box_get_active (GTK_COMBO_BOX (omenu))); +#else gtk_option_menu_set_history ( GTK_OPTION_MENU (__widget_romaji_theme_menu), - gtk_option_menu_get_history (omenu)); + gtk_option_menu_get_history (GTK_OPTION_MENU (omenu))); +#endif g_signal_handlers_unblock_by_func ( G_OBJECT (__widget_romaji_theme_menu), (gpointer) (on_romaji_theme_menu_changed), @@ -492,9 +581,15 @@ static void on_table_editor_added_entry (ScimAnthyTableEditor *editor, gpointer data) { // change menu item to "User defined" +#if GTK_CHECK_VERSION(2, 24, 0) + gtk_combo_box_set_active ( + GTK_COMBO_BOX (__widget_romaji_theme_menu2), + ROMAJI_THEME_INDEX_USER_DEFINED); +#else gtk_option_menu_set_history ( GTK_OPTION_MENU (__widget_romaji_theme_menu2), ROMAJI_THEME_INDEX_USER_DEFINED); +#endif __style_changed = true; } @@ -515,9 +610,15 @@ static void on_table_editor_removed_entry (ScimAnthyTableEditor *editor, gpointer data) { // change menu item to "User deined" +#if GTK_CHECK_VERSION(2, 24, 0) + gtk_combo_box_set_active ( + GTK_COMBO_BOX (__widget_romaji_theme_menu2), + ROMAJI_THEME_INDEX_USER_DEFINED); +#else gtk_option_menu_set_history ( GTK_OPTION_MENU (__widget_romaji_theme_menu2), ROMAJI_THEME_INDEX_USER_DEFINED); +#endif __style_changed = true; } diff --git a/src/scim_anthy_table_editor.cpp b/src/scim_anthy_table_editor.cpp index 1a70123..cdc660d 100644 --- a/src/scim_anthy_table_editor.cpp +++ b/src/scim_anthy_table_editor.cpp @@ -132,10 +132,20 @@ scim_anthy_table_editor_init (ScimAnthyTableEditor *editor) GTK_WIN_POS_CENTER_ON_PARENT); // edit area +#if GTK_CHECK_VERSION(3, 0, 0) + GtkWidget *hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); +#else GtkWidget *hbox = gtk_hbox_new (FALSE, 0); +#endif gtk_container_set_border_width (GTK_CONTAINER (hbox), 5); +#if GTK_CHECK_VERSION(3, 0, 0) + gtk_box_pack_start + (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (editor))), + hbox, TRUE, TRUE, 0); +#else gtk_box_pack_start (GTK_BOX (GTK_DIALOG (editor)->vbox), hbox, TRUE, TRUE, 0); +#endif gtk_widget_show (hbox); // tree view area @@ -162,7 +172,11 @@ scim_anthy_table_editor_init (ScimAnthyTableEditor *editor) gtk_tree_view_set_headers_clickable (GTK_TREE_VIEW (treeview), TRUE); // button area +#if GTK_CHECK_VERSION(3, 0, 0) + GtkWidget *vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); +#else GtkWidget *vbox = gtk_vbox_new (FALSE, 0); +#endif editor->button_area = vbox; gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 5); gtk_widget_show (vbox); debian/patches/no-rpath.patch0000644000000000000000000000157712156552261013405 0ustar Description: remove rpath Author: Osamu Aoki --- a/src/Makefile.am +++ b/src/Makefile.am @@ -76,7 +76,6 @@ anthy_la_LDFLAGS = \ -avoid-version \ - -rpath $(moduledir) \ -module \ @LIBTOOL_EXPORT_OPTIONS@ \ @SCIM_LIBS@ \ @@ -111,7 +110,6 @@ @SCIM_CFLAGS@ \ @SCIM_DEBUG_FLAGS@ anthy_imengine_setup_la_LDFLAGS = -avoid-version \ - -rpath $(setupmoduledir) \ -module \ @LIBTOOL_EXPORT_OPTIONS@ \ @SCIM_GTKUTILS_LIBS@ \ @@ -136,7 +134,6 @@ @SCIM_CFLAGS@ \ @SCIM_DEBUG_FLAGS@ anthy_imengine_helper_la_LDFLAGS = -avoid-version \ - -rpath $(setupmoduledir) \ -module \ @LIBTOOL_EXPORT_OPTIONS@ \ @GTK2_LIBS@ \ debian/patches/series0000644000000000000000000000005112156552261012033 0ustar commited.patch no-rpath.patch gtk3.patch debian/rules0000755000000000000000000000141412156552261010253 0ustar #!/usr/bin/make -f export DH_VERBOSE=1 export DH_OPTIONS=-v export DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) %: dh $@ --with autotools-dev,autoreconf # If --with autoreconf is not available, uncoment line # with "autoreconf -i -f" while # debian/control: Build-Depends: entry "dh-autoreconf" replaced # by "perl, debhelper, autoconf, automake | automaken, libtool". override_dh_auto_configure: # autoreconf dh_auto_configure -- $(shell dpkg-buildflags --export=configure) --disable-static override_dh_auto_build: dh_auto_build dh_auto_build -- update-gmo -C po override_dh_makeshlibs: override_dh_auto_install: dh_auto_install # these are not used. rm debian/scim-anthy/usr/lib/$(DEB_HOST_MULTIARCH)/scim-1.0/*/*/*.la # vim:textwidth=0: debian/source/0000755000000000000000000000000012156552261010473 5ustar debian/source/format0000644000000000000000000000001412156552261011701 0ustar 3.0 (quilt) debian/watch0000644000000000000000000000055212156552261010226 0ustar # Compulsory line, this is a version 3 file version=3 opts="downloadurlmangle=s/sourceforge/iij.dl.sourceforge/;s/downloads\///;s/projects\///;s/gz\//gz/,\ uversionmangle=s/-beta/~beta/;s/-rc/~rc/;s/-preview/~preview/" \ http://sourceforge.jp/projects/scim-imengine/releases/ \ /projects/scim-imengine/downloads/.*/scim-anthy-(1\.2.*)\.tar.gz/ debian uupdate