Set the document as readonly when with fallback char error.

If there are invalid chars set the document as readonly instead
of non editable view. Also listening to the read-only property
in the window to update the sensitivity and the window title.
parent 61a8c6f5
......@@ -529,8 +529,7 @@ conversion_loading_error_message_area_response (GtkWidget *message_area,
tab->priv->tmp_encoding = encoding;
if (tab->priv->auto_save_timeout > 0)
remove_auto_save_timeout (tab);
g_return_if_fail (tab->priv->auto_save_timeout <= 0);
gedit_document_load (doc,
uri,
......@@ -541,9 +540,7 @@ conversion_loading_error_message_area_response (GtkWidget *message_area,
case GTK_RESPONSE_YES:
/* This means that we want to edit the document anyway */
set_message_area (tab, NULL);
tab->priv->not_editable = FALSE;
gtk_text_view_set_editable (GTK_TEXT_VIEW (view),
TRUE);
_gedit_document_set_readonly (doc, FALSE);
break;
case GTK_RESPONSE_CANCEL:
/* We don't want to edit the document just show it */
......@@ -1046,8 +1043,7 @@ document_loaded (GeditDocument *document,
{
GtkWidget *emsg;
//_gedit_document_set_readonly (document, TRUE);
tab->priv->not_editable = TRUE;
_gedit_document_set_readonly (document, TRUE);
emsg = gedit_conversion_error_while_loading_message_area_new (
uri,
......
......@@ -3200,6 +3200,19 @@ sync_languages_menu (GeditDocument *doc,
window);
}
static void
readonly_changed (GeditDocument *doc,
GParamSpec *pspec,
GeditWindow *window)
{
set_sensitivity_according_to_tab (window, window->priv->active_tab);
sync_name (window->priv->active_tab, NULL, window);
gedit_plugins_engine_update_plugins_ui (gedit_plugins_engine_get_default (),
window);
}
static void
editable_changed (GeditView *view,
GParamSpec *arg1,
......@@ -3285,6 +3298,10 @@ notebook_tab_added (GeditNotebook *notebook,
"notify::language",
G_CALLBACK (sync_languages_menu),
window);
g_signal_connect (doc,
"notify::read-only",
G_CALLBACK (readonly_changed),
window);
g_signal_connect (view,
"toggle_overwrite",
G_CALLBACK (update_overwrite_mode_statusbar),
......@@ -3347,6 +3364,9 @@ notebook_tab_removed (GeditNotebook *notebook,
g_signal_handlers_disconnect_by_func (doc,
G_CALLBACK (sync_languages_menu),
window);
g_signal_handlers_disconnect_by_func (doc,
G_CALLBACK (readonly_changed),
window);
g_signal_handlers_disconnect_by_func (view,
G_CALLBACK (update_overwrite_mode_statusbar),
window);
......
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