Allow NULL prefixes in _gtk_file_chooser_uri_has_prefix()

This allows us to just call that function with whatever root_uris we
have, instead of manually comparing the root_uris for NULL every time.

Signed-off-by: Federico Mena Quintero <federico@novell.com>
This commit is contained in:
Federico Mena Quintero
2010-06-15 16:45:47 -05:00
parent 5cbaf53d9b
commit b997b7f7f1
4 changed files with 7 additions and 10 deletions

View File

@@ -2865,7 +2865,9 @@ _gtk_file_chooser_uri_has_prefix (const char *uri, GSList *prefixes)
GSList *l;
g_return_val_if_fail (uri != NULL, FALSE);
g_return_val_if_fail (prefixes != NULL, FALSE);
if (prefixes == NULL)
return TRUE; /* No prefix means all URIs are good */
for (l = prefixes; l != NULL; l = l->next)
{
@@ -2889,8 +2891,7 @@ _gtk_file_chooser_is_uri_in_root (GtkFileChooser *chooser,
root_uris = gtk_file_chooser_get_root_uris (chooser);
return root_uris == NULL ||
_gtk_file_chooser_uri_has_prefix (uri, root_uris);
return _gtk_file_chooser_uri_has_prefix (uri, root_uris);
}
gboolean

View File

@@ -2201,8 +2201,7 @@ test_if_file_is_visible (GtkFileSystem *fs,
return FALSE;
uri = g_file_get_uri (file);
result = (root_uris == NULL ||
_gtk_file_chooser_uri_has_prefix (uri, root_uris));
result = _gtk_file_chooser_uri_has_prefix (uri, root_uris);
g_free (uri);
if (!result)

View File

@@ -459,9 +459,7 @@ is_file_in_root (GtkFileChooserEntry *chooser_entry,
GFile *file)
{
char *uri = g_file_get_uri (file);
gboolean result =
chooser_entry->root_uris == NULL ||
_gtk_file_chooser_uri_has_prefix (uri, chooser_entry->root_uris);
gboolean result = _gtk_file_chooser_uri_has_prefix (uri, chooser_entry->root_uris);
g_free (uri);
return result;

View File

@@ -1694,8 +1694,7 @@ is_file_in_root (GtkPathBar *path_bar,
GFile *file)
{
char *uri = g_file_get_uri (file);
gboolean result = path_bar->root_uris == NULL ||
_gtk_file_chooser_uri_has_prefix (uri, path_bar->root_uris);
gboolean result = _gtk_file_chooser_uri_has_prefix (uri, path_bar->root_uris);
g_free(uri);
return result;