[gedit] tab: fix critical message with network unavailable info bar
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] tab: fix critical message with network unavailable info bar
- Date: Sat, 11 Apr 2015 08:25:34 +0000 (UTC)
commit e8c3ed23c40953017c5af7f3f5216ea3d7b4484a
Author: Sébastien Wilmet <swilmet gnome org>
Date: Sat Apr 11 10:19:17 2015 +0200
tab: fix critical message with network unavailable info bar
The critical message was:
CRITICAL **: gedit_network_unavailable_info_bar_new:
assertion 'G_IS_FILE (location)' failed
The location can be NULL for an Unsaved Document.
gedit/gedit-tab.c | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/gedit/gedit-tab.c b/gedit/gedit-tab.c
index a0395fd..f929ecc 100644
--- a/gedit/gedit-tab.c
+++ b/gedit/gedit-tab.c
@@ -1232,12 +1232,16 @@ _gedit_tab_set_network_available (GeditTab *tab,
gboolean enable)
{
GeditDocument *doc;
+ GtkSourceFile *file;
+ GFile *location;
g_return_if_fail (GEDIT_IS_TAB (tab));
doc = gedit_tab_get_document (tab);
+ file = gedit_document_get_file (doc);
+ location = gtk_source_file_get_location (file);
- if (gedit_document_is_local (doc))
+ if (gedit_document_is_local (doc) || location == NULL)
{
return;
}
@@ -1248,16 +1252,14 @@ _gedit_tab_set_network_available (GeditTab *tab,
}
else
{
- GtkSourceFile *file = gedit_document_get_file (doc);
- GFile *location = gtk_source_file_get_location (file);
- GtkWidget *bar = gedit_network_unavailable_info_bar_new (location);
+ GtkWidget *info_bar = gedit_network_unavailable_info_bar_new (location);
- g_signal_connect (bar,
+ g_signal_connect (info_bar,
"response",
G_CALLBACK (network_available_warning_info_bar_response),
tab);
- set_info_bar (tab, bar, GTK_RESPONSE_CLOSE);
+ set_info_bar (tab, info_bar, GTK_RESPONSE_CLOSE);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]