aboutsummaryrefslogtreecommitdiff
path: root/misc/scim-chewing/gtk.patch
blob: dd65d6d64b7825a3a91377abdf92241216582a92 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
commit 3cbe332e6b15ed674513d0b28e1966ff2bae1b45
Author: Andrew Lee (李健秋) <ajqlee@debian.org>
Date:   Fri Jul 6 01:22:55 2012 +0800

    Import upstream snapshot.

diff --git a/src/scim_chewing_imengine_setup.cpp b/src/scim_chewing_imengine_setup.cpp
index 75a9f51..c14eb74 100644
--- a/src/scim_chewing_imengine_setup.cpp
+++ b/src/scim_chewing_imengine_setup.cpp
@@ -165,7 +165,10 @@ static GList *selKey_type_list = 0;
 static GList *selKey_num_list = 0;
 static GList *chieng_mode_list = 0;
 // static GtkWidget    * __widget_show_candidate_comment= 0;
+#if GTK_CHECK_VERSION(2, 12, 0)
+#else
 static GtkTooltips  * __widget_tooltips              = 0;
+#endif
 
 static KeyboardConfigData __config_keyboards[] =
 {
@@ -322,7 +325,11 @@ static GtkWidget *create_options_page()
 {
 	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);
 
 	__widget_add_phrase_forward =
@@ -336,9 +343,15 @@ static GtkWidget *create_options_page()
 			G_CALLBACK( on_default_toggle_button_toggled ),
 			&__config_add_phrase_forward );
 
+#if GTK_CHECK_VERSION(2, 12, 0)
+	gtk_widget_set_tooltip_text(
+			__widget_add_phrase_forward,
+			_( "Whether to add Phrase forward or not." ));
+#else
 	gtk_tooltips_set_tip(
 			__widget_tooltips, __widget_add_phrase_forward,
 			_( "Whether to add Phrase forward or not." ), NULL );
+#endif
 
 	__widget_phrase_choice_rearward =
 		gtk_check_button_new_with_mnemonic( _( "_Rearward phrase choice" ) );
@@ -351,9 +364,15 @@ static GtkWidget *create_options_page()
 			G_CALLBACK( on_default_toggle_button_toggled ),
 			&__config_phrase_choice_rearward );
 
+#if GTK_CHECK_VERSION(2, 12, 0)
+	gtk_widget_set_tooltip_text(
+			__widget_phrase_choice_rearward,
+			_( "The behavior for phrase choice to be rearward or not." ));
+#else
 	gtk_tooltips_set_tip(
 			__widget_tooltips, __widget_phrase_choice_rearward,
 			_( "The behavior for phrase choice to be rearward or not." ), NULL );
+#endif
 
 	__widget_auto_shift_cursor =
 		gtk_check_button_new_with_mnemonic( _( "_Automatically shift cursor" ) );
@@ -366,9 +385,15 @@ static GtkWidget *create_options_page()
 			G_CALLBACK( on_default_toggle_button_toggled ),
 			&__config_auto_shift_cursor );
 
+#if GTK_CHECK_VERSION(2, 12, 0)
+	gtk_widget_set_tooltip_text(
+			__widget_auto_shift_cursor,
+			_( "Automatically shift cursor after selection." ));
+#else
 	gtk_tooltips_set_tip(
 			__widget_tooltips, __widget_auto_shift_cursor,
 			_( "Automatically shift cursor after selection." ), NULL );
+#endif
 
 	__widget_esc_clean_all_buffer =
 		gtk_check_button_new_with_mnemonic(_( "_Esc key to clean all buffer" ) );
@@ -381,9 +406,15 @@ static GtkWidget *create_options_page()
 			G_CALLBACK( on_default_toggle_button_toggled ),
 			&__config_esc_clean_all_buffer );
 
+#if GTK_CHECK_VERSION(2, 12, 0)
+	gtk_widget_set_tooltip_text(
+			__widget_esc_clean_all_buffer,
+			_( "Assign Esc key to clean all keyboard buffer or not." ));
+#else
 	gtk_tooltips_set_tip(
 			__widget_tooltips, __widget_esc_clean_all_buffer,
 			_( "Assign Esc key to clean all keyboard buffer or not." ), NULL );
+#endif
 
 	__widget_space_as_selection = 
 		gtk_check_button_new_with_mnemonic( _( "_SpaceKey as selection key" ) );
@@ -396,9 +427,15 @@ static GtkWidget *create_options_page()
 			G_CALLBACK( on_default_toggle_button_toggled ),
 			&__config_space_as_selection );
 
+#if GTK_CHECK_VERSION(2, 12, 0)
+	gtk_widget_set_tooltip_text(
+			__widget_space_as_selection,
+			_( "Whether SpaceKey is used as selection key or not." ));
+#else
 	gtk_tooltips_set_tip(
 			__widget_tooltips, __widget_space_as_selection,
 			_( "Whether SpaceKey is used as selection key or not." ), NULL );
+#endif
 
 	return vbox;
 }
@@ -487,7 +524,7 @@ static GtkWidget *create_keyboard_page()
 		gtk_table_attach (GTK_TABLE (table), __config_keyboards [i].entry, 1, 2, i, i+1,
 				(GtkAttachOptions) (GTK_FILL|GTK_EXPAND),
 				(GtkAttachOptions) (GTK_FILL), 4, 4);
-		gtk_entry_set_editable (GTK_ENTRY (__config_keyboards[i].entry), FALSE);
+		gtk_editable_set_editable (GTK_EDITABLE (__config_keyboards[i].entry), FALSE);
 
 		__config_keyboards[i].button = gtk_button_new_with_label ("...");
 		gtk_widget_show (__config_keyboards[i].button);
@@ -508,26 +545,46 @@ static GtkWidget *create_keyboard_page()
 	}
 
 	for (i = 0; __config_keyboards [i].key; ++ i) {
+#if GTK_CHECK_VERSION(2, 12, 0)
+		gtk_widget_set_tooltip_text(__config_keyboards [i].entry,
+				_(__config_keyboards [i].tooltip));
+#else
 		gtk_tooltips_set_tip (__widget_tooltips, __config_keyboards [i].entry,
 				_(__config_keyboards [i].tooltip), NULL);
+#endif
 	}
 
+#if GTK_CHECK_VERSION(2, 4, 0)
+	__widget_chieng_mode = gtk_combo_box_text_new_with_entry();
+#else
 	// Setup chieng_mode combo box
 	__widget_chieng_mode = gtk_combo_new();
+#endif
 	gtk_widget_show (__widget_chieng_mode);
 
 	for (i = 0; 
 			i < (sizeof(builtin_chieng_mode) / sizeof(builtin_chieng_mode[0])); 
 			i++) {
+#if GTK_CHECK_VERSION(2, 4, 0)
+		gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(__widget_chieng_mode),
+				builtin_chieng_mode[ i ] );
+#else
 		chieng_mode_list = g_list_append(
 				chieng_mode_list,
 				(void *) builtin_chieng_mode[ i ] );
+#endif
 	}
 
+#if GTK_CHECK_VERSION(2, 4, 0)
+	gtk_editable_set_editable (
+		GTK_EDITABLE (gtk_bin_get_child (GTK_BIN (__widget_chieng_mode))),
+		FALSE);
+#else
 	gtk_combo_set_popdown_strings (GTK_COMBO (__widget_chieng_mode), chieng_mode_list);
 	g_list_free(chieng_mode_list);
 	gtk_combo_set_use_arrows (GTK_COMBO (__widget_chieng_mode), TRUE);
 	gtk_editable_set_editable (GTK_EDITABLE (GTK_ENTRY (GTK_COMBO (__widget_chieng_mode)->entry)), FALSE);
+#endif
 	label = gtk_label_new (_("Initial trigger Chinese/English mode:"));
 	gtk_widget_show (label);
 	gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
@@ -538,30 +595,55 @@ static GtkWidget *create_keyboard_page()
 	gtk_table_attach (GTK_TABLE (table), __widget_chieng_mode, 1, 2, 2, 3,
 			(GtkAttachOptions) (GTK_FILL|GTK_EXPAND),
 			(GtkAttachOptions) (GTK_FILL), 4, 4);
+#if GTK_CHECK_VERSION(2, 12, 0)
+	gtk_widget_set_tooltip_text(
+			gtk_bin_get_child (GTK_BIN (__widget_chieng_mode)),
+			_("Change the default Chinese/English mode on every trigger"));
+#else
 	gtk_tooltips_set_tip (__widget_tooltips, GTK_COMBO (__widget_chieng_mode)->entry,
 			_("Change the default Chinese/English mode on every trigger"), NULL);
