[nautilus-actions] Do not try to get info for non existing file
- From: Pierre Wieser <pwieser src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus-actions] Do not try to get info for non existing file
- Date: Thu, 24 Jun 2010 21:04:01 +0000 (UTC)
commit 9830fed78ed5b21207dcbf39172839d52c1eafee
Author: Pierre Wieser <pwieser trychlos org>
Date: Thu Jun 24 17:14:54 2010 +0200
Do not try to get info for non existing file
ChangeLog | 5 +++++
src/core/na-icontext.c | 17 ++++++++++++++---
2 files changed, 19 insertions(+), 3 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index d82f3fc..425094c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-06-23 Pierre Wieser <pwieser trychlos org>
+
+ * src/core/na-icontext.c (is_candidate_for_try_exec):
+ Do not try to get info for non existing file.
+
2010-06-21 Pierre Wieser <pwieser trychlos org>
* src/core/na-icontext.c (is_candidate_for_show_in):
diff --git a/src/core/na-icontext.c b/src/core/na-icontext.c
index 2281560..a3c6aa8 100644
--- a/src/core/na-icontext.c
+++ b/src/core/na-icontext.c
@@ -477,14 +477,25 @@ is_candidate_for_try_exec( const NAIContext *object, guint target, GList *files
{
static const gchar *thisfn = "na_icontext_is_candidate_for_try_exec";
gboolean ok = TRUE;
+ GError *error = NULL;
gchar *tryexec = na_object_get_try_exec( object );
if( tryexec && strlen( tryexec )){
ok = FALSE;
GFile *file = g_file_new_for_path( tryexec );
- GFileInfo *info = g_file_query_info( file, G_FILE_ATTRIBUTE_ACCESS_CAN_EXECUTE, G_FILE_QUERY_INFO_NONE, NULL, NULL );
- ok = g_file_info_get_attribute_boolean( info, G_FILE_ATTRIBUTE_ACCESS_CAN_EXECUTE );
- g_object_unref( info );
+ GFileInfo *info = g_file_query_info( file, G_FILE_ATTRIBUTE_ACCESS_CAN_EXECUTE, G_FILE_QUERY_INFO_NONE, NULL, &error );
+ if( error ){
+ g_debug( "%s: %s", thisfn, error->message );
+ g_error_free( error );
+
+ } else {
+ ok = g_file_info_get_attribute_boolean( info, G_FILE_ATTRIBUTE_ACCESS_CAN_EXECUTE );
+ }
+
+ if( info ){
+ g_object_unref( info );
+ }
+
g_object_unref( file );
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]