Commit 6dd68325 authored by Paolo Borelli's avatar Paolo Borelli Committed by Paolo Borelli

make the enable_syntax_highlight check button work, fixes #135628. turn

2004-03-05  Paolo Borelli  <pborelli@katamail.com>

        * dialogs/gedit-preferences-dialog.c: make the enable_syntax_highlight
        check button work, fixes #135628.
        * gedit-document.c: turn syntax highlighting on only if the pref is set
        to TRUE.
parent 93977e5e
2004-03-05 Paolo Borelli <pborelli@katamail.com>
* dialogs/gedit-preferences-dialog.c: make the enable_syntax_highlight
check button work, fixes #135628.
* gedit-document.c: turn syntax highlighting on only if the pref is set
to TRUE.
2004-03-05 Paolo Maggi <paolo.maggi@polito.it>
* gedit-document.c (get_slow_mime_type): new function (it will
......
......@@ -750,6 +750,24 @@ setup_font_colors_page (GeditPreferencesDialog *dlg)
gedit_prefs_manager_selected_text_color_can_set ());
}
static void
enable_syntax_hl_button_toggled (GtkWidget *button,
GeditPreferencesDialog *dlg)
{
g_return_if_fail (button == dlg->enable_syntax_hl_checkbutton);
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)))
{
gedit_prefs_manager_set_enable_syntax_highlighting (TRUE);
gtk_widget_set_sensitive (dlg->hl_vbox, TRUE);
}
else
{
gedit_prefs_manager_set_enable_syntax_highlighting (FALSE);
gtk_widget_set_sensitive (dlg->hl_vbox, FALSE);
}
}
static void
language_changed_cb (GtkOptionMenu *optionmenu,
GeditPreferencesDialog *dlg)
......@@ -1037,16 +1055,23 @@ reset_button_clicked (GtkButton *button,
static void
setup_syntax_highlighting_page (GeditPreferencesDialog *dlg)
{
gboolean hl_enabled;
GtkWidget *menu;
const GSList *languages, *l;
GtkCellRenderer *renderer;
GtkTreeViewColumn *column;
/* Set initial state */
hl_enabled = gedit_prefs_manager_get_enable_syntax_highlighting ();
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dlg->enable_syntax_hl_checkbutton),
hl_enabled);
gtk_widget_set_sensitive (dlg->hl_vbox, hl_enabled);
/* Create GtkListStore for styles & setup treeview. */
dlg->tags_treeview_model = gtk_list_store_new (NUM_COLUMNS,
G_TYPE_STRING,
G_TYPE_STRING);
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (dlg->tags_treeview_model),
0,
GTK_SORT_ASCENDING);
......@@ -1095,6 +1120,8 @@ setup_syntax_highlighting_page (GeditPreferencesDialog *dlg)
gtk_option_menu_set_menu (GTK_OPTION_MENU (dlg->hl_mode_optionmenu), menu);
g_signal_connect (G_OBJECT (dlg->enable_syntax_hl_checkbutton), "toggled",
G_CALLBACK (enable_syntax_hl_button_toggled), dlg);
g_signal_connect (G_OBJECT (dlg->bold_togglebutton), "toggled",
G_CALLBACK (style_button_toggled), dlg);
g_signal_connect (G_OBJECT (dlg->italic_togglebutton), "toggled",
......
......@@ -1572,7 +1572,6 @@
<child>
<widget class="GtkCheckButton" id="enable_syntax_hl_checkbutton">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">_Enable syntax highlighting</property>
<property name="use_underline">True</property>
......
......@@ -323,7 +323,7 @@ gedit_document_init (GeditDocument *document)
gedit_encoding_get_charset (enc));
gedit_document_set_max_undo_levels (document,
gedit_prefs_manager_get_undo_actions_limit ());
gedit_prefs_manager_get_undo_actions_limit ());
gtk_source_buffer_set_check_brackets (GTK_SOURCE_BUFFER (document), FALSE);
}
......@@ -1406,8 +1406,6 @@ gedit_document_set_uri (GeditDocument* doc, const gchar* uri)
if (doc->priv->uri != NULL)
g_free (doc->priv->uri);
g_return_if_fail (uri != NULL);
doc->priv->uri = g_strdup (uri);
......@@ -2699,7 +2697,8 @@ gedit_document_set_language (GeditDocument *doc, GtkSourceLanguage *lang)
g_return_if_fail (GEDIT_IS_DOCUMENT (doc));
if (lang != NULL)
gtk_source_buffer_set_highlight (GTK_SOURCE_BUFFER (doc), TRUE);
gtk_source_buffer_set_highlight (GTK_SOURCE_BUFFER (doc),
gedit_prefs_manager_get_enable_syntax_highlighting ());
else
gtk_source_buffer_set_highlight (GTK_SOURCE_BUFFER (doc), FALSE);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment