[nautilus-actions] Do not warn about malformed .desktop file when importing an URI



commit 8c9f6d58cf16f4395e4ced733f7a364016dc2f03
Author: Pierre Wieser <pwieser trychlos org>
Date:   Wed Aug 18 15:24:21 2010 +0200

    Do not warn about malformed .desktop file when importing an URI

 ChangeLog                          |    3 +++
 src/io-desktop/nadp-desktop-file.c |    8 +++++++-
 2 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index e3ceefe..1340517 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2010-08-18 Pierre Wieser <pwieser trychlos org>
 
+	* src/io-desktop/nadp-desktop-file.c (nadp_desktop_file_new_from_uri):
+	Do not warn about malformed .desktop file when importing an URI.
+
 	Path+parameters are splitted whatever be the I/O importer.
 
 	* src/io-desktop/nadp-reader.c (read_done_profile_split_exec): Removed function.
diff --git a/src/io-desktop/nadp-desktop-file.c b/src/io-desktop/nadp-desktop-file.c
index a2e761f..3054f97 100644
--- a/src/io-desktop/nadp-desktop-file.c
+++ b/src/io-desktop/nadp-desktop-file.c
@@ -255,6 +255,10 @@ nadp_desktop_file_new_from_path( const gchar *path )
  * Retuns: a newly allocated #NadpDesktopFile object, or %NULL.
  *
  * Key file has been loaded, and first validity checks made.
+ *
+ * Note: This function is in particular used when importing a file.
+ * So it is rather common that the file not be a .desktop one.
+ * Do not warns when file is malformed.
  */
 NadpDesktopFile *
 nadp_desktop_file_new_from_uri( const gchar *uri )
@@ -275,7 +279,9 @@ nadp_desktop_file_new_from_uri( const gchar *uri )
 	error = NULL;
 	g_key_file_load_from_data( ndf->private->key_file, data, length, G_KEY_FILE_KEEP_COMMENTS | G_KEY_FILE_KEEP_TRANSLATIONS, &error );
 	if( error ){
-		g_warning( "%s: %s", thisfn, error->message );
+		if( error->code != G_KEY_FILE_ERROR_GROUP_NOT_FOUND ){
+			g_warning( "%s: %s", thisfn, error->message );
+		}
 		g_error_free( error );
 		g_object_unref( ndf );
 		g_free( data );



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]