spell-plugin: Clean up a few things

Clean up a couple files, remove deprecated widgets from the UI files and clean
up the styling of a couple dialogs a bit
This commit is contained in:
JosephMcc 2017-01-12 23:59:23 -08:00
parent c03a0a3e7d
commit c65c6f2a3e
7 changed files with 1220 additions and 1295 deletions

View File

@ -1,136 +1,132 @@
<?xml version="1.0"?>
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<!--*- mode: xml -*-->
<interface>
<requires lib="gtk+" version="3.10"/>
<object class="GtkDialog" id="dialog">
<property name="can_focus">False</property>
<property name="border_width">5</property>
<property name="title" translatable="yes">Set language</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">True</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">True</property>
<property name="decorated">True</property>
<property name="skip_taskbar_hint">False</property>
<property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="focus_on_map">True</property>
<property name="urgency_hint">False</property>
<property name="type_hint">dialog</property>
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox1">
<object class="GtkBox" id="dialog-vbox1">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="can_focus">False</property>
<property name="spacing">2</property>
<child internal-child="action_area">
<object class="GtkHButtonBox" id="dialog-action_area1">
<object class="GtkButtonBox" id="dialog-action_area1">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="helpbutton1">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-help</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
</object>
</child>
<child>
<object class="GtkButton" id="closebutton1">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-cancel</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
</object>
</child>
<child>
<object class="GtkButton" id="button1">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-ok</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
</object>
</child>
</object>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="pack_type">GTK_PACK_END</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkVBox" id="content">
<property name="border_width">5</property>
<object class="GtkButton" id="closebutton1">
<property name="label">gtk-cancel</property>
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="button1">
<property name="label">gtk-ok</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox" id="content">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="border_width">5</property>
<property name="orientation">vertical</property>
<property name="spacing">11</property>
<child>
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Select the _language of the current document.</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">True</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">languages_treeview</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow1">
<property name="height_request">180</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<property name="shadow_type">etched-in</property>
<child>
<object class="GtkTreeView" id="languages_treeview">
<property name="height_request">180</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="headers_visible">False</property>
<property name="rules_hint">False</property>
<property name="reorderable">False</property>
<property name="enable_search">True</property>
<property name="fixed_height_mode">False</property>
<property name="hover_selection">False</property>
<property name="hover_expand">False</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection1"/>
</child>
</object>
</child>
</object>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
</object>

View File

@ -1,479 +1,366 @@
<?xml version="1.0"?>
<!--*- mode: xml -*-->
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<interface>
<object class="GtkImage" id="check_word_image">
<property name="stock">gtk-spell-check</property>
<property name="icon_size">4</property>
</object>
<object class="GtkImage" id="add_word_image">
<property name="stock">gtk-add</property>
<property name="icon_size">4</property>
</object>
<object class="GtkImage" id="ignore_image">
<property name="stock">gtk-go-down</property>
<property name="icon_size">4</property>
</object>
<object class="GtkImage" id="change_image">
<property name="stock">gtk-convert</property>
<property name="icon_size">4</property>
</object>
<object class="GtkImage" id="ignore_all_image">
<property name="stock">gtk-goto-bottom</property>
<property name="icon_size">4</property>
</object>
<object class="GtkImage" id="change_all_image">
<property name="stock">gtk-convert</property>
<property name="icon_size">4</property>
</object>
<requires lib="gtk+" version="3.10"/>
<object class="GtkWindow" id="check_spelling_window">
<property name="visible">True</property>
<property name="title" translatable="yes">Check spelling</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property>
<property name="can_focus">False</property>
<property name="resizable">False</property>
<property name="destroy_with_parent">False</property>
<property name="destroy_with_parent">True</property>
<property name="type_hint">dialog</property>
<property name="skip_taskbar_hint">True</property>
<property name="startup_id">Check spelling</property>
<child>
<object class="GtkVBox" id="content">
<property name="border_width">12</property>
<object class="GtkBox" id="content">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="can_focus">False</property>
<property name="border_width">12</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkTable" id="table1">
<object class="GtkGrid" id="grid1">
<property name="visible">True</property>
<property name="n_rows">2</property>
<property name="n_columns">2</property>
<property name="homogeneous">False</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="row_spacing">6</property>
<property name="column_spacing">12</property>
<child>
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Misspelled word:</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_options">fill</property>
<property name="y_options"/>
</packing>
</child>
<child>
<object class="GtkLabel" id="misspelled_word_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">word</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="justify">center</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<attributes>
<attribute name="weight" value="PANGO_WEIGHT_BOLD"/>
</attributes>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_options">fill</property>
<property name="y_options"/>
</packing>
</child>
<child>
<object class="GtkLabel" id="label3">
<object class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Change _to:</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">word_entry</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">fill</property>
<property name="y_options"/>
</packing>
</child>
<child>
<object class="GtkHBox" id="hbox1">
<object class="GtkBox" id="box1">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="spacing">12</property>
<child>
<object class="GtkEntry" id="word_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"/>
<property name="has_frame">True</property>
<property name="activates_default">False</property>
<property name="hexpand">True</property>
</object>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="check_word_button">
<property name="label" translatable="yes">Check _Word</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="image">check_word_image</property>
<property name="label" translatable="yes">Check _Word</property>
<property name="receives_default">True</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_options">fill</property>
</packing>
</child>
</object>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkTable" id="table2">
<object class="GtkGrid" id="grid2">
<property name="visible">True</property>
<property name="n_rows">3</property>
<property name="n_columns">2</property>
<property name="homogeneous">False</property>
<property name="can_focus">False</property>
<property name="row_spacing">6</property>
<property name="column_spacing">12</property>
<child>
<object class="GtkLabel" id="label4">
<object class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">_Suggestions:</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">suggestions_list</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_options">fill</property>
<property name="y_options"/>
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow1">
<property name="visible">True</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkTreeView" id="suggestions_list">
<property name="width_request">200</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="headers_visible">False</property>
<property name="rules_hint">False</property>
<property name="reorderable">False</property>
<property name="enable_search">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection1"/>
</child>
</object>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
</packing>
</child>
<child>
<object class="GtkVBox" id="vbox2">
<object class="GtkBox" id="box2">
<property name="visible">True</property>
<property name="homogeneous">True</property>
<property name="can_focus">False</property>
<property name="margin_bottom">6</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
<object class="GtkTable" id="table3">
<object class="GtkGrid" id="grid3">
<property name="visible">True</property>
<property name="n_rows">2</property>
<property name="n_columns">2</property>
<property name="homogeneous">True</property>
<property name="can_focus">False</property>
<property name="row_spacing">12</property>
<property name="column_spacing">12</property>
<child>
<object class="GtkButton" id="ignore_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="image">ignore_image</property>
<property name="label" translatable="yes">_Ignore</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="y_options">expand</property>
</packing>
</child>
<child>
<object class="GtkButton" id="change_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="image">change_image</property>
<property name="label" translatable="yes">Cha_nge</property>
<property name="receives_default">True</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_options">expand</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="ignore_all_button">
<property name="label" translatable="yes">Ignore _All</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="image">ignore_all_image</property>
<property name="label" translatable="yes">Ignore _All</property>
<property name="receives_default">True</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="y_options">expand</property>
</packing>
</child>
<child>
<object class="GtkButton" id="change_button">
<property name="label" translatable="yes">Cha_nge</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="change_all_button">
<property name="label" translatable="yes">Change A_ll</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="image">change_all_image</property>
<property name="label" translatable="yes">Change A_ll</property>
<property name="receives_default">True</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_options">expand</property>
</packing>
</child>
</object>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkVBox" id="vbox3">
<object class="GtkBox" id="box3">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">11</property>
<child>
<object class="GtkLabel" id="label6">
<object class="GtkLabel" id="label4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">User dictionary:</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">7.45058e-09</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="hbox2">
<object class="GtkBox" id="box7">
<property name="visible">True</property>
<property name="homogeneous">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<property name="homogeneous">True</property>
<child>
<object class="GtkButton" id="add_word_button">
<property name="label" translatable="yes">Add w_ord</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="image">add_word_image</property>
<property name="label" translatable="yes">Add w_ord</property>
<property name="receives_default">True</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</object>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">False</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="hbox32">
<object class="GtkBox" id="box4">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="can_focus">False</property>
<property name="spacing">12</property>
<child>
<object class="GtkLabel" id="label44">
<object class="GtkLabel" id="label5">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Language:</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</object>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="language_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Language</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<attributes>
<attribute name="weight" value="PANGO_WEIGHT_BOLD"/>
</attributes>
</object>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">fill</property>
<property name="y_options">fill</property>
</packing>
</child>
<child>
<object class="GtkHButtonBox" id="hbuttonbox1">
<object class="GtkButtonBox" id="buttonbox1">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<property name="spacing">0</property>
<property name="can_focus">False</property>
<property name="homogeneous">True</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="close_button">
<property name="label" translatable="yes">_Close</property>
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-close</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="receives_default">True</property>
<property name="halign">end</property>
<property name="use_underline">True</property>
<style>
<class name="text-button"/>
</style>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">fill</property>
<property name="y_options">fill</property>
<property name="top_attach">3</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>

