diff options
-rw-r--r-- | data/org.mate.pluma.gschema.xml.in | 5 | ||||
-rw-r--r-- | pluma/dialogs/pluma-preferences-dialog.c | 9 | ||||
-rw-r--r-- | pluma/dialogs/pluma-preferences-dialog.ui | 88 | ||||
-rw-r--r-- | pluma/dialogs/ui-a11y.suppr | 2 | ||||
-rw-r--r-- | pluma/pluma-settings.h | 1 | ||||
-rw-r--r-- | pluma/pluma-tab.c | 44 |
6 files changed, 144 insertions, 5 deletions
diff --git a/data/org.mate.pluma.gschema.xml.in b/data/org.mate.pluma.gschema.xml.in index 48a6e24d..ca03f2dc 100644 --- a/data/org.mate.pluma.gschema.xml.in +++ b/data/org.mate.pluma.gschema.xml.in @@ -106,6 +106,11 @@ <summary>Right Margin Position</summary> <description>Specifies the position of the right margin.</description> </key> + <key name="display-overview-map" type="b"> + <default>false</default> + <summary>Display Overview Map</summary> + <description>Whether pluma should display the overview map for the document.</description> + </key> <key name="smart-home-end" type="s"> <default>'after'</default> <summary>Smart Home End</summary> diff --git a/pluma/dialogs/pluma-preferences-dialog.c b/pluma/dialogs/pluma-preferences-dialog.c index 246388e7..4ba26378 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 overview map */ + GtkWidget *display_overview_map_checkbutton; + /* Right margin */ GtkWidget *right_margin_checkbutton; GtkWidget *right_margin_position_spinbutton; @@ -528,6 +531,11 @@ setup_view_page (PlumaPreferencesDialog *dlg) dlg->priv->auto_save_spinbutton, "value", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET); + g_settings_bind (dlg->priv->editor_settings, + PLUMA_SETTINGS_DISPLAY_OVERVIEW_MAP, + dlg->priv->display_overview_map_checkbutton, + "active", + G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET); g_signal_connect (dlg->priv->wrap_text_checkbutton, "toggled", @@ -1222,6 +1230,7 @@ pluma_preferences_dialog_init (PlumaPreferencesDialog *dlg) "display_line_numbers_checkbutton", &dlg->priv->display_line_numbers_checkbutton, "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, "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 f571d24d..7825e305 100644 --- a/pluma/dialogs/pluma-preferences-dialog.ui +++ b/pluma/dialogs/pluma-preferences-dialog.ui @@ -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"> @@ -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> @@ -562,6 +565,86 @@ <property name="position">4</property> </packing> </child> + <child> + <object class="GtkBox" id="vbox2"> + <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="label5"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="halign">start</property> + <property name="label" translatable="yes">Overview Map</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="hbox4"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <object class="GtkLabel" id="label6"> + <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="vbox3"> + <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_overview_map_checkbutton"> + <property name="label" translatable="yes">Display _overview map</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">5</property> + </packing> + </child> </object> </child> <child type="tab"> @@ -1496,8 +1579,5 @@ <action-widget response="-11">helpbutton1</action-widget> <action-widget response="-7">closebutton1</action-widget> </action-widgets> - <child> - <placeholder/> - </child> </object> </interface> diff --git a/pluma/dialogs/ui-a11y.suppr b/pluma/dialogs/ui-a11y.suppr index f3ef7eda..30900bc7 100644 --- a/pluma/dialogs/ui-a11y.suppr +++ b/pluma/dialogs/ui-a11y.suppr @@ -26,6 +26,8 @@ pluma-preferences-dialog.ui://GtkLabel[@id='label819'] orphan-label pluma-preferences-dialog.ui://GtkLabel[@id='label800'] orphan-label 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://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 1a15f4b3..1796f978 100644 --- a/pluma/pluma-settings.h +++ b/pluma/pluma-settings.h @@ -140,6 +140,7 @@ GSList * pluma_settings_get_writable_vfs_schemes (GSettings *sett #define PLUMA_SETTINGS_DRAWER_TAB "enable-space-drawer-tab" #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" /* White list of writable mate-vfs methods */ #define PLUMA_SETTINGS_WRITABLE_VFS_SCHEMES "writable-vfs-schemes" diff --git a/pluma/pluma-tab.c b/pluma/pluma-tab.c index 9b1f6080..2b096568 100644 --- a/pluma/pluma-tab.c +++ b/pluma/pluma-tab.c @@ -52,8 +52,10 @@ struct _PlumaTabPrivate GSettings *editor_settings; PlumaTabState state; + GtkWidget *overlay; GtkWidget *view; GtkWidget *view_scrolled_window; + GtkWidget *view_map_frame; GtkWidget *message_area; GtkWidget *print_preview; @@ -406,11 +408,15 @@ pluma_tab_set_state (PlumaTab *tab, (state == PLUMA_TAB_STATE_SHOWING_PRINT_PREVIEW)) { gtk_widget_hide (tab->priv->view_scrolled_window); + gtk_widget_hide (tab->priv->overlay); } else { if (tab->priv->print_preview == NULL) + { gtk_widget_show (tab->priv->view_scrolled_window); + gtk_widget_show (tab->priv->overlay); + } } set_cursor_according_to_state (GTK_TEXT_VIEW (tab->priv->view), @@ -1489,6 +1495,8 @@ tab_mount_operation_factory (PlumaDocument *doc, static void pluma_tab_init (PlumaTab *tab) { + GtkWidget *hbox; + GtkWidget *map; GtkWidget *sw; PlumaDocument *doc; PlumaLockdownMask lockdown; @@ -1546,12 +1554,46 @@ pluma_tab_init (PlumaTab *tab) gtk_widget_show (tab->priv->view); g_object_set_data (G_OBJECT (tab->priv->view), PLUMA_TAB_KEY, tab); - gtk_box_pack_end (GTK_BOX (tab), sw, TRUE, TRUE, 0); gtk_container_add (GTK_CONTAINER (sw), tab->priv->view); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw), GTK_SHADOW_IN); gtk_widget_show (sw); + /* Create the minimap overlay */ + tab->priv->overlay = gtk_overlay_new (); + tab->priv->view_map_frame = gtk_frame_new (NULL); + map = gtk_source_map_new(); + + GtkCssProvider *provider = gtk_css_provider_new (); + gtk_css_provider_load_from_data (provider, + "textview { font-family: Monospace; font-size: 1pt; }", + -1, + NULL); + gtk_style_context_add_provider (gtk_widget_get_style_context (map), + GTK_STYLE_PROVIDER (provider), + GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); + g_object_unref (provider); + + gtk_source_map_set_view (GTK_SOURCE_MAP(map), GTK_SOURCE_VIEW(tab->priv->view)); + gtk_container_add (GTK_CONTAINER(tab->priv->view_map_frame), map); + gtk_widget_show (tab->priv->view_map_frame); + + /* Start packing */ + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); + gtk_box_pack_start (GTK_BOX (hbox), sw, TRUE, TRUE, 0); + gtk_box_pack_start (GTK_BOX (hbox), tab->priv->view_map_frame, FALSE, FALSE, 0); + gtk_container_add (GTK_CONTAINER(tab->priv->overlay), hbox); + gtk_box_pack_end (GTK_BOX (tab), tab->priv->overlay, TRUE, TRUE, 0); + + gtk_widget_show (hbox); + gtk_widget_show (tab->priv->overlay); + + g_settings_bind (tab->priv->editor_settings, + PLUMA_SETTINGS_DISPLAY_OVERVIEW_MAP, + tab->priv->view_map_frame, + "visible", + G_SETTINGS_BIND_GET | G_SETTINGS_BIND_NO_SENSITIVITY); + g_signal_connect (doc, "notify::uri", G_CALLBACK (document_uri_notify_handler), |