+#endif
 	g_signal_connect(
+#if GTK_CHECK_VERSION(2, 4, 0)
+			G_OBJECT (gtk_bin_get_child (GTK_BIN (__widget_chieng_mode))),
+#else
 			(gpointer) GTK_ENTRY(GTK_COMBO(__widget_chieng_mode)->entry), 
+#endif
 			"changed",
 			G_CALLBACK (on_default_editable_changed),
 			&(__config_chieng_mode_data));
 
+#if GTK_CHECK_VERSION(2, 4, 0)
+	__widget_selKey_num = gtk_combo_box_text_new_with_entry();
+#else
 	// Setup selKey_num combo box
 	__widget_selKey_num = gtk_combo_new();
+#endif
 	gtk_widget_show (__widget_selKey_num);
 
 	for (i = 0; 
 	     i < (sizeof(builtin_selectkeys_num) / sizeof(builtin_selectkeys_num[0])); 
 	     i++) {
+#if GTK_CHECK_VERSION(2, 4, 0)
+		gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(__widget_selKey_num),
+				builtin_selectkeys_num[ i ] );
+#else
 		selKey_num_list = g_list_append(
 				selKey_num_list,
 				(void *) builtin_selectkeys_num[ i ] );
+#endif
 	}
 
+#if GTK_CHECK_VERSION(2, 4, 0)
+	gtk_editable_set_editable (
+		GTK_EDITABLE (gtk_bin_get_child (GTK_BIN (__widget_selKey_num))),
+		FALSE);
+#else
 	gtk_combo_set_popdown_strings (GTK_COMBO (__widget_selKey_num), selKey_num_list);
 	g_list_free(selKey_num_list);
 	gtk_combo_set_use_arrows (GTK_COMBO (__widget_selKey_num), TRUE);
 	gtk_editable_set_editable (GTK_EDITABLE (GTK_ENTRY (GTK_COMBO (__widget_selKey_num)->entry)), FALSE);
+#endif
 	label = gtk_label_new (_("Number of Selection Keys :"));
 	gtk_widget_show (label);
 	gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
@@ -572,30 +654,52 @@ static GtkWidget *create_keyboard_page()
 	gtk_table_attach (GTK_TABLE (table), __widget_selKey_num, 1, 2, 3, 4,
 			(GtkAttachOptions) (GTK_FILL|GTK_EXPAND),
 			(GtkAttachOptions) (GTK_FILL), 4, 4);
+#if GTK_CHECK_VERSION(2, 12, 0)
+	gtk_widget_set_tooltip_text(gtk_bin_get_child (GTK_BIN (__widget_selKey_num)),
+			_("Change the default number of selection keys"));
+#else
 	gtk_tooltips_set_tip (__widget_tooltips, GTK_COMBO (__widget_selKey_num)->entry,
 			_("Change the default number of selection keys"), NULL);
+#endif
 	g_signal_connect(
+#if GTK_CHECK_VERSION(2, 4, 0)
+			G_OBJECT(gtk_bin_get_child(GTK_BIN(__widget_selKey_num))),
+#else
 			(gpointer) GTK_ENTRY(GTK_COMBO(__widget_selKey_num)->entry), 
+#endif
 			"changed",
 			G_CALLBACK (on_default_editable_changed),
 			&(__config_selKey_num_data));
 
+#if GTK_CHECK_VERSION(2, 4, 0)
+	__widget_selKey_type = gtk_combo_box_text_new_with_entry();
+#else
 	// Setup selKey combo box
 	__widget_selKey_type = gtk_combo_new();
+#endif
 	gtk_widget_show (__widget_selKey_type);
 
 	for (i = 0;
 	     i < (sizeof(builtin_selectkeys) / sizeof(builtin_selectkeys[0]));
 	     i++) {
+#if GTK_CHECK_VERSION(2, 4, 0)
+		gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(__widget_selKey_type),
+				builtin_selectkeys[ i ] );
+#else
 		selKey_type_list = g_list_append(
 				selKey_type_list,
 				(void *) builtin_selectkeys[ i ] );
+#endif
 	}
 
+#if GTK_CHECK_VERSION(2, 4, 0)
+	gtk_editable_set_editable (GTK_EDITABLE (gtk_bin_get_child (GTK_BIN (__widget_selKey_type))), FALSE);
+#else
 	gtk_combo_set_popdown_strings (GTK_COMBO (__widget_selKey_type), selKey_type_list);
 	g_list_free(selKey_type_list);
 	gtk_combo_set_use_arrows (GTK_COMBO (__widget_selKey_type), TRUE);
 	gtk_editable_set_editable (GTK_EDITABLE (GTK_ENTRY (GTK_COMBO (__widget_selKey_type)->entry)), FALSE);
