[gedit] tab: set error state on encoding conversion error
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] tab: set error state on encoding conversion error
- Date: Wed, 10 Jun 2015 18:39:50 +0000 (UTC)
commit df24f176e4ea94c47d61813e116f21ee8a2bf1ec
Author: Sébastien Wilmet <swilmet gnome org>
Date: Wed Jun 10 19:57:35 2015 +0200
tab: set error state on encoding conversion error
So the printing is insensitive.
https://bugzilla.gnome.org/show_bug.cgi?id=669976
gedit/gedit-tab.c | 26 +++++++++++++++++++++-----
1 files changed, 21 insertions(+), 5 deletions(-)
---
diff --git a/gedit/gedit-tab.c b/gedit/gedit-tab.c
index bd23177..476a2ef 100644
--- a/gedit/gedit-tab.c
+++ b/gedit/gedit-tab.c
@@ -517,12 +517,15 @@ gedit_tab_set_state (GeditTab *tab,
set_view_properties_according_to_state (tab, state);
- if ((state == GEDIT_TAB_STATE_LOADING_ERROR) || /* FIXME: add other states if needed */
- (state == GEDIT_TAB_STATE_SHOWING_PRINT_PREVIEW))
+ /* Hide or show the document.
+ * For GEDIT_TAB_STATE_LOADING_ERROR, tab->frame is either shown or
+ * hidden, depending on the error.
+ */
+ if (state == GEDIT_TAB_STATE_SHOWING_PRINT_PREVIEW)
{
gtk_widget_hide (GTK_WIDGET (tab->frame));
}
- else if (tab->print_preview == NULL)
+ else if (state != GEDIT_TAB_STATE_LOADING_ERROR)
{
gtk_widget_show (GTK_WIDGET (tab->frame));
}
@@ -1817,6 +1820,7 @@ load_cb (GtkSourceFileLoader *loader,
{
if (tab->state == GEDIT_TAB_STATE_LOADING)
{
+ gtk_widget_hide (GTK_WIDGET (tab->frame));
gedit_tab_set_state (tab, GEDIT_TAB_STATE_LOADING_ERROR);
}
else
@@ -1896,6 +1900,20 @@ load_cb (GtkSourceFileLoader *loader,
tab);
set_info_bar (tab, info_bar, GTK_RESPONSE_CANCEL);
+
+ if (tab->state == GEDIT_TAB_STATE_LOADING)
+ {
+ gtk_widget_show (GTK_WIDGET (tab->frame));
+ gedit_tab_set_state (tab, GEDIT_TAB_STATE_LOADING_ERROR);
+ }
+ else
+ {
+ gedit_tab_set_state (tab, GEDIT_TAB_STATE_REVERTING_ERROR);
+ }
+ }
+ else
+ {
+ gedit_tab_set_state (tab, GEDIT_TAB_STATE_NORMAL);
}
/* Scroll to the cursor when the document is loaded, we need to do it in
@@ -1950,8 +1968,6 @@ load_cb (GtkSourceFileLoader *loader,
g_list_free (all_documents);
}
- gedit_tab_set_state (tab, GEDIT_TAB_STATE_NORMAL);
-
if (location == NULL)
{
/* FIXME: hackish */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]