g_bookmark_file_to_file (priv->recent_items,
priv->filename,
&write_error);
+
if (write_error)
{
filename_warning ("Attempting to store changes into `%s', "
g_error_free (write_error);
}
+ priv->write_in_progress = FALSE;
+
/* we have sync'ed our list with the storage file, so we
* update the file mtime in order to skip the timed check
* and spare us from a re-read.
priv->filename,
g_strerror (errno));
- priv->write_in_progress = FALSE;
-
g_object_thaw_notify (G_OBJECT (manager));
return;
* about the resource pointed by @uri, or %NULL if the URI was
* not registered in the recently used resources list. Free with
* gtk_recent_info_unref().
- **/
+ *
+ * Since: 2.10
+ */
GtkRecentInfo *
gtk_recent_manager_lookup_item (GtkRecentManager *manager,
const gchar *uri,
priv = manager->priv;
if (!priv->recent_items)
return NULL;
+
+ if (priv->limit == 0)
+ return NULL;
uris = g_bookmark_file_get_uris (priv->recent_items, &uris_len);
for (i = 0; i < uris_len; i++)
local_file = g_filename_from_uri (uri, NULL, NULL);
- if (local_file != NULL)
+ if (local_file)
{
name = g_filename_display_basename (local_file);
validated = TRUE;
g_free (local_file);
}
- else
+
+ if (!name)
{
gchar *method;
gchar *local_file;
* gtk_recent_info_get_uri_display:
* @info: a #GtkRecentInfo
*
- * Gets a displayable version of the resource's URI.
+ * Gets a displayable version of the resource's URI. If the resource
+ * is local, it returns a local path; if the resource is not local,
+ * it returns the UTF-8 encoded content of gtk_recent_info_get_uri().
*
* Return value: a UTF-8 string containing the resource's URI or %NULL
*
gchar *
gtk_recent_info_get_uri_display (GtkRecentInfo *info)
{
- gchar *filename, *filename_utf8;
+ gchar *retval;
g_return_val_if_fail (info != NULL, NULL);
-
- filename = g_filename_from_uri (info->uri, NULL, NULL);
- if (!filename)
- return NULL;
+
+ retval = NULL;
+ if (gtk_recent_info_is_local (info))
+ {
+ gchar *filename;
+
+ filename = g_filename_from_uri (info->uri, NULL, NULL);
+ if (!filename)
+ return NULL;
- filename_utf8 = g_filename_to_utf8 (filename, -1, NULL, NULL, NULL);
- g_free (filename);
+ retval = g_filename_to_utf8 (filename, -1, NULL, NULL, NULL);
+ g_free (filename);
+ }
+ else
+ {
+ retval = make_valid_utf8 (info->uri);
+ }
- return filename_utf8;
+ return retval;
}
/**