static GtkWidget * __widget_user_table_binary = 0;
static GtkWidget * __widget_user_phrase_first = 0;
static GtkWidget * __widget_long_phrase_first = 0;
+#if GTK_CHECK_VERSION(3, 0, 0)
+#else
static GtkTooltips * __widget_tooltips = 0;
+#endif
static GtkWidget * __widget_table_list_view = 0;
static GtkListStore * __widget_table_list_model = 0;
&__config_long_phrase_first);
// Set all tooltips.
+#if GTK_CHECK_VERSION(3, 0, 0)
+ gtk_widget_set_tooltip_text (__widget_show_prompt,
+ _("If this option is checked, "
+ "the key prompt of the currently selected phrase "
+ "will be shown."));
+
+ gtk_widget_set_tooltip_text (__widget_show_key_hint,
+ _("If this option is checked, "
+ "the remaining keystrokes of the phrases "
+ "will be shown on the lookup table."));
+
+ gtk_widget_set_tooltip_text (__widget_user_table_binary,
+ _("If this option is checked, "
+ "the user table will be stored with binary format, "
+ "this will increase the loading speed."));
+
+ gtk_widget_set_tooltip_text (__widget_user_phrase_first,
+ _("If this option is checked, "
+ "the user defined phrases will be shown "
+ "in front of others. "));
+
+ gtk_widget_set_tooltip_text (__widget_long_phrase_first,
+ _("If this option is checked, "
+ "the longer phrase will be shown "
+ "in front of others. "));
+#else
gtk_tooltips_set_tip (__widget_tooltips, __widget_show_prompt,
_("If this option is checked, "
"the key prompt of the currently selected phrase "
_("If this option is checked, "
"the longer phrase will be shown "
"in front of others. "), NULL);
-
+#endif
return vbox;
}
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);
+#if GTK_CHECK_VERSION(3, 0, 0)
+ g_object_set (G_OBJECT (__config_keyboards[i].entry), "editable", FALSE, NULL);
+#else
gtk_entry_set_editable (GTK_ENTRY (__config_keyboards[i].entry), FALSE);
+#endif
__config_keyboards[i].button = gtk_button_new_with_label ("...");
gtk_widget_show (__config_keyboards[i].button);
}
for (i = 0; __config_keyboards [i].key; ++ i) {
+#if GTK_CHECK_VERSION(3, 0, 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
}
return table;
gtk_widget_show (button);
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gtk_container_set_border_width (GTK_CONTAINER (button), 2);
+#if GTK_CHECK_VERSION(3, 0, 0)
+ gtk_widget_set_tooltip_text (button, _("Install a new table."));
+#else
gtk_tooltips_set_tip (__widget_tooltips, button, _("Install a new table."), NULL);
+#endif
g_signal_connect (G_OBJECT (button), "clicked",
G_CALLBACK (on_table_install_clicked),
0);
gtk_widget_show (button);
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gtk_container_set_border_width (GTK_CONTAINER (button), 2);
+#if GTK_CHECK_VERSION(3, 0, 0)
+ gtk_widget_set_tooltip_text (button, _("Delete the selected table."));
+#else
gtk_tooltips_set_tip (__widget_tooltips, button, _("Delete the selected table."), NULL);
+#endif
g_signal_connect (G_OBJECT (button), "clicked",
G_CALLBACK (on_table_delete_clicked),
0);
gtk_widget_show (button);
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gtk_container_set_border_width (GTK_CONTAINER (button), 2);
+#if GTK_CHECK_VERSION(3, 0, 0)
+ gtk_widget_set_tooltip_text (button, _("Edit the properties of the selected table."));
+#else
gtk_tooltips_set_tip (__widget_tooltips, button, _("Edit the properties of the selected table."), NULL);
+#endif
g_signal_connect (G_OBJECT (button), "clicked",
G_CALLBACK (on_table_properties_clicked),
0);
GtkWidget *label;
GtkWidget *page;
+#if GTK_CHECK_VERSION(3, 0, 0)
+#else
__widget_tooltips = gtk_tooltips_new ();
+#endif
// Create the Notebook.
notebook = gtk_notebook_new ();
GtkEntry *entry = static_cast <GtkEntry*> (user_data);
if (entry) {
+#if GTK_CHECK_VERSION(3, 0, 0)
+ GtkWidget *file_selection = gtk_file_chooser_dialog_new (
+ _("Select an icon file"),
+ NULL,
+ GTK_FILE_CHOOSER_ACTION_OPEN,
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ GTK_STOCK_OPEN, GTK_RESPONSE_OK,
+ NULL);
+#else
GtkWidget *file_selection = gtk_file_selection_new (_("Select an icon file"));
gtk_file_selection_set_filename (GTK_FILE_SELECTION (file_selection),
gtk_entry_get_text (entry));
gtk_file_selection_hide_fileop_buttons (GTK_FILE_SELECTION (file_selection));
+#endif
gint result = gtk_dialog_run (GTK_DIALOG (file_selection));
if (result == GTK_RESPONSE_OK)
gtk_entry_set_text (entry,
- gtk_file_selection_get_filename (GTK_FILE_SELECTION (file_selection)));
+#if GTK_CHECK_VERSION(3, 0, 0)
+ gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (file_selection))
+#else
+ gtk_file_selection_get_filename (GTK_FILE_SELECTION (file_selection))
+#endif
+ );
gtk_widget_destroy (file_selection);
}
String usr_dir (scim_get_home_dir () + SCIM_TABLE_USER_TABLE_DIR);
// Select the table file.
+#if GTK_CHECK_VERSION(3, 0, 0)
+ file_selection = gtk_file_chooser_dialog_new (
+ _("Please select the table file to be installed."),
+ NULL,
+ GTK_FILE_CHOOSER_ACTION_OPEN,
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ GTK_STOCK_OPEN, GTK_RESPONSE_OK,
+ NULL);
+#else
file_selection = gtk_file_selection_new (_("Please select the table file to be installed."));
gtk_file_selection_hide_fileop_buttons (GTK_FILE_SELECTION (file_selection));
+#endif
result = gtk_dialog_run (GTK_DIALOG (file_selection));
return;
}
+#if GTK_CHECK_VERSION(3, 0, 0)
+ file = String (gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (file_selection)));
+#else
file = String (gtk_file_selection_get_filename (GTK_FILE_SELECTION (file_selection)));
+#endif
gtk_widget_destroy (file_selection);
GtkWidget *cancelbutton;
GtkWidget *okbutton;
+#if GTK_CHECK_VERSION(3, 0, 0)
+#else
GtkTooltips *tooltips;
+#endif
KeyboardConfigData split_keys = {NULL,
_("Split Keys:"),
gint result = GTK_RESPONSE_CANCEL;
{// Create dialog.
+#if GTK_CHECK_VERSION(3, 0, 0)
+#else
tooltips = gtk_tooltips_new ();
+#endif
dialog = gtk_dialog_new ();
gtk_container_set_border_width (GTK_CONTAINER (dialog), 2);
gtk_window_set_title (GTK_WINDOW (dialog), _("Table Properties"));
gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER);
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
+#if GTK_CHECK_VERSION(3, 0, 0)
+ g_object_set (G_OBJECT (dialog), "has-separator", FALSE, NULL);
+#else
gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
+#endif
+#if GTK_CHECK_VERSION(3, 0, 0)
+ dialog_vbox = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
+#else
dialog_vbox = GTK_DIALOG (dialog)->vbox;
+#endif
gtk_widget_show (dialog_vbox);
scrolledwindow = gtk_scrolled_window_new (NULL, NULL);
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
+#if GTK_CHECK_VERSION(3, 0, 0)
+ gtk_widget_set_tooltip_text (entry_name, _("The name of this table."));
+#else
gtk_tooltips_set_tip (tooltips, entry_name,
_("The name of this table."), NULL);
+#endif
++ row;
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
+#if GTK_CHECK_VERSION(3, 0, 0)
+ gtk_widget_set_tooltip_text (entry_author,
+ _("The author of this table."));
+#else
gtk_tooltips_set_tip (tooltips, entry_author,
_("The author of this table."), NULL);
+#endif
++ row;
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
+#if GTK_CHECK_VERSION(3, 0, 0)
+ gtk_widget_set_tooltip_text (entry_uuid,
+ _("The unique ID of this table."));
+#else
gtk_tooltips_set_tip (tooltips, entry_uuid,
_("The unique ID of this table."), NULL);
+#endif
++ row;
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
+#if GTK_CHECK_VERSION(3, 0, 0)
+ gtk_widget_set_tooltip_text (entry_serial,
+ _("The serial number of this table."));
+#else
gtk_tooltips_set_tip (tooltips, entry_serial,
_("The serial number of this table."), NULL);
+#endif
++ row;
G_CALLBACK (on_icon_file_selection_clicked),
entry_icon);
+#if GTK_CHECK_VERSION(3, 0, 0)
+ gtk_widget_set_tooltip_text (entry_icon,
+ _("The icon file of this table."));
+#else
gtk_tooltips_set_tip (tooltips, entry_icon,
_("The icon file of this table."), NULL);
+#endif
++ row;
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
+#if GTK_CHECK_VERSION(3, 0, 0)
+ gtk_widget_set_tooltip_text (entry_languages,
+ _("The languages supported by this table."));
+#else
gtk_tooltips_set_tip (tooltips, entry_languages,
_("The languages supported by this table."), NULL);
+#endif
++ row;
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
+#if GTK_CHECK_VERSION(3, 0, 0)
+ gtk_widget_set_tooltip_text (entry_status_prompt,
+ _("A prompt string to be shown in status area."));
+#else
gtk_tooltips_set_tip (tooltips, entry_status_prompt,
_("A prompt string to be shown in status area."), NULL);
+#endif
++ row;
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
+#if GTK_CHECK_VERSION(3, 0, 0)
+ gtk_widget_set_tooltip_text (entry_valid_input_chars,
+ _("The valid input chars of this table."));
+#else
gtk_tooltips_set_tip (tooltips, entry_valid_input_chars,
_("The valid input chars of this table."), NULL);
+#endif
++ row;
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
+#if GTK_CHECK_VERSION(3, 0, 0)
+ gtk_widget_set_tooltip_text (entry_multi_wildcard_chars,
+ _("The multi wildcard chars of this table. "
+ "These chars can be used to match one or more arbitrary chars."));
+#else
gtk_tooltips_set_tip (tooltips, entry_multi_wildcard_chars,
_("The multi wildcard chars of this table. "
"These chars can be used to match one or more arbitrary chars."), NULL);
+#endif
++ row;
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
+#if GTK_CHECK_VERSION(3, 0, 0)
+ gtk_widget_set_tooltip_text (entry_single_wildcard_chars,
+ _("The single wildcard chars of this table."
+ "These chars can be used to match one arbitrary char."));
+#else
gtk_tooltips_set_tip (tooltips, entry_single_wildcard_chars,
_("The single wildcard chars of this table."
"These chars can be used to match one arbitrary char."), NULL);
+#endif
++ row;
G_CALLBACK (on_default_key_selection_clicked),
all_keys [i]);
+#if GTK_CHECK_VERSION(3, 0, 0)
+ gtk_widget_set_tooltip_text (all_keys [i]->entry, all_keys [i]->tooltip);
+#else
gtk_tooltips_set_tip (tooltips, all_keys [i]->entry, all_keys [i]->tooltip, NULL);
+#endif
++ row;
}
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
+#if GTK_CHECK_VERSION(3, 0, 0)
+ gtk_widget_set_tooltip_text (spin_max_key_length,
+ _("The maxmium length of key strings."));
+#else
gtk_tooltips_set_tip (tooltips, spin_max_key_length,
_("The maxmium length of key strings."), NULL);
+#endif
++ row;
G_CALLBACK (on_toggle_button_toggled),
0);
+#if GTK_CHECK_VERSION(3, 0, 0)
+ gtk_widget_set_tooltip_text (toggle_show_key_prompt,
+ _("If true then the key prompts will be shown "
+ "instead of the raw keys."));
+#else
gtk_tooltips_set_tip (tooltips, toggle_show_key_prompt,
_("If true then the key prompts will be shown "
"instead of the raw keys."), NULL);
+#endif
++ row;
// Auto Select
G_CALLBACK (on_toggle_button_toggled),
0);
+#if GTK_CHECK_VERSION(3, 0, 0)
+ gtk_widget_set_tooltip_text (toggle_auto_select,
+ _("If true then the first candidate phrase will be "
+ "selected automatically when inputing the next key."));
+#else
gtk_tooltips_set_tip (tooltips, toggle_auto_select,
_("If true then the first candidate phrase will be "
"selected automatically when inputing the next key."), NULL);
+#endif
++ row;
G_CALLBACK (on_toggle_button_toggled),
0);
+#if GTK_CHECK_VERSION(3, 0, 0)
+ gtk_widget_set_tooltip_text (toggle_auto_wildcard,
+ _("If true then a multi wildcard char will be appended to "
+ "the end of the inputted key string when searching phrases."));
+#else
gtk_tooltips_set_tip (tooltips, toggle_auto_wildcard,
_("If true then a multi wildcard char will be appended to "
"the end of the inputted key string when searching phrases."), NULL);
+#endif
++ row;
G_CALLBACK (on_toggle_button_toggled),
0);
+#if GTK_CHECK_VERSION(3, 0, 0)
+ gtk_widget_set_tooltip_text (toggle_auto_commit,
+ _("If true then the converted result string will "
+ "be committed to client automatically."));
+#else
gtk_tooltips_set_tip (tooltips, toggle_auto_commit,
_("If true then the converted result string will "
"be committed to client automatically."), NULL);
+#endif
++ row;
G_CALLBACK (on_toggle_button_toggled),
0);
+#if GTK_CHECK_VERSION(3, 0, 0)
+ gtk_widget_set_tooltip_text (toggle_auto_split,
+ _("If true then the inputted key string will be "
+ "split automatically when necessary."));
+#else
gtk_tooltips_set_tip (tooltips, toggle_auto_split,
_("If true then the inputted key string will be "
"split automatically when necessary."), NULL);
+#endif
++ row;
G_CALLBACK (on_toggle_button_toggled),
0);
+#if GTK_CHECK_VERSION(3, 0, 0)
+ gtk_widget_set_tooltip_text (toggle_discard_invalid_key,
+ _("If true then the invalid key will be discarded automatically."
+ "This option is only valid when Auto Select and Auto Commit is true."));
+#else
gtk_tooltips_set_tip (tooltips, toggle_discard_invalid_key,
_("If true then the invalid key will be discarded automatically."
"This option is only valid when Auto Select and Auto Commit is true."), NULL);
+#endif
++ row;
G_CALLBACK (on_toggle_button_toggled),
0);
+#if GTK_CHECK_VERSION(3, 0, 0)
+ gtk_widget_set_tooltip_text (toggle_dynamic_adjust,
+ _("If true then the phrases' frequencies "
+ "will be adjusted dynamically."));
+#else
gtk_tooltips_set_tip (tooltips, toggle_dynamic_adjust,
_("If true then the phrases' frequencies "
"will be adjusted dynamically."), NULL);
+#endif
++ row;
G_CALLBACK (on_toggle_button_toggled),
0);
+#if GTK_CHECK_VERSION(3, 0, 0)
+ gtk_widget_set_tooltip_text (toggle_auto_fill,
+ _("If true then the preedit string will be filled up with the "
+ "current candiate phrase automatically."
+ "This option is only valid when Auto Select is TRUE."));
+#else
gtk_tooltips_set_tip (tooltips, toggle_auto_fill,
_("If true then the preedit string will be filled up with the "
"current candiate phrase automatically."
"This option is only valid when Auto Select is TRUE."), NULL);
+#endif
++ row;
G_CALLBACK (on_toggle_button_toggled),
0);
+#if GTK_CHECK_VERSION(3, 0, 0)
+ gtk_widget_set_tooltip_text (toggle_always_show_lookup,
+ _("If true then the lookup table will always be shown "
+ "when any candidate phrase is available. Otherwise "
+ "the lookup table will only be shown when necessary.\n"
+ "If Auto Fill is false, then this option will be no effect, "
+ "and always be true."));
+#else
gtk_tooltips_set_tip (tooltips, toggle_always_show_lookup,
_("If true then the lookup table will always be shown "
"when any candidate phrase is available. Otherwise "
"the lookup table will only be shown when necessary.\n"
"If Auto Fill is false, then this option will be no effect, "
"and always be true."), NULL);
+#endif
++ row;
G_CALLBACK (on_toggle_button_toggled),
0);
+#if GTK_CHECK_VERSION(3, 0, 0)
+ gtk_widget_set_tooltip_text (toggle_def_full_width_punct,
+ _("If true then full width punctuations will be inputted by default."));
+#else
gtk_tooltips_set_tip (tooltips, toggle_def_full_width_punct,
_("If true then full width punctuations will be inputted by default."), NULL);
+#endif
++ row;
G_CALLBACK (on_toggle_button_toggled),
0);
+#if GTK_CHECK_VERSION(3, 0, 0)
+ gtk_widget_set_tooltip_text (toggle_def_full_width_letter,
+ _("If true then full width letters will be inputted by default."));
+#else
gtk_tooltips_set_tip (tooltips, toggle_def_full_width_letter,
_("If true then full width letters will be inputted by default."), NULL);
+#endif
// action buttons
+#if GTK_CHECK_VERSION(3, 0, 0)
+ dialog_action_area = gtk_dialog_get_action_area (GTK_DIALOG (dialog));
+#else
dialog_action_area = GTK_DIALOG (dialog)->action_area;
+#endif
gtk_widget_show (dialog_action_area);
gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area), GTK_BUTTONBOX_END);
cancelbutton = gtk_button_new_from_stock ("gtk-cancel");
gtk_widget_show (cancelbutton);
gtk_dialog_add_action_widget (GTK_DIALOG (dialog), cancelbutton, GTK_RESPONSE_CANCEL);
+#if GTK_CHECK_VERSION(3, 0, 0)
+ gtk_widget_set_can_default (cancelbutton, TRUE);
+#else
GTK_WIDGET_SET_FLAGS (cancelbutton, GTK_CAN_DEFAULT);
+#endif
+
okbutton = gtk_button_new_from_stock ("gtk-ok");
gtk_widget_show (okbutton);
gtk_dialog_add_action_widget (GTK_DIALOG (dialog), okbutton, GTK_RESPONSE_OK);
+#if GTK_CHECK_VERSION(3, 0, 0)
+ gtk_widget_set_can_default (okbutton, TRUE);
+#else
GTK_WIDGET_SET_FLAGS (okbutton, GTK_CAN_DEFAULT);
+#endif
}
{// Set initial data and the widgets status.
+#if GTK_CHECK_VERSION(3, 0, 0)
+ g_object_set (G_OBJECT (entry_name), "editable", FALSE, NULL);
+ g_object_set (G_OBJECT (entry_author), "editable", FALSE, NULL);
+ g_object_set (G_OBJECT (entry_uuid), "editable", FALSE, NULL);
+ g_object_set (G_OBJECT (entry_serial), "editable", FALSE, NULL);
+ g_object_set (G_OBJECT (entry_icon), "editable", FALSE, NULL);
+ g_object_set (G_OBJECT (entry_valid_input_chars), "editable", FALSE, NULL);
+ g_object_set (G_OBJECT (split_keys.entry), "editable", FALSE, NULL);
+ g_object_set (G_OBJECT (commit_keys.entry), "editable", FALSE, NULL);
+ g_object_set (G_OBJECT (forward_keys.entry), "editable", FALSE, NULL);
+ g_object_set (G_OBJECT (select_keys.entry), "editable", FALSE, NULL);
+ g_object_set (G_OBJECT (page_up_keys.entry), "editable", FALSE, NULL);
+ g_object_set (G_OBJECT (page_down_keys.entry), "editable", FALSE, NULL);
+#else
gtk_entry_set_editable (GTK_ENTRY (entry_name), FALSE);
gtk_entry_set_editable (GTK_ENTRY (entry_author), FALSE);
gtk_entry_set_editable (GTK_ENTRY (entry_uuid), FALSE);
gtk_entry_set_editable (GTK_ENTRY (select_keys.entry), FALSE);
gtk_entry_set_editable (GTK_ENTRY (page_up_keys.entry), FALSE);
gtk_entry_set_editable (GTK_ENTRY (page_down_keys.entry), FALSE);
+#endif
if (!editable) {
+#if GTK_CHECK_VERSION(3, 0, 0)
+ g_object_set (G_OBJECT (entry_status_prompt), "editable", FALSE, NULL);
+ g_object_set (G_OBJECT (entry_languages), "editable", FALSE, NULL);
+ g_object_set (G_OBJECT (entry_multi_wildcard_chars), "editable", FALSE, NULL);
+ g_object_set (G_OBJECT (entry_single_wildcard_chars), "editable", FALSE, NULL);
+#else
gtk_entry_set_editable (GTK_ENTRY (entry_status_prompt), FALSE);
gtk_entry_set_editable (GTK_ENTRY (entry_languages), FALSE);
gtk_entry_set_editable (GTK_ENTRY (entry_multi_wildcard_chars), FALSE);
gtk_entry_set_editable (GTK_ENTRY (entry_single_wildcard_chars), FALSE);
+#endif
gtk_widget_set_sensitive (spin_max_key_length, FALSE);
gtk_widget_set_sensitive (toggle_show_key_prompt, FALSE);
gtk_widget_set_sensitive (toggle_auto_select, FALSE);
}
gtk_widget_destroy (dialog);
+#if GTK_CHECK_VERSION(3, 0, 0)
+#else
gtk_object_destroy (GTK_OBJECT (tooltips));
+#endif
}
return result;