Revision: 6940
Author: nogu.dev
Date: Fri Feb 11 22:21:43 2011
Log: * configure.ac
- (AC_CONFIG_FILES): Add gtk3/candwin/Makefile gtk3/dict/Makefile.
* gtk/caret-state-indicator.c
- (caret_state_indicator_paint_window): Replace gtk_paint_flat_box()
with gtk_render_frame() in GTK+3.
* gtk3/Makefile.am
- (SUBDIRS): Add candwin dict.
* gtk3/candwin/Makefile.am
- New file.
* gtk3/dict/Makefile.am
- New file.
* helper/candwin-gtk.c
- (str_parse): Replace gtk_widget_hide() with gtk_widget_hide_all().
- (main): Don't call gtk_set_locale().
- (uim_cand_win_gtk_layout_sub_window):
Follow change of gdk_window_get_geometry() in GTK+3.
* helper/candwin-tbl-gtk.c
- (str_parse): Replace gtk_widget_hide() with gtk_widget_hide_all().
- (main): Don't call gtk_set_locale().
* helper/dict-main-gtk.c
- (main): Don't call gtk_set_locale().
* helper/dict-word-list-view-gtk.c
- (word_list_view_class_init, word_list_view_destroy):
Replace GtkObject with GtkWidget in GTK+3.
- (word_list_view_init): Replace deprecated macro GTK_WIDGET_SET_FLAGS
with gtk_widget_set_can_focus() and gtk_widget_set_receives_default().
* helper/dict-word-list-view-gtk.h
- Don't include gtk/gtkscrolledwindow.h, gtk/gtktreemodel.h
or gtk/gtktreeview.h directly.
* helper/dict-word-list-win-gtk.c
- (word_list_window_init): Use gtk_bin_get_child().
- (activate_url, help_about_action_cb): Don't call unneeded
gtk_about_dialog_set_url_hook().
* helper/dict-word-win-gtk.c
- (word_window_init): Use gtk_dialog_get_action_area().
- (word_window_necessary_create):
* Replace gtk_combo_box_new_text() with gtk_combo_box_text_new().
* Replace gtk_combo_box_append_text()
with gtk_combo_box_text_append_text().
http://code.google.com/p/uim/source/detail?r=6940
Added:
/trunk/gtk3/candwin
/trunk/gtk3/candwin/Makefile.am
/trunk/gtk3/dict
/trunk/gtk3/dict/Makefile.am
Modified:
/trunk/configure.ac
/trunk/gtk/caret-state-indicator.c
/trunk/gtk3/Makefile.am
/trunk/helper/candwin-gtk.c
/trunk/helper/candwin-tbl-gtk.c
/trunk/helper/dict-main-gtk.c
/trunk/helper/dict-word-list-view-gtk.c
/trunk/helper/dict-word-list-view-gtk.h
/trunk/helper/dict-word-list-win-gtk.c
/trunk/helper/dict-word-win-gtk.c
=======================================
--- /dev/null
+++ /trunk/gtk3/candwin/Makefile.am Fri Feb 11 22:21:43 2011
@@ -0,0 +1,18 @@
+if GTK3
+libexec_PROGRAMS = uim-candwin-gtk3 uim-candwin-tbl-gtk3
+uim_candwin_gtk3_SOURCES = ../../helper/candwin-gtk.c \
+ ../../gtk/caret-state-indicator.c \
+ ../../gtk/caret-state-indicator.h
+uim_candwin_gtk3_LDADD = @GTK3_LIBS@ $(top_builddir)/uim/libuim-scm.la \
+ $(top_builddir)/uim/libuim.la
+uim_candwin_gtk3_CPPFLAGS = -I$(top_srcdir)
+uim_candwin_gtk3_CFLAGS = @GTK3_CFLAGS@
+
+uim_candwin_tbl_gtk3_SOURCES = ../../helper/candwin-tbl-gtk.c \
+ ../../gtk/caret-state-indicator.c \
+ ../../gtk/caret-state-indicator.h
+uim_candwin_tbl_gtk3_LDADD = @GTK3_LIBS@
$(top_builddir)/uim/libuim-scm.la \
+ $(top_builddir)/uim/libuim.la
+uim_candwin_tbl_gtk3_CPPFLAGS = -I$(top_srcdir)
+uim_candwin_tbl_gtk3_CFLAGS = @GTK3_CFLAGS@
+endif
=======================================
--- /dev/null
+++ /trunk/gtk3/dict/Makefile.am Fri Feb 11 22:21:43 2011
@@ -0,0 +1,44 @@
+if GTK3
+if DICT
+
+helper_defs = -DUIM_DATADIR=\""$(datadir)/@PACKAGE@"\"
+
+bin_PROGRAMS = uim-dict-gtk3
+uim_dict_gtk3_SOURCES = ../../helper/dict-main-gtk.c \
+ ../../helper/dict-canna-cclass.c
../../helper/dict-canna-cclass.h \
+ ../../helper/dict-word-win-gtk.c
../../helper/dict-word-win-gtk.h \
+ ../../helper/dict-word-list-win-gtk.c \
+ ../../helper/dict-word-list-win-gtk.h \
+ ../../helper/dict-util.c ../../helper/dict-util.h \
+ ../../helper/dict-word-list-view-gtk.c \
+ ../../helper/dict-word-list-view-gtk.h \
+ ../../helper/dict-word.c ../../helper/dict-word.h \
+ ../../helper/dict-dict.c ../../helper/dict-dict.h \
+ ../../helper/dict-cclass-dialog.c dict-cclass-dialog.h
+
+uim_dict_gtk3_LDADD = @GTK3_LIBS@ $(top_builddir)/uim/libuim-scm.la \
+ $(top_builddir)/uim/libuim.la
+uim_dict_gtk3_CPPFLAGS = $(helper_defs) -I$(top_srcdir) -I$(top_builddir)
+uim_dict_gtk3_CFLAGS = @GTK3_CFLAGS@
+uim_dict_uidir = $(datadir)/uim/helperdata
+uim_dict_ui_DATA = ../../helper/uim-dict-ui.xml
+if ANTHY
+uim_dict_gtk3_SOURCES
+= ../../helper/dict-anthy.c ../../helper/dict-anthy.h
+uim_dict_gtk3_LDADD += @ANTHY_LIBS@
+uim_dict_gtk3_CPPFLAGS += -DUSE_ANTHY
+else
+if ANTHY_UTF8
+uim_dict_gtk3_SOURCES
+= ../../helper/dict-anthy.c ../../helper/dict-anthy.h
+uim_dict_gtk3_LDADD += @ANTHY_UTF8_LIBS@
+uim_dict_gtk3_CPPFLAGS += -DUSE_ANTHY @ANTHY_UTF8_CFLAGS@
+endif
+endif
+if DICT_CANNA
+uim_dict_gtk3_SOURCES
+= ../../helper/dict-canna.c ../../helper/dict-canna.h
+uim_dict_gtk3_LDADD += -lcanna
+uim_dict_gtk3_CPPFLAGS += -DUSE_CANNA
+endif
+
+endif
+
+endif
=======================================
--- /trunk/configure.ac Fri Feb 11 20:09:56 2011
+++ /trunk/configure.ac Fri Feb 11 22:21:43 2011
@@ -1861,6 +1861,8 @@
gtk/test/Makefile
gtk/test/test.sh
gtk3/Makefile
+ gtk3/candwin/Makefile
+ gtk3/dict/Makefile
gtk3/pad/Makefile
gtk3/pref/Makefile
gtk3/switcher/Makefile
=======================================
--- /trunk/gtk/caret-state-indicator.c Thu Jan 6 18:09:56 2011
+++ /trunk/gtk/caret-state-indicator.c Fri Feb 11 22:21:43 2011
@@ -82,10 +82,16 @@
static gint
caret_state_indicator_paint_window(GtkWidget *window)
{
+#if GTK_CHECK_VERSION(2, 90, 0)
+ gtk_render_frame(gtk_widget_get_style_context(window),
+ gtk_widget_get_window(window),
+ 0, 0, -1, -1);
+#else
gtk_paint_flat_box(gtk_widget_get_style(window),
gtk_widget_get_window(window),
GTK_STATE_NORMAL, GTK_SHADOW_OUT, NULL, GTK_WIDGET(window),
"tooltip", 0, 0, -1, -1);
+#endif
return FALSE;
}
=======================================
--- /trunk/gtk3/Makefile.am Fri Feb 11 20:09:56 2011
+++ /trunk/gtk3/Makefile.am Fri Feb 11 22:21:43 2011
@@ -1,2 +1,1 @@
-#SUBDIRS = candwin chardict edittest immodule pref toolbar
-SUBDIRS = pad pref switcher toolbar
+SUBDIRS = candwin dict pad pref switcher toolbar
=======================================
--- /trunk/helper/candwin-gtk.c Thu Jan 6 18:09:56 2011
+++ /trunk/helper/candwin-gtk.c Fri Feb 11 22:21:43 2011
@@ -737,7 +737,7 @@
} else if (strcmp("show", command) == 0) {
candwin_show();
} else if (strcmp("hide", command) == 0) {
- gtk_widget_hide_all(GTK_WIDGET(cwin));
+ gtk_widget_hide(GTK_WIDGET(cwin));
if (cwin->sub_window.window)
gtk_widget_hide(cwin->sub_window.window);
} else if (strcmp("move", command) == 0) {
@@ -804,7 +804,6 @@
/* disable uim context in annotation window */
setenv("GTK_IM_MODULE", "gtk-im-context-simple", 1);
- gtk_set_locale();
gtk_init(&argc, &argv);
if (uim_init() < 0)
return 0;
@@ -1029,7 +1028,12 @@
static void
uim_cand_win_gtk_layout_sub_window(UIMCandidateWindow *cwin)
{
- gint x, y, w, h, d, sw, sh, x2, y2, w2, h2, d2;
+ gint x, y, w, h, sw, sh, x2, y2, w2, h2
+#if GTK_CHECK_VERSION(2, 90, 0)
+ ;
+#else
+ , d, d2;
+#endif
GdkRectangle rect;
GtkTreePath *path;
GtkTreeViewColumn *focus_column;
@@ -1042,13 +1046,23 @@
gtk_tree_path_free(path);
gdk_window_get_geometry(gtk_widget_get_window(GTK_WIDGET(cwin)),
- &x, &y, &w, &h, &d);
+ &x, &y, &w, &h
+#if GTK_CHECK_VERSION(2, 90, 0)
+ );
+#else
+ , &d);
+#endif
gdk_window_get_origin(gtk_widget_get_window(GTK_WIDGET(cwin)), &x, &y);
sw = gdk_screen_get_width (gdk_screen_get_default ());
sh = gdk_screen_get_height (gdk_screen_get_default ());
gdk_window_get_geometry(gtk_widget_get_window(cwin->sub_window.window),
- &x2, &y2, &w2, &h2, &d2);
+ &x2, &y2, &w2, &h2
+#if GTK_CHECK_VERSION(2, 90, 0)
+ );
+#else
+ , &d2);
+#endif
if (x + w + w2 > sw)
x = x - w2;
else
=======================================
--- /trunk/helper/candwin-tbl-gtk.c Thu Jan 6 18:09:56 2011
+++ /trunk/helper/candwin-tbl-gtk.c Fri Feb 11 22:21:43 2011
@@ -785,7 +785,7 @@
} else if (strcmp("show", command) == 0) {
candwin_show();
} else if (strcmp("hide", command) == 0) {
- gtk_widget_hide_all(GTK_WIDGET(cwin));
+ gtk_widget_hide(GTK_WIDGET(cwin));
} else if (strcmp("move", command) == 0) {
candwin_move(tmp);
} else if (strcmp("deactivate", command) == 0) {
@@ -850,7 +850,6 @@
/* disable uim context in annotation window */
setenv("GTK_IM_MODULE", "gtk-im-context-simple", 1);
- gtk_set_locale();
gtk_init(&argc, &argv);
if (uim_init() < 0)
return 0;
=======================================
--- /trunk/helper/dict-main-gtk.c Thu Jan 6 18:09:56 2011
+++ /trunk/helper/dict-main-gtk.c Fri Feb 11 22:21:43 2011
@@ -220,7 +220,6 @@
gint result;
setlocale(LC_ALL, "");
- gtk_set_locale();
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
bind_textdomain_codeset(PACKAGE, "UTF-8");
=======================================
--- /trunk/helper/dict-word-list-view-gtk.c Thu Jan 6 18:09:56 2011
+++ /trunk/helper/dict-word-list-view-gtk.c Fri Feb 11 22:21:43 2011
@@ -46,7 +46,11 @@
static void word_list_view_class_init (WordListViewClass *klass);
static void word_list_view_init (WordListView *view);
static void word_list_view_finalize (GObject *object);
+#if GTK_CHECK_VERSION(2, 90, 0)
+static void word_list_view_destroy (GtkWidget *object);
+#else
static void word_list_view_destroy (GtkObject *object);
+#endif
static void word_list_view_set_property (GObject *object,
guint prop_id,
@@ -114,7 +118,11 @@
word_list_view_class_init(WordListViewClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
+#if GTK_CHECK_VERSION(2, 90, 0)
+ GtkWidgetClass *object_class = GTK_WIDGET_CLASS(klass);
+#else
GtkObjectClass *object_class = GTK_OBJECT_CLASS(klass);
+#endif
parent_class = g_type_class_peek_parent(klass);
@@ -175,7 +183,12 @@
GtkCellRenderer *renderer;
GtkListStore *store;
+#if GTK_CHECK_VERSION(2, 22, 0)
+ gtk_widget_set_can_focus(GTK_WIDGET(view), TRUE);
+ gtk_widget_set_receives_default(GTK_WIDGET(view), TRUE);
+#else
GTK_WIDGET_SET_FLAGS(view, GTK_CAN_FOCUS | GTK_RECEIVES_DEFAULT);
+#endif
gtk_scrolled_window_set_policy(&view->container,
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(&view->container),
@@ -340,7 +353,11 @@
}
static void
+#if GTK_CHECK_VERSION(2, 90, 0)
+word_list_view_destroy(GtkWidget *object)
+#else
word_list_view_destroy(GtkObject *object)
+#endif
{
WordListView *view = WORD_LIST_VIEW(object);
@@ -349,9 +366,15 @@
view->dict = NULL;
}
+#if GTK_CHECK_VERSION(2, 90, 0)
+ if (GTK_WIDGET_CLASS(parent_class)->destroy) {
+ GTK_WIDGET_CLASS(parent_class)->destroy(object);
+ }
+#else
if (GTK_OBJECT_CLASS(parent_class)->destroy) {
GTK_OBJECT_CLASS(parent_class)->destroy(object);
}
+#endif
}
/*
=======================================
--- /trunk/helper/dict-word-list-view-gtk.h Thu Jan 6 18:09:56 2011
+++ /trunk/helper/dict-word-list-view-gtk.h Fri Feb 11 22:21:43 2011
@@ -38,9 +38,7 @@
#include <config.h>
#endif /* HAVE_CONFIG_H */
-#include <gtk/gtkscrolledwindow.h>
-#include <gtk/gtktreemodel.h>
-#include <gtk/gtktreeview.h>
+#include <gtk/gtk.h>
#include "dict-dict.h"
=======================================
--- /trunk/helper/dict-word-list-win-gtk.c Thu Jan 6 18:09:56 2011
+++ /trunk/helper/dict-word-list-win-gtk.c Fri Feb 11 22:21:43 2011
@@ -34,7 +34,12 @@
#include <config.h>
#include <stdlib.h>
-#include <gdk/gdkkeysyms.h>
+# include <gtk/gtk.h>
+#if GTK_CHECK_VERSION(2, 90, 0)
+# include <gdk/gdkkeysyms-compat.h>
+#else
+# include <gdk/gdkkeysyms.h>
+#endif
#include "gettext.h"
@@ -277,13 +282,13 @@
gtk_widget_show(word_list);
gtk_box_pack_start(GTK_BOX(vbox), word_list, TRUE, TRUE, 0);
- g_signal_connect(G_OBJECT(GTK_BIN(window->word_list)->child),
+ g_signal_connect(G_OBJECT(gtk_bin_get_child(GTK_BIN(window->word_list))),
"button-press-event",
G_CALLBACK(word_list_button_press_cb), window);
- g_signal_connect(G_OBJECT(GTK_BIN(window->word_list)->child),
+ g_signal_connect(G_OBJECT(gtk_bin_get_child(GTK_BIN(window->word_list))),
"row-activated",
G_CALLBACK(word_list_row_activated_cb), window);
- g_signal_connect(G_OBJECT(GTK_BIN(window->word_list)->child),
+ g_signal_connect(G_OBJECT(gtk_bin_get_child(GTK_BIN(window->word_list))),
"key-press-event",
G_CALLBACK(word_list_key_press_cb), window);
g_signal_connect(G_OBJECT(WORD_LIST_VIEW(window->word_list)->selection),
@@ -559,7 +564,7 @@
}
}
-#if GTK_CHECK_VERSION(2, 6, 0)
+#if GTK_CHECK_VERSION(2, 6, 0) && !GTK_CHECK_VERSION(2, 18, 0)
static void
activate_url(GtkAboutDialog *about, const gchar *link, gpointer data)
{
@@ -592,7 +597,9 @@
g_object_unref(pixbuf);
}
+#if !GTK_CHECK_VERSION(2, 18, 0)
gtk_about_dialog_set_url_hook (activate_url, NULL, NULL);
+#endif
gtk_show_about_dialog (GTK_WINDOW(window),
"name", name,
"version", VERSION,
=======================================
--- /trunk/helper/dict-word-win-gtk.c Thu Jan 6 18:09:56 2011
+++ /trunk/helper/dict-word-win-gtk.c Fri Feb 11 22:21:43 2011
@@ -179,7 +179,7 @@
/* action area */
check = gtk_check_button_new_with_label(_("continuance"));
- gtk_box_pack_start(GTK_BOX(GTK_DIALOG(window)->action_area),
+
gtk_box_pack_start(GTK_BOX(gtk_dialog_get_action_area(GTK_DIALOG(window))),
check, FALSE, FALSE, 0);
gtk_widget_show(check);
window->continuance = check;
@@ -299,13 +299,22 @@
gint pos_num;
pos_num = sizeof(pos_broad) / sizeof(pos_broad[0]);
+#if GTK_CHECK_VERSION(2, 24, 0)
+ combobox_pos_broad = gtk_combo_box_text_new();
+#else
combobox_pos_broad = gtk_combo_box_new_text();
+#endif
gtk_label_set_mnemonic_widget(GTK_LABEL(label), combobox_pos_broad);
gtk_widget_show(combobox_pos_broad);
for (i = 0; i < pos_num; i++) {
+#if GTK_CHECK_VERSION(2, 24, 0)
+
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combobox_pos_broad),
+ _(pos_broad[i]));
+#else
gtk_combo_box_append_text(GTK_COMBO_BOX(combobox_pos_broad),
_(pos_broad[i]));
+#endif
}
alignment_pos_broad = gtk_alignment_new(0, 0.5, 0, 0);