[gtk+/multiroot-filechooser-2-20: 14/21] 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-2-20: 14/21] Allow NULL prefixes in _gtk_file_chooser_uri_has_prefix()
- Date: Wed, 25 Aug 2010 17:45:58 +0000 (UTC)
commit 39986f06ab627abd56c64255a297dbbaaa76fa71
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 3e41788..66178e6 100644
--- a/gtk/gtkfilechooser.c
+++ b/gtk/gtkfilechooser.c
@@ -2890,7 +2890,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)
{
@@ -2914,8 +2916,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 adc3d7d..739446b 100644
--- a/gtk/gtkfilechooserbutton.c
+++ b/gtk/gtkfilechooserbutton.c
@@ -2217,8 +2217,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 cfc107a..877b0b5 100644
--- a/gtk/gtkfilechooserentry.c
+++ b/gtk/gtkfilechooserentry.c
@@ -454,9 +454,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 6efe569..24ef20a 100644
--- a/gtk/gtkpathbar.c
+++ b/gtk/gtkpathbar.c
@@ -1666,8 +1666,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]