+#endif
 	label = gtk_label_new (_("Customized Selection Keys:"));
 	gtk_widget_show (label);
 	gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
@@ -606,30 +710,54 @@ static GtkWidget *create_keyboard_page()
 	gtk_table_attach (GTK_TABLE (table), __widget_selKey_type, 1, 2, 4, 5,
 			(GtkAttachOptions) (GTK_FILL|GTK_EXPAND),
 			(GtkAttachOptions) (GTK_FILL), 4, 4);
+#if GTK_CHECK_VERSION(2, 12, 0)
+	gtk_widget_set_tooltip_text(gtk_bin_get_child (GTK_BIN (__widget_selKey_type)),
+			_("Change the default selection keys"));
+#else
 	gtk_tooltips_set_tip (__widget_tooltips, GTK_COMBO (__widget_selKey_type)->entry,
 			_("Change the default selection keys"), NULL);
+#endif
 	g_signal_connect(
+#if GTK_CHECK_VERSION(2, 4, 0)
+			G_OBJECT(gtk_bin_get_child(GTK_BIN(__widget_selKey_type))),
+#else
 			(gpointer) GTK_ENTRY(GTK_COMBO(__widget_selKey_type)->entry),
+#endif
 			"changed",
 			G_CALLBACK (on_default_editable_changed),
 			&(__config_selKey_type_data));
 
+#if GTK_CHECK_VERSION(2, 4, 0)
+	__widget_kb_type = gtk_combo_box_text_new_with_entry();
+#else
 	// Setup KB_TYPE combo box
 	__widget_kb_type = gtk_combo_new();
+#endif
 	gtk_widget_show (__widget_kb_type);
 
 	for (i = 0;
 	     i < (int) (sizeof(builtin_keymaps) / sizeof(_builtin_keymap));
 	     i++) {
+#if GTK_CHECK_VERSION(2, 4, 0)
+		gtk_combo_box_text_append_text(
+				GTK_COMBO_BOX_TEXT(__widget_kb_type), 
+				builtin_keymaps[ i ].translated_name.c_str() );
+#else
 		kb_type_list = g_list_append(
 				kb_type_list,
 				(void *) builtin_keymaps[ i ].translated_name.c_str() );
+#endif
 	}
 
+#if GTK_CHECK_VERSION(2, 4, 0)
+	gtk_editable_set_editable (GTK_EDITABLE (gtk_bin_get_child (GTK_BIN (__widget_kb_type))), FALSE);
+#else
 	gtk_combo_set_popdown_strings (GTK_COMBO (__widget_kb_type), kb_type_list);
 	g_list_free(kb_type_list);
 	gtk_combo_set_use_arrows (GTK_COMBO (__widget_kb_type), TRUE);
 	gtk_editable_set_editable (GTK_EDITABLE (GTK_ENTRY (GTK_COMBO (__widget_kb_type)->entry)), FALSE);
+#endif
+
 	label = gtk_label_new (_("Use keyboard type:"));
 	gtk_widget_show (label);
 	gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
@@ -640,10 +768,19 @@ static GtkWidget *create_keyboard_page()
 	gtk_table_attach (GTK_TABLE (table), __widget_kb_type, 1, 2, 5, 6,
 			(GtkAttachOptions) (GTK_FILL|GTK_EXPAND),
 			(GtkAttachOptions) (GTK_FILL), 4, 4);
+#if GTK_CHECK_VERSION(2, 12, 0)
+	gtk_widget_set_tooltip_text(gtk_bin_get_child (GTK_BIN (__widget_kb_type)),
+			_("Change the default keyboard layout type"));
+#else
 	gtk_tooltips_set_tip (__widget_tooltips, GTK_COMBO (__widget_kb_type)->entry,
 			_("Change the default keyboard layout type"), NULL);
+#endif
 	g_signal_connect(
+#if GTK_CHECK_VERSION(2, 4, 0)
+			G_OBJECT(gtk_bin_get_child(GTK_BIN(__widget_kb_type))),
+#else
 			(gpointer) GTK_ENTRY(GTK_COMBO(__widget_kb_type)->entry),
+#endif
 			"changed",
 			G_CALLBACK (on_default_editable_changed),
 			&(__config_kb_type_data_translated));
