summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pluma/dialogs/pluma-preferences-dialog.c157
-rw-r--r--pluma/dialogs/pluma-preferences-dialog.ui258
2 files changed, 415 insertions, 0 deletions
diff --git a/pluma/dialogs/pluma-preferences-dialog.c b/pluma/dialogs/pluma-preferences-dialog.c
index 00339e75..f0204a02 100644
--- a/pluma/dialogs/pluma-preferences-dialog.c
+++ b/pluma/dialogs/pluma-preferences-dialog.c
@@ -71,6 +71,12 @@ enum
NUM_COLUMNS
};
+typedef enum
+{
+ DRAW_NONE = 0,
+ DRAW_TRAILING = 1,
+ DRAW_ALL = 2
+} DrawSpacesSettings;
#define PLUMA_PREFERENCES_DIALOG_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), \
PLUMA_TYPE_PREFERENCES_DIALOG, \
@@ -101,6 +107,13 @@ struct _PlumaPreferencesDialogPrivate
/* Auto indentation */
GtkWidget *auto_indent_checkbutton;
+ /* Draw spaces... */
+ GtkWidget *draw_spaces_checkbutton;
+ GtkWidget *draw_trailing_spaces_checkbutton;
+ GtkWidget *draw_tabs_checkbutton;
+ GtkWidget *draw_trailing_tabs_checkbutton;
+ GtkWidget *draw_newlines_checkbutton;
+
/* Text Wrapping */
GtkWidget *wrap_text_checkbutton;
GtkWidget *split_checkbutton;
@@ -200,6 +213,88 @@ auto_indent_checkbutton_toggled (GtkToggleButton *button,
}
static void
+draw_spaces_checkbutton_toggled (GtkToggleButton *button,
+ PlumaPreferencesDialog *dlg)
+{
+ int v;
+ pluma_debug (DEBUG_PREFS);
+
+ g_return_if_fail (button == GTK_TOGGLE_BUTTON (dlg->priv->draw_spaces_checkbutton));
+
+ if (gtk_toggle_button_get_active (button))
+ v = DRAW_ALL;
+ else
+ v = DRAW_NONE;
+
+ pluma_prefs_manager_set_draw_spaces (v);
+#ifdef GTK_SOURCE_VERSION_3_24
+ gtk_widget_set_sensitive (GTK_WIDGET (dlg->priv->draw_trailing_spaces_checkbutton), v > DRAW_NONE);
+ gtk_toggle_button_set_inconsistent (GTK_TOGGLE_BUTTON (dlg->priv->draw_trailing_spaces_checkbutton), v == DRAW_NONE);
+#endif
+
+}
+
+static void
+draw_trailing_spaces_checkbutton_toggled (GtkToggleButton *button,
+ PlumaPreferencesDialog *dlg)
+{
+ pluma_debug (DEBUG_PREFS);
+
+ g_return_if_fail (button == GTK_TOGGLE_BUTTON (dlg->priv->draw_trailing_spaces_checkbutton));
+
+ if (gtk_toggle_button_get_active (button))
+ pluma_prefs_manager_set_draw_spaces (DRAW_TRAILING);
+ else
+ pluma_prefs_manager_set_draw_spaces (DRAW_ALL);
+}
+
+static void
+draw_tabs_checkbutton_toggled (GtkToggleButton *button,
+ PlumaPreferencesDialog *dlg)
+{
+ int v;
+ pluma_debug (DEBUG_PREFS);
+
+ g_return_if_fail (button == GTK_TOGGLE_BUTTON(dlg->priv->draw_tabs_checkbutton));
+
+ if (gtk_toggle_button_get_active (button))
+ v = DRAW_ALL;
+ else
+ v = DRAW_NONE;
+
+ pluma_prefs_manager_set_draw_tabs (v);
+#ifdef GTK_SOURCE_VERSION_3_24
+ gtk_widget_set_sensitive (GTK_WIDGET(dlg->priv->draw_trailing_tabs_checkbutton), v > DRAW_NONE);
+ gtk_toggle_button_set_inconsistent (GTK_TOGGLE_BUTTON(dlg->priv->draw_trailing_tabs_checkbutton), v == DRAW_NONE);
+#endif
+}
+
+static void
+draw_trailing_tabs_checkbutton_toggled (GtkToggleButton *button,
+ PlumaPreferencesDialog *dlg)
+{
+ pluma_debug (DEBUG_PREFS);
+
+ g_return_if_fail (button == GTK_TOGGLE_BUTTON (dlg->priv->draw_trailing_tabs_checkbutton));
+
+ if (gtk_toggle_button_get_active (button))
+ pluma_prefs_manager_set_draw_tabs (DRAW_TRAILING);
+ else
+ pluma_prefs_manager_set_draw_tabs (DRAW_ALL);
+}
+
+static void
+draw_newlines_checkbutton_toggled (GtkToggleButton *button,
+ PlumaPreferencesDialog *dlg)
+{
+ pluma_debug (DEBUG_PREFS);
+
+ g_return_if_fail (button == GTK_TOGGLE_BUTTON (dlg->priv->draw_newlines_checkbutton));
+
+ pluma_prefs_manager_set_draw_newlines (gtk_toggle_button_get_active (button));
+}
+
+static void
auto_save_checkbutton_toggled (GtkToggleButton *button,
PlumaPreferencesDialog *dlg)
{
@@ -257,6 +352,36 @@ setup_editor_page (PlumaPreferencesDialog *dlg)
pluma_prefs_manager_get_insert_spaces ());
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dlg->priv->auto_indent_checkbutton),
pluma_prefs_manager_get_auto_indent ());
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dlg->priv->draw_spaces_checkbutton),
+ pluma_prefs_manager_get_draw_spaces () > 0);
+#ifdef GTK_SOURCE_VERSION_3_24
+ gtk_widget_set_sensitive (GTK_WIDGET (dlg->priv->draw_trailing_spaces_checkbutton),
+ pluma_prefs_manager_get_draw_spaces () > 0);
+ gtk_toggle_button_set_inconsistent (GTK_TOGGLE_BUTTON (dlg->priv->draw_trailing_spaces_checkbutton),
+ pluma_prefs_manager_get_draw_spaces () == 0);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dlg->priv->draw_trailing_spaces_checkbutton),
+ pluma_prefs_manager_get_draw_spaces () == 1);
+#else
+ gtk_widget_set_sensitive (GTK_WIDGET (dlg->priv->draw_trailing_spaces_checkbutton), FALSE);
+ gtk_toggle_button_set_inconsistent (GTK_TOGGLE_BUTTON (dlg->priv->draw_trailing_spaces_checkbutton), TRUE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dlg->priv->draw_trailing_spaces_checkbutton), FALSE);
+#endif
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dlg->priv->draw_tabs_checkbutton),
+ pluma_prefs_manager_get_draw_tabs () > 0);
+#ifdef GTK_SOURCE_VERSION_3_24
+ gtk_widget_set_sensitive (GTK_WIDGET (dlg->priv->draw_trailing_tabs_checkbutton),
+ pluma_prefs_manager_get_draw_tabs () > 0);
+ gtk_toggle_button_set_inconsistent (GTK_TOGGLE_BUTTON (dlg->priv->draw_trailing_tabs_checkbutton),
+ pluma_prefs_manager_get_draw_tabs () == 0);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dlg->priv->draw_trailing_tabs_checkbutton),
+ pluma_prefs_manager_get_draw_tabs () == 1);
+#else
+ gtk_widget_set_sensitive (GTK_WIDGET (dlg->priv->draw_trailing_tabs_checkbutton), FALSE);
+ gtk_toggle_button_set_inconsistent (GTK_TOGGLE_BUTTON (dlg->priv->draw_trailing_tabs_checkbutton), FALSE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dlg->priv->draw_trailing_tabs_checkbutton), FALSE);
+#endif
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dlg->priv->draw_newlines_checkbutton),
+ pluma_prefs_manager_get_draw_newlines ());
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dlg->priv->backup_copy_checkbutton),
pluma_prefs_manager_get_create_backup_copy ());
@@ -278,6 +403,12 @@ setup_editor_page (PlumaPreferencesDialog *dlg)
pluma_prefs_manager_insert_spaces_can_set ());
gtk_widget_set_sensitive (dlg->priv->auto_indent_checkbutton,
pluma_prefs_manager_auto_indent_can_set ());
+ gtk_widget_set_sensitive (dlg->priv->draw_spaces_checkbutton,
+ pluma_prefs_manager_draw_spaces_can_set ());
+ gtk_widget_set_sensitive (dlg->priv->draw_tabs_checkbutton,
+ pluma_prefs_manager_draw_tabs_can_set ());
+ gtk_widget_set_sensitive (dlg->priv->draw_newlines_checkbutton,
+ pluma_prefs_manager_draw_newlines_can_set ());
gtk_widget_set_sensitive (dlg->priv->backup_copy_checkbutton,
pluma_prefs_manager_create_backup_copy_can_set ());
gtk_widget_set_sensitive (dlg->priv->autosave_hbox,
@@ -299,6 +430,26 @@ setup_editor_page (PlumaPreferencesDialog *dlg)
"toggled",
G_CALLBACK (auto_indent_checkbutton_toggled),
dlg);
+ g_signal_connect (dlg->priv->draw_spaces_checkbutton,
+ "toggled",
+ G_CALLBACK (draw_spaces_checkbutton_toggled),
+ dlg);
+ g_signal_connect (dlg->priv->draw_trailing_spaces_checkbutton,
+ "toggled",
+ G_CALLBACK (draw_trailing_spaces_checkbutton_toggled),
+ dlg);
+ g_signal_connect (dlg->priv->draw_tabs_checkbutton,
+ "toggled",
+ G_CALLBACK (draw_tabs_checkbutton_toggled),
+ dlg);
+ g_signal_connect (dlg->priv->draw_trailing_tabs_checkbutton,
+ "toggled",
+ G_CALLBACK (draw_trailing_tabs_checkbutton_toggled),
+ dlg);
+ g_signal_connect (dlg->priv->draw_newlines_checkbutton,
+ "toggled",
+ G_CALLBACK (draw_newlines_checkbutton_toggled),
+ dlg);
g_signal_connect (dlg->priv->auto_save_checkbutton,
"toggled",
G_CALLBACK (auto_save_checkbutton_toggled),
@@ -1173,6 +1324,12 @@ pluma_preferences_dialog_init (PlumaPreferencesDialog *dlg)
"auto_indent_checkbutton", &dlg->priv->auto_indent_checkbutton,
+ "draw_spaces_checkbutton", &dlg->priv->draw_spaces_checkbutton,
+ "draw_trailing_spaces_checkbutton", &dlg->priv->draw_trailing_spaces_checkbutton,
+ "draw_tabs_checkbutton", &dlg->priv->draw_tabs_checkbutton,
+ "draw_trailing_tabs_checkbutton", &dlg->priv->draw_trailing_tabs_checkbutton,
+ "draw_newlines_checkbutton", &dlg->priv->draw_newlines_checkbutton,
+
"autosave_hbox", &dlg->priv->autosave_hbox,
"backup_copy_checkbutton", &dlg->priv->backup_copy_checkbutton,
"auto_save_checkbutton", &dlg->priv->auto_save_checkbutton,
diff --git a/pluma/dialogs/pluma-preferences-dialog.ui b/pluma/dialogs/pluma-preferences-dialog.ui
index dc482b8e..41ef4e22 100644
--- a/pluma/dialogs/pluma-preferences-dialog.ui
+++ b/pluma/dialogs/pluma-preferences-dialog.ui
@@ -905,6 +905,264 @@
<property name="position">2</property>
</packing>
</child>
+ <child>
+ <object class="GtkBox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">start</property>
+ <property name="label" translatable="yes">Draw spaces, tabs, newlines</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">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkBox" id="hbox2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkLabel" id="label3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes"> </property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="draw_tabs_checkbutton">
+ <property name="label" translatable="yes">Draw _tabs</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="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox" id="hbox1_4">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkLabel" id="label2_2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes"> </property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label2_4">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes"> </property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="draw_trailing_tabs_checkbutton">
+ <property name="label" translatable="yes">Draw _trailing tabs only</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="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox" id="hbox3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkLabel" id="label4">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes"> </property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="draw_newlines_checkbutton">
+ <property name="label" translatable="yes">Draw _newlines</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="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <object class="GtkBox" id="hbox1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkLabel" id="label2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes"> </property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="draw_spaces_checkbutton">
+ <property name="label" translatable="yes">Draw _spaces</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="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox" id="hbox1_1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkLabel" id="label2_3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes"> </property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label2_1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes"> </property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="draw_trailing_spaces_checkbutton">
+ <property name="label" translatable="yes">Draw _trailing spaces only</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="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">5</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="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="position">1</property>