[gtk+/gtk-2-24] bgo#662814 - Don't print a g_warning() when GtkRecentManager can't find a file



commit 400e53c568be2270d9bd3e19cc76957032959085
Author: Federico Mena Quintero <federico gnome org>
Date:   Wed Nov 23 09:44:26 2011 -0600

    bgo#662814 - Don't print a g_warning() when GtkRecentManager can't find a file
    
    Also, *do* add the file to the recently-used list, even if the file does not
    exist yet.  This is used from the Save dialog, so even shitty apps which don't
    add the file to GtkRecentManager, will get the file added from the Save dialog.
    
    Signed-off-by: Federico Mena Quintero <federico gnome org>

 gtk/gtkrecentmanager.c |   15 ++-------------
 1 files changed, 2 insertions(+), 13 deletions(-)
---
diff --git a/gtk/gtkrecentmanager.c b/gtk/gtkrecentmanager.c
index 35eea65..cb25542 100644
--- a/gtk/gtkrecentmanager.c
+++ b/gtk/gtkrecentmanager.c
@@ -893,20 +893,10 @@ gtk_recent_manager_add_item_query_info (GObject      *source_object,
   GtkRecentData recent_data;
   GFileInfo *file_info;
   gchar *uri;
-  GError *error;
 
   uri = g_file_get_uri (file);
 
-  error = NULL;
-  file_info = g_file_query_info_finish (file, res, &error);
-  if (error)
-    {
-      g_warning ("Unable to retrieve the file info for `%s': %s",
-                 uri,
-                 error->message);
-      g_error_free (error);
-      goto out;
-    }
+  file_info = g_file_query_info_finish (file, res, NULL); /* NULL-GError */
 
   recent_data.display_name = NULL;
   recent_data.description = NULL;
@@ -926,7 +916,7 @@ gtk_recent_manager_add_item_query_info (GObject      *source_object,
       g_object_unref (file_info);
     }
   else
-    recent_data.mime_type = g_strdup (GTK_RECENT_DEFAULT_MIME);
+    recent_data.mime_type = g_strdup (GTK_RECENT_DEFAULT_MIME); /* FIXME: maybe we should make up the MIME type from the filename's extension */
 
   recent_data.app_name = g_strdup (g_get_application_name ());
   recent_data.app_exec = g_strjoin (" ", g_get_prgname (), "%u", NULL);
@@ -948,7 +938,6 @@ gtk_recent_manager_add_item_query_info (GObject      *source_object,
   g_free (recent_data.app_name);
   g_free (recent_data.app_exec);
 
-out:
   g_object_unref (manager);
   g_free (uri);
 }



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