View File

@ -43,7 +43,8 @@
#include "xed-automatic-spell-checker.h"
#include "xed-spell-utils.h"
struct _XedAutomaticSpellChecker {
struct _XedAutomaticSpellChecker
{
XedDocument *doc;
GSList *views;
@ -63,13 +64,16 @@ static GQuark suggestion_id = 0;
static void xed_automatic_spell_checker_free_internal (XedAutomaticSpellChecker *spell);
static void
view_destroy (XedView *view, XedAutomaticSpellChecker *spell)
view_destroy (XedView *view,
XedAutomaticSpellChecker *spell)
{
xed_automatic_spell_checker_detach_view (spell, view);
}
static void
check_word (XedAutomaticSpellChecker *spell, GtkTextIter *start, GtkTextIter *end)
check_word (XedAutomaticSpellChecker *spell,
GtkTextIter *start,
GtkTextIter *end)
{
gchar *word;
@ -86,10 +90,7 @@ check_word (XedAutomaticSpellChecker *spell, GtkTextIter *start, GtkTextIter *en
g_print ("Apply tag: [%d - %d]\n", gtk_text_iter_get_offset (start),
gtk_text_iter_get_offset (end));
*/
gtk_text_buffer_apply_tag (GTK_TEXT_BUFFER (spell->doc),
spell->tag_highlight,
start,
end);
gtk_text_buffer_apply_tag (GTK_TEXT_BUFFER (spell->doc), spell->tag_highlight, start, end);
}
g_free (word);
@ -117,12 +118,13 @@ check_range (XedAutomaticSpellChecker *spell,
*/
if (gtk_text_iter_inside_word (&end))
{
gtk_text_iter_forward_word_end (&end);
}
if (!gtk_text_iter_starts_word (&start))
{
if (gtk_text_iter_inside_word (&start) ||
gtk_text_iter_ends_word (&start))
if (gtk_text_iter_inside_word (&start) || gtk_text_iter_ends_word (&start))
{
gtk_text_iter_backward_word_start (&start);
}
@ -133,9 +135,11 @@ check_range (XedAutomaticSpellChecker *spell,
* skip forward to the beginning of the next word. */
if (gtk_text_iter_forward_word_end (&start))
{
gtk_text_iter_backward_word_start (&start);
}
}
}
gtk_text_buffer_get_iter_at_mark (GTK_TEXT_BUFFER (spell->doc),
&cursor,
@ -147,10 +151,7 @@ check_range (XedAutomaticSpellChecker *spell,
highlight = gtk_text_iter_has_tag (&cursor, spell->tag_highlight) ||
gtk_text_iter_has_tag (&precursor, spell->tag_highlight);
gtk_text_buffer_remove_tag (GTK_TEXT_BUFFER (spell->doc),
spell->tag_highlight,
&start,
&end);
gtk_text_buffer_remove_tag (GTK_TEXT_BUFFER (spell->doc), spell->tag_highlight, &start, &end);
/* Fix a corner case when replacement occurs at beginning of buffer:
* An iter at offset 0 seems to always be inside a word,
@ -164,8 +165,7 @@ check_range (XedAutomaticSpellChecker *spell,
wstart = start;
while (xed_spell_utils_skip_no_spell_check (&wstart, &end) &&
gtk_text_iter_compare (&wstart, &end) < 0)
while (xed_spell_utils_skip_no_spell_check (&wstart, &end) && gtk_text_iter_compare (&wstart, &end) < 0)
{
gboolean inword;
@ -174,8 +174,7 @@ check_range (XedAutomaticSpellChecker *spell,
gtk_text_iter_forward_word_end (&wend);
inword = (gtk_text_iter_compare (&wstart, &cursor) < 0) &&
(gtk_text_iter_compare (&cursor, &wend) <= 0);
inword = (gtk_text_iter_compare (&wstart, &cursor) < 0) && (gtk_text_iter_compare (&cursor, &wend) <= 0);
if (inword && !force_all)
{
@ -183,10 +182,14 @@ check_range (XedAutomaticSpellChecker *spell,
* only check if it's already highligted,
* otherwise defer this check until later. */
if (highlight)
{
check_word (spell, &wstart, &wend);
}
else
{
spell->deferred_check = TRUE;
}
}
else
{
check_word (spell, &wstart, &wend);
@ -200,7 +203,9 @@ check_range (XedAutomaticSpellChecker *spell,
/* make sure we've actually advanced
* (we don't advance in some corner cases), */
if (gtk_text_iter_equal (&wstart, &wend))
{
break; /* we're done in these cases.. */
}
/* and then pick this as the new next word beginning. */
wstart = wend;
@ -213,12 +218,8 @@ check_deferred_range (XedAutomaticSpellChecker *spell,
{
GtkTextIter start, end;
gtk_text_buffer_get_iter_at_mark (GTK_TEXT_BUFFER (spell->doc),
&start,
spell->mark_insert_start);
gtk_text_buffer_get_iter_at_mark (GTK_TEXT_BUFFER (spell->doc),
&end,
spell->mark_insert_end);
gtk_text_buffer_get_iter_at_mark (GTK_TEXT_BUFFER (spell->doc), &start, spell->mark_insert_start);
gtk_text_buffer_get_iter_at_mark (GTK_TEXT_BUFFER (spell->doc), &end, spell->mark_insert_end);
check_range (spell, start, end, force_all);
}
@ -231,15 +232,21 @@ check_deferred_range (XedAutomaticSpellChecker *spell,
* this may be overkill for the common case (inserting one character). */
static void
insert_text_before (GtkTextBuffer *buffer, GtkTextIter *iter,
gchar *text, gint len, XedAutomaticSpellChecker *spell)
insert_text_before (GtkTextBuffer *buffer,
GtkTextIter *iter,
gchar *text,
gint len,
XedAutomaticSpellChecker *spell)
{
gtk_text_buffer_move_mark (buffer, spell->mark_insert_start, iter);
}
static void
insert_text_after (GtkTextBuffer *buffer, GtkTextIter *iter,
gchar *text, gint len, XedAutomaticSpellChecker *spell)
insert_text_after (GtkTextBuffer *buffer,
GtkTextIter *iter,
gchar *text,
gint len,
XedAutomaticSpellChecker *spell)
{
GtkTextIter start;
@ -259,7 +266,9 @@ insert_text_after (GtkTextBuffer *buffer, GtkTextIter *iter,
*/
static void
delete_range_after (GtkTextBuffer *buffer, GtkTextIter *start, GtkTextIter *end,
delete_range_after (GtkTextBuffer *buffer,
GtkTextIter *start,
GtkTextIter *end,
XedAutomaticSpellChecker *spell)
{
check_range (spell, *start, *end, FALSE);
@ -273,7 +282,9 @@ mark_set (GtkTextBuffer *buffer,
{
/* if the cursor has moved and there is a deferred check so handle it now */
if ((mark == gtk_text_buffer_get_insert (buffer)) && spell->deferred_check)
{
check_deferred_range (spell, FALSE);
}
}
static void
@ -285,16 +296,21 @@ get_word_extents_from_mark (GtkTextBuffer *buffer,
gtk_text_buffer_get_iter_at_mark(buffer, start, mark);
if (!gtk_text_iter_starts_word (start))
{
gtk_text_iter_backward_word_start (start);
}
*end = *start;
if (gtk_text_iter_inside_word (end))
{
gtk_text_iter_forward_word_end (end);
}
}
static void
remove_tag_to_word (XedAutomaticSpellChecker *spell, const gchar *word)
remove_tag_to_word (XedAutomaticSpellChecker *spell,
const gchar *word)
{
GtkTextIter iter;
GtkTextIter match_start, match_end;
@ -316,8 +332,7 @@ remove_tag_to_word (XedAutomaticSpellChecker *spell, const gchar *word)
if (found)
{
if (gtk_text_iter_starts_word (&match_start) &&
gtk_text_iter_ends_word (&match_end))
if (gtk_text_iter_starts_word (&match_start) && gtk_text_iter_ends_word (&match_end))
{
gtk_text_buffer_remove_tag (GTK_TEXT_BUFFER (spell->doc),
spell->tag_highlight,
@ -331,7 +346,8 @@ remove_tag_to_word (XedAutomaticSpellChecker *spell, const gchar *word)
}
static void
add_to_dictionary (GtkWidget *menuitem, XedAutomaticSpellChecker *spell)
add_to_dictionary (GtkWidget *menuitem,
XedAutomaticSpellChecker *spell)
{
gchar *word;
@ -339,10 +355,7 @@ add_to_dictionary (GtkWidget *menuitem, XedAutomaticSpellChecker *spell)
get_word_extents_from_mark (GTK_TEXT_BUFFER (spell->doc), &start, &end, spell->mark_click);
word = gtk_text_buffer_get_text (GTK_TEXT_BUFFER (spell->doc),
&start,
&end,
FALSE);
word = gtk_text_buffer_get_text (GTK_TEXT_BUFFER (spell->doc), &start, &end, FALSE);
xed_spell_checker_add_word_to_personal (spell->spell_checker, word, -1);
@ -350,7 +363,8 @@ add_to_dictionary (GtkWidget *menuitem, XedAutomaticSpellChecker *spell)
}
static void
ignore_all (GtkWidget *menuitem, XedAutomaticSpellChecker *spell)
ignore_all (GtkWidget *menuitem,
XedAutomaticSpellChecker *spell)
{
gchar *word;
@ -358,10 +372,7 @@ ignore_all (GtkWidget *menuitem, XedAutomaticSpellChecker *spell)
get_word_extents_from_mark (GTK_TEXT_BUFFER (spell->doc), &start, &end, spell->mark_click);
word = gtk_text_buffer_get_text (GTK_TEXT_BUFFER (spell->doc),
&start,
&end,
FALSE);
word = gtk_text_buffer_get_text (GTK_TEXT_BUFFER (spell->doc), &start, &end, FALSE);
xed_spell_checker_add_word_to_session (spell->spell_checker, word, -1);
@ -369,7 +380,8 @@ ignore_all (GtkWidget *menuitem, XedAutomaticSpellChecker *spell)
}
static void
replace_word (GtkWidget *menuitem, XedAutomaticSpellChecker *spell)
replace_word (GtkWidget *menuitem,
XedAutomaticSpellChecker *spell)
{
gchar *oldword;
const gchar *newword;
@ -398,7 +410,8 @@ replace_word (GtkWidget *menuitem, XedAutomaticSpellChecker *spell)
}
static GtkWidget *
build_suggestion_menu (XedAutomaticSpellChecker *spell, const gchar *word)
build_suggestion_menu (XedAutomaticSpellChecker *spell,
const gchar *word)
{
GtkWidget *topmenu, *menu;
GtkWidget *mi;
@ -454,10 +467,10 @@ build_suggestion_menu (XedAutomaticSpellChecker *spell, const gchar *word)
label = gtk_label_new (label_text);
gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gtk_widget_set_halign (label, GTK_ALIGN_START);
mi = gtk_menu_item_new ();
gtk_container_add (GTK_CONTAINER(mi), label);
gtk_container_add (GTK_CONTAINER (mi), label);
gtk_widget_show_all (mi);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), mi);
@ -468,10 +481,8 @@ build_suggestion_menu (XedAutomaticSpellChecker *spell, const gchar *word)
(GDestroyNotify)g_free);
g_free (label_text);
g_signal_connect (mi,
"activate",
G_CALLBACK (replace_word),
spell);
g_signal_connect (mi, "activate",
G_CALLBACK (replace_word), spell);
count++;
@ -496,30 +507,20 @@ build_suggestion_menu (XedAutomaticSpellChecker *spell, const gchar *word)
gtk_menu_shell_append (GTK_MENU_SHELL (topmenu), mi);
/* Ignore all */
mi = gtk_image_menu_item_new_with_mnemonic (_("_Ignore All"));
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (mi),
gtk_image_new_from_stock (GTK_STOCK_GOTO_BOTTOM,
GTK_ICON_SIZE_MENU));
mi = gtk_menu_item_new_with_mnemonic (_("_Ignore All"));
g_signal_connect (mi,
"activate",
G_CALLBACK(ignore_all),
spell);
g_signal_connect (mi, "activate",
G_CALLBACK(ignore_all), spell);
gtk_widget_show_all (mi);
gtk_menu_shell_append (GTK_MENU_SHELL (topmenu), mi);
/* + Add to Dictionary */
mi = gtk_image_menu_item_new_with_mnemonic (_("_Add"));
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (mi),
gtk_image_new_from_stock (GTK_STOCK_ADD,
GTK_ICON_SIZE_MENU));
mi = gtk_menu_item_new_with_mnemonic (_("_Add"));
g_signal_connect (mi,
"activate",
G_CALLBACK (add_to_dictionary),
spell);
g_signal_connect (mi, "activate",
G_CALLBACK (add_to_dictionary), spell);
gtk_widget_show_all (mi);
@ -529,9 +530,11 @@ build_suggestion_menu (XedAutomaticSpellChecker *spell, const gchar *word)
}
static void
populate_popup (GtkTextView *textview, GtkMenu *menu, XedAutomaticSpellChecker *spell)
populate_popup (GtkTextView *textview,
GtkMenu *menu,
XedAutomaticSpellChecker *spell)
{
GtkWidget *img, *mi;
GtkWidget *mi;
GtkTextIter start, end;
char *word;
@ -541,7 +544,9 @@ populate_popup (GtkTextView *textview, GtkMenu *menu, XedAutomaticSpellChecker *
/* if our highlight algorithm ever messes up,
* this isn't correct, either. */
if (!gtk_text_iter_has_tag (&start, spell->tag_highlight))
{
return; /* word wasn't misspelled. */
}
/* menu separator comes first. */
mi = gtk_menu_item_new ();
@ -549,13 +554,10 @@ populate_popup (GtkTextView *textview, GtkMenu *menu, XedAutomaticSpellChecker *
gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), mi);
/* then, on top of it, the suggestions menu. */
img = gtk_image_new_from_stock (GTK_STOCK_SPELL_CHECK, GTK_ICON_SIZE_MENU);
mi = gtk_image_menu_item_new_with_mnemonic (_("_Spelling Suggestions..."));
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (mi), img);
mi = gtk_menu_item_new_with_mnemonic (_("_Spelling Suggestions..."));
word = gtk_text_buffer_get_text (GTK_TEXT_BUFFER (spell->doc), &start, &end, FALSE);
gtk_menu_item_set_submenu (GTK_MENU_ITEM (mi),
build_suggestion_menu (spell, word));
gtk_menu_item_set_submenu (GTK_MENU_ITEM (mi), build_suggestion_menu (spell, word));
g_free(word);
gtk_widget_show_all (mi);
@ -583,9 +585,13 @@ add_word_signal_cb (XedSpellChecker *checker,
gchar *w;
if (len < 0)
{
w = g_strdup (word);
}
else
{
w = g_strndup (word, len);
}
remove_tag_to_word (spell, w);
@ -625,12 +631,11 @@ button_press_event (GtkTextView *view,
/* handle deferred check if it exists */
if (spell->deferred_check)
{
check_deferred_range (spell, TRUE);
}
gtk_text_view_window_to_buffer_coords (view,
GTK_TEXT_WINDOW_TEXT,
event->x, event->y,
&x, &y);
gtk_text_view_window_to_buffer_coords (view, GTK_TEXT_WINDOW_TEXT, event->x, event->y, &x, &y);
gtk_text_view_get_iter_at_location (view, &iter, x, y);
@ -645,7 +650,8 @@ button_press_event (GtkTextView *view,
* will contain the wrong set of suggestions.
*/
static gboolean
popup_menu_event (GtkTextView *view, XedAutomaticSpellChecker *spell)
popup_menu_event (GtkTextView *view,
XedAutomaticSpellChecker *spell)
{
GtkTextIter iter;
GtkTextBuffer *buffer;
@ -654,10 +660,11 @@ popup_menu_event (GtkTextView *view, XedAutomaticSpellChecker *spell)
/* handle deferred check if it exists */
if (spell->deferred_check)
{
check_deferred_range (spell, TRUE);
}
gtk_text_buffer_get_iter_at_mark (buffer, &iter,
gtk_text_buffer_get_insert (buffer));
gtk_text_buffer_get_iter_at_mark (buffer, &iter, gtk_text_buffer_get_insert (buffer));
gtk_text_buffer_move_mark (buffer, spell->mark_click, &iter);
return FALSE;
@ -669,8 +676,7 @@ tag_table_changed (GtkTextTagTable *table,
{
g_return_if_fail (spell->tag_highlight != NULL);
gtk_text_tag_set_priority (spell->tag_highlight,
gtk_text_tag_table_get_size (table) - 1);
gtk_text_tag_set_priority (spell->tag_highlight, gtk_text_tag_table_get_size (table) - 1);
}
static void
@ -716,8 +722,7 @@ xed_automatic_spell_checker_new (XedDocument *doc,
g_return_val_if_fail (XED_IS_DOCUMENT (doc), NULL);
g_return_val_if_fail (XED_IS_SPELL_CHECKER (checker), NULL);
g_return_val_if_fail ((spell = xed_automatic_spell_checker_get_from_document (doc)) == NULL,
spell);
g_return_val_if_fail ((spell = xed_automatic_spell_checker_get_from_document (doc)) == NULL, spell);
/* attach to the widget */
spell = g_new0 (XedAutomaticSpellChecker, 1);
@ -727,85 +732,54 @@ xed_automatic_spell_checker_new (XedDocument *doc,
if (automatic_spell_checker_id == 0)
{
automatic_spell_checker_id =
g_quark_from_string ("XedAutomaticSpellCheckerID");
automatic_spell_checker_id = g_quark_from_string ("XedAutomaticSpellCheckerID");
}
if (suggestion_id == 0)
{
suggestion_id = g_quark_from_string ("XedAutoSuggestionID");
}
g_object_set_qdata_full (G_OBJECT (doc),
automatic_spell_checker_id,
spell,
(GDestroyNotify)xed_automatic_spell_checker_free_internal);
g_object_set_qdata_full (G_OBJECT (doc), automatic_spell_checker_id,
spell, (GDestroyNotify)xed_automatic_spell_checker_free_internal);
g_signal_connect (doc,
"insert-text",
G_CALLBACK (insert_text_before),
spell);
g_signal_connect_after (doc,
"insert-text",
G_CALLBACK (insert_text_after),
spell);
g_signal_connect_after (doc,
"delete-range",
G_CALLBACK (delete_range_after),
spell);
g_signal_connect (doc,
"mark-set",
G_CALLBACK (mark_set),
spell);
g_signal_connect (doc, "insert-text",
G_CALLBACK (insert_text_before), spell);
g_signal_connect_after (doc, "insert-text",
G_CALLBACK (insert_text_after), spell);
g_signal_connect_after (doc, "delete-range",
G_CALLBACK (delete_range_after), spell);
g_signal_connect (doc, "mark-set",
G_CALLBACK (mark_set), spell);
g_signal_connect (doc,
"highlight-updated",
G_CALLBACK (highlight_updated),
spell);
g_signal_connect (doc, "highlight-updated",
G_CALLBACK (highlight_updated), spell);
g_signal_connect (spell->spell_checker,
"add_word_to_session",
G_CALLBACK (add_word_signal_cb),
spell);
g_signal_connect (spell->spell_checker,
"add_word_to_personal",
G_CALLBACK (add_word_signal_cb),
spell);
g_signal_connect (spell->spell_checker,
"clear_session",
G_CALLBACK (clear_session_cb),
spell);
g_signal_connect (spell->spell_checker,
"set_language",
G_CALLBACK (set_language_cb),
spell);
g_signal_connect (spell->spell_checker, "add_word_to_session",
G_CALLBACK (add_word_signal_cb), spell);
g_signal_connect (spell->spell_checker, "add_word_to_personal",
G_CALLBACK (add_word_signal_cb), spell);
g_signal_connect (spell->spell_checker, "clear_session",
G_CALLBACK (clear_session_cb), spell);
g_signal_connect (spell->spell_checker, "set_language",
G_CALLBACK (set_language_cb), spell);
spell->tag_highlight = gtk_text_buffer_create_tag (
GTK_TEXT_BUFFER (doc),
spell->tag_highlight = gtk_text_buffer_create_tag (GTK_TEXT_BUFFER (doc),
"gtkspell-misspelled",
"underline", PANGO_UNDERLINE_ERROR,
NULL);
g_object_weak_ref (G_OBJECT (spell->tag_highlight),
(GWeakNotify)spell_tag_destroyed,
spell);
g_object_weak_ref (G_OBJECT (spell->tag_highlight), (GWeakNotify)spell_tag_destroyed, spell);
tag_table = gtk_text_buffer_get_tag_table (GTK_TEXT_BUFFER (doc));
gtk_text_tag_set_priority (spell->tag_highlight,
gtk_text_tag_table_get_size (tag_table) - 1);
gtk_text_tag_set_priority (spell->tag_highlight, gtk_text_tag_table_get_size (tag_table) - 1);
g_signal_connect (tag_table,
"tag-added",
G_CALLBACK (tag_added_or_removed),
spell);
g_signal_connect (tag_table,
"tag-removed",
G_CALLBACK (tag_added_or_removed),
spell);
g_signal_connect (tag_table,
"tag-changed",
G_CALLBACK (tag_changed),
spell);
g_signal_connect (tag_table, "tag-added",
G_CALLBACK (tag_added_or_removed), spell);
g_signal_connect (tag_table, "tag-removed",
G_CALLBACK (tag_added_or_removed), spell);
g_signal_connect (tag_table, "tag-changed",
G_CALLBACK (tag_changed), spell);
/* we create the mark here, but we don't use it until text is
* inserted, so we don't really care where iter points. */
@ -816,17 +790,14 @@ xed_automatic_spell_checker_new (XedDocument *doc,
if (spell->mark_insert_start == NULL)
{
spell->mark_insert_start =
gtk_text_buffer_create_mark (GTK_TEXT_BUFFER (doc),
spell->mark_insert_start = gtk_text_buffer_create_mark (GTK_TEXT_BUFFER (doc),
"xed-automatic-spell-checker-insert-start",
&start,
TRUE);
}
else
{
gtk_text_buffer_move_mark (GTK_TEXT_BUFFER (doc),
spell->mark_insert_start,
&start);
gtk_text_buffer_move_mark (GTK_TEXT_BUFFER (doc), spell->mark_insert_start, &start);
}
spell->mark_insert_end = gtk_text_buffer_get_mark (GTK_TEXT_BUFFER (doc),
@ -834,17 +805,14 @@ xed_automatic_spell_checker_new (XedDocument *doc,
if (spell->mark_insert_end == NULL)
{
spell->mark_insert_end =
gtk_text_buffer_create_mark (GTK_TEXT_BUFFER (doc),
spell->mark_insert_end = gtk_text_buffer_create_mark (GTK_TEXT_BUFFER (doc),
"xed-automatic-spell-checker-insert-end",
&start,
TRUE);
}
else
{
gtk_text_buffer_move_mark (GTK_TEXT_BUFFER (doc),
spell->mark_insert_end,
&start);
gtk_text_buffer_move_mark (GTK_TEXT_BUFFER (doc), spell->mark_insert_end, &start);
}
spell->mark_click = gtk_text_buffer_get_mark (GTK_TEXT_BUFFER (doc),
@ -852,17 +820,14 @@ xed_automatic_spell_checker_new (XedDocument *doc,
if (spell->mark_click == NULL)
{
spell->mark_click =
gtk_text_buffer_create_mark (GTK_TEXT_BUFFER (doc),
spell->mark_click = gtk_text_buffer_create_mark (GTK_TEXT_BUFFER (doc),
"xed-automatic-spell-checker-click",
&start,
TRUE);
}
else
{
gtk_text_buffer_move_mark (GTK_TEXT_BUFFER (doc),
spell->mark_click,
&start);
gtk_text_buffer_move_mark (GTK_TEXT_BUFFER (doc), spell->mark_click, &start);
}
spell->deferred_check = FALSE;
@ -876,7 +841,9 @@ xed_automatic_spell_checker_get_from_document (const XedDocument *doc)
g_return_val_if_fail (XED_IS_DOCUMENT (doc), NULL);
if (automatic_spell_checker_id == 0)
{
return NULL;
}
return g_object_get_qdata (G_OBJECT (doc), automatic_spell_checker_id);
}
@ -888,7 +855,9 @@ xed_automatic_spell_checker_free (XedAutomaticSpellChecker *spell)
g_return_if_fail (xed_automatic_spell_checker_get_from_document (spell->doc) == spell);
if (automatic_spell_checker_id == 0)
{
return;
}
g_object_set_qdata (G_OBJECT (spell->doc), automatic_spell_checker_id, NULL);
}
@ -906,13 +875,8 @@ xed_automatic_spell_checker_free_internal (XedAutomaticSpellChecker *spell)
if (table != NULL && spell->tag_highlight != NULL)
{
gtk_text_buffer_get_bounds (GTK_TEXT_BUFFER (spell->doc),
&start,
&end);
gtk_text_buffer_remove_tag (GTK_TEXT_BUFFER (spell->doc),
spell->tag_highlight,
&start,
&end);
gtk_text_buffer_get_bounds (GTK_TEXT_BUFFER (spell->doc), &start, &end);
gtk_text_buffer_remove_tag (GTK_TEXT_BUFFER (spell->doc), spell->tag_highlight, &start, &end);
g_signal_handlers_disconnect_matched (G_OBJECT (table),
G_SIGNAL_MATCH_DATA,
@ -958,46 +922,34 @@ xed_automatic_spell_checker_free_internal (XedAutomaticSpellChecker *spell)
}
void
xed_automatic_spell_checker_attach_view (
XedAutomaticSpellChecker *spell,
xed_automatic_spell_checker_attach_view (XedAutomaticSpellChecker *spell,
XedView *view)
{
g_return_if_fail (spell != NULL);
g_return_if_fail (XED_IS_VIEW (view));
g_return_if_fail (gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)) ==
GTK_TEXT_BUFFER (spell->doc));
g_return_if_fail (gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)) == GTK_TEXT_BUFFER (spell->doc));
g_signal_connect (view,
"button-press-event",
G_CALLBACK (button_press_event),
spell);
g_signal_connect (view,
"popup-menu",
G_CALLBACK (popup_menu_event),
spell);
g_signal_connect (view,
"populate-popup",
G_CALLBACK (populate_popup),
spell);
g_signal_connect (view,
"destroy",
G_CALLBACK (view_destroy),
spell);
g_signal_connect (view, "button-press-event",
G_CALLBACK (button_press_event), spell);
g_signal_connect (view, "popup-menu",
G_CALLBACK (popup_menu_event), spell);
g_signal_connect (view, "populate-popup",
G_CALLBACK (populate_popup), spell);
g_signal_connect (view, "destroy",
G_CALLBACK (view_destroy), spell);
spell->views = g_slist_prepend (spell->views, view);
}
void
xed_automatic_spell_checker_detach_view (
XedAutomaticSpellChecker *spell,
xed_automatic_spell_checker_detach_view (XedAutomaticSpellChecker *spell,
XedView *view)
{
g_return_if_fail (spell != NULL);
g_return_if_fail (XED_IS_VIEW (view));
g_return_if_fail (gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)) ==
GTK_TEXT_BUFFER (spell->doc));
g_return_if_fail (gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)) == GTK_TEXT_BUFFER (spell->doc));
g_return_if_fail (spell->views != NULL);
g_signal_handlers_disconnect_matched (G_OBJECT (view),

View File

@ -55,7 +55,7 @@ struct _XedSpellLanguageDialog
GtkTreeModel *model;
};
G_DEFINE_TYPE(XedSpellLanguageDialog, xed_spell_language_dialog, GTK_TYPE_DIALOG)
G_DEFINE_TYPE (XedSpellLanguageDialog, xed_spell_language_dialog, GTK_TYPE_DIALOG)
static void
@ -70,9 +70,7 @@ dialog_response_handler (GtkDialog *dlg,
{
if (res_id == GTK_RESPONSE_HELP)
{
xed_help_display (GTK_WINDOW (dlg),
NULL,
"xed-spell-checker-plugin");
xed_help_display (GTK_WINDOW (dlg), NULL, "xed-spell-checker-plugin");
g_signal_stop_emission_by_name (dlg, "response");
}
@ -99,8 +97,7 @@ scroll_to_selected (GtkTreeView *tree_view)
path = gtk_tree_model_get_path (model, &iter);
g_return_if_fail (path != NULL);
gtk_tree_view_scroll_to_cell (tree_view,
path, NULL, TRUE, 1.0, 0.0);
gtk_tree_view_scroll_to_cell (tree_view, path, NULL, TRUE, 1.0, 0.0);
gtk_tree_path_free (path);
}
}
@ -130,12 +127,9 @@ create_dialog (XedSpellLanguageDialog *dlg,
};
gtk_dialog_add_buttons (GTK_DIALOG (dlg),
GTK_STOCK_CANCEL,
GTK_RESPONSE_CANCEL,
GTK_STOCK_OK,
GTK_RESPONSE_OK,
GTK_STOCK_HELP,
GTK_RESPONSE_HELP,
_("_Cancel"), GTK_RESPONSE_CANCEL,
_("_OK"), GTK_RESPONSE_OK,
_("_Help"), GTK_RESPONSE_HELP,
NULL);
gtk_window_set_title (GTK_WINDOW (dlg), _("Set language"));
@ -144,17 +138,12 @@ create_dialog (XedSpellLanguageDialog *dlg,
/* HIG defaults */
gtk_container_set_border_width (GTK_CONTAINER (dlg), 5);
gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))),
2); /* 2 * 5 + 2 = 12 */
gtk_container_set_border_width (GTK_CONTAINER (gtk_dialog_get_action_area (GTK_DIALOG (dlg))),
5);
gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_action_area (GTK_DIALOG (dlg))),
6);
gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))), 2);
gtk_container_set_border_width (GTK_CONTAINER (gtk_dialog_get_action_area (GTK_DIALOG (dlg))), 5);
gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_action_area (GTK_DIALOG (dlg))), 6);
g_signal_connect (dlg,
"response",
G_CALLBACK (dialog_response_handler),
NULL);
g_signal_connect (dlg, "response",
G_CALLBACK (dialog_response_handler), NULL);
ui_file = g_build_filename (data_dir, "languages-dialog.ui", NULL);
ret = xed_utils_get_ui_objects (ui_file,
@ -169,24 +158,18 @@ create_dialog (XedSpellLanguageDialog *dlg,
{
gtk_widget_show (error_widget);
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))),
error_widget,
TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))), error_widget, TRUE, TRUE, 0);
return;
}
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))),
content, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))), content, TRUE, TRUE, 0);
g_object_unref (content);
gtk_container_set_border_width (GTK_CONTAINER (content), 5);
dlg->model = GTK_TREE_MODEL (gtk_list_store_new (ENCODING_NUM_COLS,
G_TYPE_STRING,
G_TYPE_POINTER));
dlg->model = GTK_TREE_MODEL (gtk_list_store_new (ENCODING_NUM_COLS, G_TYPE_STRING, G_TYPE_POINTER));
gtk_tree_view_set_model (GTK_TREE_VIEW (dlg->languages_treeview),
dlg->model);
gtk_tree_view_set_model (GTK_TREE_VIEW (dlg->languages_treeview), dlg->model);
g_object_unref (dlg->model);
@ -198,20 +181,14 @@ create_dialog (XedSpellLanguageDialog *dlg,
COLUMN_LANGUAGE_NAME,
NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (dlg->languages_treeview),
column);
gtk_tree_view_append_column (GTK_TREE_VIEW (dlg->languages_treeview), column);
gtk_tree_view_set_search_column (GTK_TREE_VIEW (dlg->languages_treeview),
COLUMN_LANGUAGE_NAME);
gtk_tree_view_set_search_column (GTK_TREE_VIEW (dlg->languages_treeview), COLUMN_LANGUAGE_NAME);
g_signal_connect (dlg->languages_treeview,
"realize",
G_CALLBACK (scroll_to_selected),
dlg);
g_signal_connect (dlg->languages_treeview,
"row-activated",
G_CALLBACK (language_row_activated),
dlg);
g_signal_connect (dlg->languages_treeview, "realize",
G_CALLBACK (scroll_to_selected), dlg);
g_signal_connect (dlg->languages_treeview, "row-activated",
G_CALLBACK (language_row_activated), dlg);
}
static void
@ -294,12 +271,11 @@ xed_spell_language_get_selected_language (XedSpellLanguageDialog *dlg)
g_return_val_if_fail (selection != NULL, NULL);
if (!gtk_tree_selection_get_selected (selection, NULL, &iter))
{
return NULL;
}
gtk_tree_model_get_value (dlg->model,
&iter,
COLUMN_LANGUAGE_POINTER,
&value);
gtk_tree_model_get_value (dlg->model, &iter, COLUMN_LANGUAGE_POINTER, &value);
lang = (const XedSpellCheckerLanguage* ) g_value_get_pointer (&value);