@@ -661,7 +798,11 @@ static GtkWidget *create_color_button_page()
 	gtk_widget_show (table);
 
 	for (int i = 0; i < SCIM_CONFIG_IMENGINE_CHEWING_PREEDIT_BGCOLOR_NUM; i++) {
+#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);
 		sprintf(color_button_name_string, 
 			SCIM_CONFIG_IMENGINE_CHEWING_PREEDIT_BGCOLOR_ "_%d", i + 1);
@@ -684,7 +825,10 @@ static GtkWidget *create_setup_window()
 		GtkWidget *label;
 		GtkWidget *page;
 
+#if GTK_CHECK_VERSION(2, 12, 0)
+#else
 		__widget_tooltips = gtk_tooltips_new ();
+#endif
 
 		// Create the Notebook.
 		notebook = gtk_notebook_new ();
@@ -788,10 +932,14 @@ void setup_widget_value()
 	if (index_keymap < 0)
 		index_keymap = 0;
 	
+#if GTK_CHECK_VERSION(2, 4, 0)
+	gtk_combo_box_set_active(GTK_COMBO_BOX(__widget_kb_type), index_keymap);
+#else
 	gtk_entry_set_text (
 			GTK_ENTRY(GTK_COMBO(__widget_kb_type)->entry),
 			builtin_keymaps[index_keymap].translated_name.c_str()
 	);
+#endif
 
 	/* selKey */
 	int index_selectkeys = sizeof(builtin_selectkeys) / sizeof(builtin_selectkeys[0]) - 1;
@@ -804,10 +952,14 @@ void setup_widget_value()
 	if (index_selectkeys < 0)
 		index_selectkeys = 0;
 	
+#if GTK_CHECK_VERSION(2, 4, 0)
+	gtk_combo_box_set_active(GTK_COMBO_BOX(__widget_selKey_type), index_selectkeys);
+#else
 	gtk_entry_set_text (
 		GTK_ENTRY(GTK_COMBO(__widget_selKey_type)->entry),
 		builtin_selectkeys[index_selectkeys]
 	);
+#endif
 
 	/* selKey_num */
 	int index_selectkeys_num =
@@ -821,10 +973,14 @@ void setup_widget_value()
 	if (index_selectkeys_num < 0)
 		index_selectkeys_num = 0;
 	
+#if GTK_CHECK_VERSION(2, 4, 0)
+	gtk_combo_box_set_active(GTK_COMBO_BOX(__widget_selKey_num), index_selectkeys_num);
+#else
 	gtk_entry_set_text (
 		GTK_ENTRY(GTK_COMBO(__widget_selKey_num)->entry),
 		builtin_selectkeys_num[index_selectkeys_num]
 	);
+#endif
 
 	/* chieng_mode */
 	int index_chieng_mode =
@@ -838,10 +994,14 @@ void setup_widget_value()
 	if (index_chieng_mode < 0)
 		index_chieng_mode = 0;
 	
+#if GTK_CHECK_VERSION(2, 4, 0)
+	gtk_combo_box_set_active(GTK_COMBO_BOX(__widget_chieng_mode), index_chieng_mode);
+#else
 	gtk_entry_set_text (
 		GTK_ENTRY(GTK_COMBO(__widget_chieng_mode)->entry),
 		builtin_chieng_mode[index_chieng_mode]
 	);
+#endif
 }
 
 void load_config( const ConfigPointer &config )
@@ -1087,7 +1247,11 @@ static GtkWidget *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);
 
diff --git a/src/scim_color_button.cpp b/src/scim_color_button.cpp
index 0b3930c..36df131 100644
--- a/src/scim_color_button.cpp
+++ b/src/scim_color_button.cpp
@@ -68,9 +68,14 @@ typedef enum
 static void     scim_color_button_class_init (ScimChewingColorButtonClass *klass);
 static void     scim_color_button_init       (ScimChewingColorButton      *object);
 
+#if GTK_CHECK_VERSION(3, 0, 0)
+static void     scim_color_button_destroy         (GtkWidget      *object);
+static gboolean scim_color_button_draw            (GtkWidget      *widget, cairo_t *cr);
+#else
 static void     scim_color_button_destroy         (GtkObject      *object);
 static gboolean scim_color_button_expose          (GtkWidget      *widget,
                                                    GdkEventExpose *eevent);
