Skip to content

Commit

Permalink
Add draw spaces/tabs/newlines options
Browse files Browse the repository at this point in the history
Add
- draw spaces
- draw tabs
- draw newlines
options in preference dialog.
  • Loading branch information
kreijack committed Apr 1, 2019
1 parent b513dfe commit 73b4ebb
Show file tree
Hide file tree
Showing 2 changed files with 225 additions and 4 deletions.
66 changes: 66 additions & 0 deletions pluma/dialogs/pluma-preferences-dialog.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ struct _PlumaPreferencesDialogPrivate
/* Auto indentation */
GtkWidget *auto_indent_checkbutton;

/* Draw spaces... */
GtkWidget *draw_spaces_checkbutton;
GtkWidget *draw_tabs_checkbutton;
GtkWidget *draw_newlines_checkbutton;

/* Text Wrapping */
GtkWidget *wrap_text_checkbutton;
GtkWidget *split_checkbutton;
Expand Down Expand Up @@ -199,6 +204,39 @@ auto_indent_checkbutton_toggled (GtkToggleButton *button,
pluma_prefs_manager_set_auto_indent (gtk_toggle_button_get_active (button));
}

static void
draw_spaces_checkbutton_toggled (GtkToggleButton *button,
PlumaPreferencesDialog *dlg)
{
pluma_debug (DEBUG_PREFS);

g_return_if_fail (button == GTK_TOGGLE_BUTTON (dlg->priv->draw_spaces_checkbutton));

pluma_prefs_manager_set_draw_spaces (gtk_toggle_button_get_active (button));
}

static void
draw_tabs_checkbutton_toggled (GtkToggleButton *button,
PlumaPreferencesDialog *dlg)
{
pluma_debug (DEBUG_PREFS);

g_return_if_fail (button == GTK_TOGGLE_BUTTON (dlg->priv->draw_tabs_checkbutton));

pluma_prefs_manager_set_draw_tabs (gtk_toggle_button_get_active (button));
}

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)
Expand Down Expand Up @@ -257,6 +295,12 @@ 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 ());
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dlg->priv->draw_tabs_checkbutton),
pluma_prefs_manager_get_draw_tabs ());
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 ());

Expand All @@ -278,6 +322,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,
Expand All @@ -299,6 +349,18 @@ 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_tabs_checkbutton,
"toggled",
G_CALLBACK (draw_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),
Expand Down Expand Up @@ -1173,6 +1235,10 @@ pluma_preferences_dialog_init (PlumaPreferencesDialog *dlg)

"auto_indent_checkbutton", &dlg->priv->auto_indent_checkbutton,

"draw_spaces_checkbutton", &dlg->priv->draw_spaces_checkbutton,
"draw_tabs_checkbutton", &dlg->priv->draw_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,
Expand Down
163 changes: 159 additions & 4 deletions pluma/dialogs/pluma-preferences-dialog.ui
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.2 -->
<!-- Generated with glade 3.22.1 -->
<interface>
<requires lib="gtk+" version="3.22"/>
<object class="GtkAdjustment" id="adjustment1">
Expand Down Expand Up @@ -43,6 +43,9 @@
<property name="resizable">False</property>
<property name="destroy_with_parent">True</property>
<property name="type_hint">dialog</property>
<child>
<placeholder/>
</child>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox">
<property name="visible">True</property>
Expand Down Expand Up @@ -905,6 +908,161 @@
<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="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">0</property>
</packing>
</child>
<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">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>
</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>
Expand Down Expand Up @@ -1238,8 +1396,5 @@
<action-widget response="-11">helpbutton1</action-widget>
<action-widget response="-7">closebutton1</action-widget>
</action-widgets>
<child>
<placeholder/>
</child>
</object>
</interface>

0 comments on commit 73b4ebb

Please sign in to comment.