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>
This commit is contained in:
Federico Mena Quintero 2011-11-23 09:44:26 -06:00
parent 4eae58ab43
commit 400e53c568

View File

@ -893,20 +893,10 @@ gtk_recent_manager_add_item_query_info (GObject *source_object,
GtkRecentData recent_data; GtkRecentData recent_data;
GFileInfo *file_info; GFileInfo *file_info;
gchar *uri; gchar *uri;
GError *error;
uri = g_file_get_uri (file); uri = g_file_get_uri (file);
error = NULL; file_info = g_file_query_info_finish (file, res, NULL); /* NULL-GError */
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;
}
recent_data.display_name = NULL; recent_data.display_name = NULL;
recent_data.description = NULL; recent_data.description = NULL;
@ -926,7 +916,7 @@ gtk_recent_manager_add_item_query_info (GObject *source_object,
g_object_unref (file_info); g_object_unref (file_info);
} }
else 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_name = g_strdup (g_get_application_name ());
recent_data.app_exec = g_strjoin (" ", g_get_prgname (), "%u", NULL); 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_name);
g_free (recent_data.app_exec); g_free (recent_data.app_exec);
out:
g_object_unref (manager); g_object_unref (manager);
g_free (uri); g_free (uri);
} }