[anjuta] file-manager: don't try to select document which has no file yet
- From: Carl-Anton Ingmarsson <carlantoni src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta] file-manager: don't try to select document which has no file yet
- Date: Sun, 3 Feb 2013 22:28:52 +0000 (UTC)
commit afb1c91561b48b7563b03e9590f37e26b5f448be
Author: Carl-Anton Ingmarsson <ca ingmarsson gmail com>
Date: Sun Feb 3 23:28:35 2013 +0100
file-manager: don't try to select document which has no file yet
plugins/file-manager/plugin.c | 15 +++++++++------
1 files changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/plugins/file-manager/plugin.c b/plugins/file-manager/plugin.c
index 5f4d11f..252cd97 100644
--- a/plugins/file-manager/plugin.c
+++ b/plugins/file-manager/plugin.c
@@ -203,18 +203,21 @@ current_document_added (AnjutaPlugin *plugin, const gchar *name,
{
AnjutaFileManager* file_manager = (AnjutaFileManager*) plugin;
IAnjutaDocument *current_document;
+ GFile *file;
if (!g_settings_get_boolean (file_manager->settings, PREF_SELECT_CURRENT_DOCUMENT))
return;
current_document = g_value_get_object (value);
+ if (!IANJUTA_IS_FILE (current_document))
+ return;
- if (IANJUTA_IS_FILE (current_document))
- {
- GFile *file = ianjuta_file_get_file (IANJUTA_FILE (current_document), NULL);
- ianjuta_file_manager_set_selected (IANJUTA_FILE_MANAGER (plugin), file, NULL);
- g_object_unref (file);
- }
+ file = ianjuta_file_get_file (IANJUTA_FILE (current_document), NULL);
+ if (!file)
+ return;
+
+ ianjuta_file_manager_set_selected (IANJUTA_FILE_MANAGER (plugin), file, NULL);
+ g_object_unref (file);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]