View File

@ -44,7 +44,6 @@ G_BEGIN_DECLS
typedef struct _XedSpellLanguageDialog XedSpellLanguageDialog;
typedef struct _XedSpellLanguageDialogClass XedSpellLanguageDialogClass;
struct _XedSpellLanguageDialogClass
@ -58,8 +57,7 @@ GtkWidget *xed_spell_language_dialog_new (GtkWindow *parent,
const XedSpellCheckerLanguage *cur_lang,
const gchar *data_dir);
const XedSpellCheckerLanguage *
xed_spell_language_get_selected_language (XedSpellLanguageDialog *dlg);
const XedSpellCheckerLanguage *xed_spell_language_get_selected_language (XedSpellLanguageDialog *dlg);
G_END_DECLS

View File

@ -27,7 +27,7 @@
#include <string.h> /* For strlen */
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include <libpeas-gtk/peas-gtk-configurable.h>
#include <xed/xed-window.h>
@ -1039,7 +1039,6 @@ auto_spell_cb (GtkAction *action,
XedSpellPlugin *plugin)
{
XedSpellPluginPrivate *priv;
XedWindow *window;
XedDocument *doc;
gboolean active;
@ -1319,7 +1318,7 @@ xed_spell_plugin_activate (XedWindowActivatable *activatable)
{
XedDocument *doc = XED_DOCUMENT (l->data);
set_auto_spell_from_metadata (activatable, doc, priv->action_group);
set_auto_spell_from_metadata (XED_SPELL_PLUGIN (activatable), doc, priv->action_group);
g_signal_handlers_disconnect_by_func (doc, on_document_loaded, activatable);
g_signal_handlers_disconnect_by_func (doc, on_document_saved, activatable);

View File

@ -1,29 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--*- mode: xml -*-->
<!-- Generated with glade 3.18.3 -->
<interface>
<object class="GtkDialog" id="spell_dialog">
<requires lib="gtk+" version="3.12"/>
<object class="GtkDialog" id="dialog1">
<property name="can_focus">False</property>
<property name="title" translatable="yes">_Configure Spell Checker plugin...</property>
<property name="resizable">False</property>
<property name="type_hint">normal</property>
<property name="type_hint">dialog</property>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">8</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child internal-child="action_area">
<object class="GtkButtonBox" id="dialog-action_area1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="button1">
<property name="label">gtk-help</property>
<object class="GtkButton" id="button3">
<property name="label" translatable="yes">button</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="expand">True</property>
@ -32,13 +28,11 @@
</packing>
</child>
<child>
<object class="GtkButton" id="button3">
<property name="label">gtk-cancel</property>
<object class="GtkButton" id="button2">
<property name="label" translatable="yes">button</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="expand">True</property>
@ -47,13 +41,11 @@
</packing>
</child>
<child>
<object class="GtkButton" id="button4">
<property name="label">gtk-ok</property>
<object class="GtkButton" id="button1">
<property name="label" translatable="yes">button</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="expand">True</property>
@ -62,45 +54,149 @@
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkVBox" id="spell_dialog_content">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Autocheck spelling on document load...</property>
<property name="xalign">0</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox" id="spell_dialog_content">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_bottom">12</property>
<property name="border_width">8</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Autocheck settings</property>
<property name="xalign">0</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">30</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
<object class="GtkGrid" id="grid1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="column_spacing">12</property>
<child>
<object class="GtkRadioButton" id="autocheck_never">
<property name="label" translatable="yes">_Never autocheck</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="height">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Never</property>
<property name="xalign">0</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Never autocheck spelling on document load</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkGrid" id="grid2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="column_spacing">12</property>
<child>
<object class="GtkRadioButton" id="autocheck_document">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="xalign">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<property name="group">autocheck_never</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="height">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Remember by document</property>
<property name="xalign">0</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label5">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Remembers the setting for each document on load</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
@ -108,39 +204,65 @@
</packing>
</child>
<child>
<object class="GtkRadioButton" id="autocheck_document">
<property name="label" translatable="yes">_Remember autocheck by document</property>
<object class="GtkGrid" id="grid3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="column_spacing">12</property>
<child>
<object class="GtkRadioButton" id="autocheck_always">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<property name="group">autocheck_never</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="height">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label6">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Always</property>
<property name="xalign">0</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label7">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Always autocheck on document load</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="autocheck_always">
<property name="label" translatable="yes">_Always autocheck</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<property name="group">autocheck_never</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
<property name="position">1</property>
</packing>
</child>
</object>
@ -152,10 +274,5 @@
</child>
</object>
</child>
<action-widgets>
<action-widget response="0">button1</action-widget>
<action-widget response="0">button3</action-widget>
<action-widget response="0">button4</action-widget>
</action-widgets>
</object>
</interface>