+#endif
 static gboolean scim_color_button_button_press    (GtkWidget      *widget,
                                                    GdkEventButton *bevent);
 static gboolean scim_color_button_button_release  (GtkWidget      *widget,
@@ -110,7 +115,6 @@ scim_color_button_get_type (void)
 static void
 scim_color_button_class_init (ScimChewingColorButtonClass *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);
@@ -124,9 +128,15 @@ scim_color_button_class_init (ScimChewingColorButtonClass *klass)
   		  g_cclosure_marshal_VOID__VOID,
   		  G_TYPE_NONE, 0);
   
+#if GTK_CHECK_VERSION(3, 0, 0)
+    widget_class->destroy = scim_color_button_destroy;
+    widget_class->draw = scim_color_button_draw;
+#else
+    GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (klass);
     gtk_object_class->destroy          = scim_color_button_destroy;
-  
     widget_class->expose_event         = scim_color_button_expose;
+#endif
+  
     widget_class->button_press_event   = scim_color_button_button_press;
     widget_class->button_release_event = scim_color_button_button_release;
 }
@@ -135,8 +145,13 @@ static void
 scim_color_button_init (ScimChewingColorButton *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 |
@@ -145,7 +160,11 @@ scim_color_button_init (ScimChewingColorButton *object)
 
 
 static void
+#if GTK_CHECK_VERSION(3, 0, 0)
+scim_color_button_destroy (GtkWidget *object)
+#else
 scim_color_button_destroy (GtkObject *object)
+#endif
 {
     ScimChewingColorButton *button = SCIM_COLOR_BUTTON (object);
 
@@ -160,19 +179,38 @@ scim_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_color_button_draw_rect (ScimChewingColorButton *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;
@@ -211,23 +249,38 @@ scim_color_button_draw_rect (ScimChewingColorButton *button,
                         GDK_RGB_DITHER_MAX,
                         button->render_buf,
                         rowstride);
+#endif
 }
 
 static gboolean
+#if GTK_CHECK_VERSION(3, 0, 0)
+scim_color_button_draw (GtkWidget      *widget,
+                          cairo_t *cr)
+#else
 scim_color_button_expose (GtkWidget      *widget,
                           GdkEventExpose *eevent)
+#endif
 {
     ScimChewingColorButton *button = SCIM_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
@@ -241,9 +294,14 @@ scim_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;
     }
@@ -259,37 +317,78 @@ scim_color_button_expose (GtkWidget      *widget,
     button->rect_width  = rect_w;
     button->rect_height = rect_h;
   
-  
     /*  draw the background area  */
     scim_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_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,
+#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;
 }
@@ -299,11 +398,16 @@ scim_color_button_target (ScimChewingColorButton *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  &&
@@ -324,7 +428,11 @@ scim_color_button_open_color_dialog (ScimChewingColorButton *button, gboolean fg
 {
     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");
@@ -332,16 +440,38 @@ scim_color_button_open_color_dialog (ScimChewingColorButton *button, gboolean fg
     
     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:
@@ -355,6 +485,11 @@ scim_color_button_open_color_dialog (ScimChewingColorButton *button, gboolean fg
 static void
 scim_color_button_swap_color (ScimChewingColorButton *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;
@@ -367,6 +502,7 @@ scim_color_button_swap_color (ScimChewingColorButton *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);
 }
 
@@ -457,14 +593,29 @@ scim_color_button_get_colors (ScimChewingColorButton *button,
 
     g_snprintf (fg_color_str, G_N_ELEMENTS (fg_color_str),
                 "#%02X%02X%02X", 
+#if GTK_CHECK_VERSION(3, 0, 0)
+                static_cast<unsigned int>(255*button->fg_color.red),
+                static_cast<unsigned int>(255*button->fg_color.green),
+                static_cast<unsigned int>(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<unsigned int>(255*button->bg_color.red),
+                static_cast<unsigned int>(255*button->bg_color.green),
+                static_cast<unsigned int>(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); 
 
@@ -476,6 +627,10 @@ scim_color_button_set_colors (ScimChewingColorButton *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);
@@ -486,6 +641,7 @@ scim_color_button_set_colors (ScimChewingColorButton *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_color_button.h b/src/scim_color_button.h
index ca09877..fc24bb9 100644
--- a/src/scim_color_button.h
+++ b/src/scim_color_button.h
@@ -53,8 +53,13 @@ struct _ScimChewingColorButton
   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;
+#endif
 };
 
 struct _ScimChewingColorButtonClass