summaryrefslogtreecommitdiff
path: root/pluma
diff options
context:
space:
mode:
authormbkma <[email protected]>2020-08-01 10:46:20 +0200
committerLuke from DC <[email protected]>2020-08-30 17:35:06 +0000
commitde6bc223dfdd1610064317c44e892523b05a0cb7 (patch)
treec66d75ac2697da368cf67ec597f5f530086e4d97 /pluma
parent552b9078171a5ae65a619c1e2c12da7ab4d01e42 (diff)
downloadpluma-de6bc223dfdd1610064317c44e892523b05a0cb7.tar.bz2
pluma-de6bc223dfdd1610064317c44e892523b05a0cb7.tar.xz
add optional grid background pattern
Diffstat (limited to 'pluma')
-rw-r--r--pluma/dialogs/pluma-preferences-dialog.c30
-rw-r--r--pluma/dialogs/pluma-preferences-dialog.ui80
-rw-r--r--pluma/dialogs/ui-a11y.suppr2
-rw-r--r--pluma/pluma-settings.h1
-rw-r--r--pluma/pluma-view.c6
5 files changed, 119 insertions, 0 deletions
diff --git a/pluma/dialogs/pluma-preferences-dialog.c b/pluma/dialogs/pluma-preferences-dialog.c
index 4ba26378..178c54bc 100644
--- a/pluma/dialogs/pluma-preferences-dialog.c
+++ b/pluma/dialogs/pluma-preferences-dialog.c
@@ -130,6 +130,9 @@ struct _PlumaPreferencesDialogPrivate
/* Highlight matching bracket */
GtkWidget *bracket_matching_checkbutton;
+ /* Display grid pattern */
+ GtkWidget *display_grid_checkbutton;
+
/* Display overview map */
GtkWidget *display_overview_map_checkbutton;
@@ -464,9 +467,24 @@ right_margin_checkbutton_toggled (GtkToggleButton *button,
}
static void
+grid_checkbutton_toggled (GtkToggleButton *button,
+ PlumaPreferencesDialog *dlg)
+{
+ GtkSourceBackgroundPatternType background_type;
+
+ background_type = gtk_toggle_button_get_active (button) ?
+ GTK_SOURCE_BACKGROUND_PATTERN_TYPE_GRID :
+ GTK_SOURCE_BACKGROUND_PATTERN_TYPE_NONE;
+ g_settings_set_enum (dlg->priv->editor_settings,
+ PLUMA_SETTINGS_BACKGROUND_PATTERN,
+ background_type);
+}
+
+static void
setup_view_page (PlumaPreferencesDialog *dlg)
{
GtkWrapMode wrap_mode;
+ GtkSourceBackgroundPatternType background_pattern;
gboolean display_right_margin;
pluma_debug (DEBUG_PREFS);
@@ -479,6 +497,9 @@ setup_view_page (PlumaPreferencesDialog *dlg)
wrap_mode = pluma_settings_get_wrap_mode (dlg->priv->editor_settings,
PLUMA_SETTINGS_WRAP_MODE);
+ background_pattern = g_settings_get_enum (dlg->priv->editor_settings,
+ PLUMA_SETTINGS_BACKGROUND_PATTERN);
+
switch (wrap_mode)
{
case GTK_WRAP_WORD:
@@ -506,6 +527,10 @@ setup_view_page (PlumaPreferencesDialog *dlg)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dlg->priv->right_margin_checkbutton),
display_right_margin);
+ gtk_toggle_button_set_active (
+ GTK_TOGGLE_BUTTON (dlg->priv->display_grid_checkbutton),
+ background_pattern == GTK_SOURCE_BACKGROUND_PATTERN_TYPE_GRID);
+
/* Set widgets sensitivity */
gtk_widget_set_sensitive (dlg->priv->split_checkbutton, (wrap_mode != GTK_WRAP_NONE));
@@ -549,6 +574,10 @@ setup_view_page (PlumaPreferencesDialog *dlg)
"toggled",
G_CALLBACK (right_margin_checkbutton_toggled),
dlg);
+ g_signal_connect (dlg->priv->display_grid_checkbutton,
+ "toggled",
+ G_CALLBACK (grid_checkbutton_toggled),
+ dlg);
}
static void
@@ -1231,6 +1260,7 @@ pluma_preferences_dialog_init (PlumaPreferencesDialog *dlg)
"highlight_current_line_checkbutton", &dlg->priv->highlight_current_line_checkbutton,
"bracket_matching_checkbutton", &dlg->priv->bracket_matching_checkbutton,
"display_overview_map_checkbutton", &dlg->priv->display_overview_map_checkbutton,
+ "display_grid_checkbutton", &dlg->priv->display_grid_checkbutton,
"wrap_text_checkbutton", &dlg->priv->wrap_text_checkbutton,
"split_checkbutton", &dlg->priv->split_checkbutton,
diff --git a/pluma/dialogs/pluma-preferences-dialog.ui b/pluma/dialogs/pluma-preferences-dialog.ui
index 7825e305..fd03f283 100644
--- a/pluma/dialogs/pluma-preferences-dialog.ui
+++ b/pluma/dialogs/pluma-preferences-dialog.ui
@@ -645,6 +645,86 @@
<property name="position">5</property>
</packing>
</child>
+ <child>
+ <object class="GtkBox" id="vbox4">
+ <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="label7">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">start</property>
+ <property name="label" translatable="yes">Grid pattern</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="hbox5">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkLabel" id="label8">
+ <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="GtkBox" id="vbox5">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkCheckButton" id="display_grid_checkbutton">
+ <property name="label" translatable="yes">Display _grid pattern</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">0</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">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">6</property>
+ </packing>
+ </child>
</object>
</child>
<child type="tab">
diff --git a/pluma/dialogs/ui-a11y.suppr b/pluma/dialogs/ui-a11y.suppr
index 30900bc7..1bef4a9c 100644
--- a/pluma/dialogs/ui-a11y.suppr
+++ b/pluma/dialogs/ui-a11y.suppr
@@ -28,6 +28,8 @@ pluma-preferences-dialog.ui://GtkLabel[@id='label798'] orphan-label
pluma-preferences-dialog.ui://GtkLabel[@id='label797'] orphan-label
pluma-preferences-dialog.ui://GtkLabel[@id='label5'] orphan-label
pluma-preferences-dialog.ui://GtkLabel[@id='label6'] orphan-label
+pluma-preferences-dialog.ui://GtkLabel[@id='label7'] orphan-label
+pluma-preferences-dialog.ui://GtkLabel[@id='label8'] orphan-label
pluma-preferences-dialog.ui://GtkTreeView[@id='schemes_treeview'] no-labelled-by
pluma-search-dialog.ui://GtkLabel[@id='search_label'] orphan-label
pluma-search-dialog.ui://GtkLabel[@id='replace_with_label'] orphan-label
diff --git a/pluma/pluma-settings.h b/pluma/pluma-settings.h
index 1796f978..464ddaeb 100644
--- a/pluma/pluma-settings.h
+++ b/pluma/pluma-settings.h
@@ -141,6 +141,7 @@ GSList * pluma_settings_get_writable_vfs_schemes (GSettings *sett
#define PLUMA_SETTINGS_DRAWER_NEWLINE "enable-space-drawer-newline"
#define PLUMA_SETTINGS_DRAWER_NBSP "enable-space-drawer-nbsp"
#define PLUMA_SETTINGS_DISPLAY_OVERVIEW_MAP "display-overview-map"
+#define PLUMA_SETTINGS_BACKGROUND_PATTERN "background-pattern"
/* White list of writable mate-vfs methods */
#define PLUMA_SETTINGS_WRITABLE_VFS_SCHEMES "writable-vfs-schemes"
diff --git a/pluma/pluma-view.c b/pluma/pluma-view.c
index 1c376877..9c8098b9 100644
--- a/pluma/pluma-view.c
+++ b/pluma/pluma-view.c
@@ -552,6 +552,12 @@ pluma_view_init (PlumaView *view)
"indent_on_tab", TRUE,
NULL);
+ g_settings_bind (view->priv->editor_settings,
+ PLUMA_SETTINGS_BACKGROUND_PATTERN,
+ view,
+ "background-pattern",
+ G_SETTINGS_BIND_DEFAULT);
+
pluma_set_source_space_drawer (view->priv->editor_settings, GTK_SOURCE_VIEW (view));
view->priv->typeselect_flush_timeout = 0;