[gtk+/multiroot-filechooser: 14/30] Allow NULL prefixes in _gtk_file_chooser_uri_has_prefix()
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/multiroot-filechooser: 14/30] Allow NULL prefixes in _gtk_file_chooser_uri_has_prefix()
- Date: Wed, 6 Oct 2010 18:35:53 +0000 (UTC)
commit b997b7f7f17fb33206ae075203ef8ad85b63b4b8
Author: Federico Mena Quintero <federico novell com>
Date: Tue Jun 15 16:45:47 2010 -0500
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>
gtk/gtkfilechooser.c | 7 ++++---
gtk/gtkfilechooserbutton.c | 3 +--
gtk/gtkfilechooserentry.c | 4 +---
gtk/gtkpathbar.c | 3 +--
4 files changed, 7 insertions(+), 10 deletions(-)
---
diff --git a/gtk/gtkfilechooser.c b/gtk/gtkfilechooser.c
index 5fe3b95..8318fd1 100644
--- a/gtk/gtkfilechooser.c
+++ b/gtk/gtkfilechooser.c
@@ -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
diff --git a/gtk/gtkfilechooserbutton.c b/gtk/gtkfilechooserbutton.c
index a23d58f..27a08fe 100644
--- a/gtk/gtkfilechooserbutton.c
+++ b/gtk/gtkfilechooserbutton.c
@@ -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)
diff --git a/gtk/gtkfilechooserentry.c b/gtk/gtkfilechooserentry.c
index cdbeb91..ca7e0df 100644
--- a/gtk/gtkfilechooserentry.c
+++ b/gtk/gtkfilechooserentry.c
@@ -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;
diff --git a/gtk/gtkpathbar.c b/gtk/gtkpathbar.c
index a7401d4..4a875d8 100644
--- a/gtk/gtkpathbar.c
+++ b/gtk/gtkpathbar.c
@@ -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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]