s/in_root/in_roots everywhere, as we support multiple roots

Signed-off-by: Federico Mena Quintero <federico@novell.com>
This commit is contained in:
Federico Mena Quintero
2010-06-16 16:34:19 -05:00
parent b997b7f7f1
commit d8e078b7a3
6 changed files with 36 additions and 42 deletions

View File

@@ -1807,7 +1807,7 @@ gtk_file_chooser_get_files (GtkFileChooser *chooser)
{
GFile *file = (GFile *)l->data;
g_return_val_if_fail (_gtk_file_chooser_is_file_in_root (chooser, file),
g_return_val_if_fail (_gtk_file_chooser_is_file_in_roots (chooser, file),
NULL);
}
@@ -2881,8 +2881,8 @@ _gtk_file_chooser_uri_has_prefix (const char *uri, GSList *prefixes)
}
gboolean
_gtk_file_chooser_is_uri_in_root (GtkFileChooser *chooser,
const char *uri)
_gtk_file_chooser_is_uri_in_roots (GtkFileChooser *chooser,
const char *uri)
{
GSList *root_uris;
@@ -2895,8 +2895,8 @@ _gtk_file_chooser_is_uri_in_root (GtkFileChooser *chooser,
}
gboolean
_gtk_file_chooser_is_file_in_root (GtkFileChooser *chooser,
GFile *file)
_gtk_file_chooser_is_file_in_roots (GtkFileChooser *chooser,
GFile *file)
{
char *uri;
gboolean result;
@@ -2905,7 +2905,7 @@ _gtk_file_chooser_is_file_in_root (GtkFileChooser *chooser,
g_return_val_if_fail (file != NULL, FALSE);
uri = g_file_get_uri (file);
result = _gtk_file_chooser_is_uri_in_root (chooser, uri);
result = _gtk_file_chooser_is_uri_in_roots (chooser, uri);
g_free (uri);
return result;
@@ -2965,8 +2965,7 @@ _gtk_file_chooser_get_visible_roots (GtkFileChooser *chooser)
if (fs_root != NULL)
{
if (_gtk_file_chooser_is_file_in_root (GTK_FILE_CHOOSER (chooser),
fs_root))
if (_gtk_file_chooser_is_file_in_roots (GTK_FILE_CHOOSER (chooser), fs_root))
{
// This is going to be listed already. Ignore it for now.
skip = TRUE;

View File

@@ -611,7 +611,7 @@ reload_shortcuts (GtkFileChooserButton *button)
{
GFile *shortcut = (GFile *)l->data;
if (_gtk_file_chooser_is_file_in_root (filechooser, shortcut))
if (_gtk_file_chooser_is_file_in_roots (filechooser, shortcut))
{
add_shortcut_to_list (button, shortcut);
}
@@ -643,8 +643,8 @@ gtk_file_chooser_button_add_shortcut_folder (GtkFileChooser *chooser,
g_object_ref (G_OBJECT (file));
priv->shortcuts = g_slist_append (priv->shortcuts, file);
if (_gtk_file_chooser_is_file_in_root (GTK_FILE_CHOOSER (priv->dialog),
file))
if (_gtk_file_chooser_is_file_in_roots (GTK_FILE_CHOOSER (priv->dialog),
file))
{
add_shortcut_to_list (button, file);
gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (priv->filter_model));
@@ -916,8 +916,7 @@ gtk_file_chooser_button_set_property (GObject *object,
case GTK_FILE_CHOOSER_PROP_ROOT_URIS:
g_object_set_property (G_OBJECT (priv->dialog), pspec->name, value);
if (!_gtk_file_chooser_is_file_in_root (filechooser,
gtk_file_chooser_get_current_folder_file (filechooser)))
if (!_gtk_file_chooser_is_file_in_roots (filechooser, gtk_file_chooser_get_current_folder_file (filechooser)))
{
GSList *root_uris = gtk_file_chooser_get_root_uris (filechooser);
@@ -1905,7 +1904,7 @@ model_add_volumes (GtkFileChooserButton *button,
skip = TRUE;
else if (root_uris != NULL &&
(base_file == NULL ||
!_gtk_file_chooser_is_file_in_root (filechooser, base_file)))
!_gtk_file_chooser_is_file_in_roots (filechooser, base_file)))
skip = TRUE;
if (base_file != NULL)
@@ -1968,7 +1967,7 @@ model_add_bookmarks (GtkFileChooserButton *button,
file = l->data;
if (!_gtk_file_chooser_is_file_in_root (filechooser, file))
if (!_gtk_file_chooser_is_file_in_roots (filechooser, file))
continue;
if (g_file_is_native (file))

View File

@@ -1868,7 +1868,7 @@ shortcuts_append_home (GtkFileChooserDefault *impl)
home = g_file_new_for_path (home_path);
if (_gtk_file_chooser_is_file_in_root (GTK_FILE_CHOOSER (impl), home))
if (_gtk_file_chooser_is_file_in_roots (GTK_FILE_CHOOSER (impl), home))
{
shortcuts_insert_file (impl, start_row, SHORTCUT_TYPE_FILE, NULL, home,
NULL, FALSE, SHORTCUTS_HOME);
@@ -1917,7 +1917,7 @@ shortcuts_append_desktop (GtkFileChooserDefault *impl)
file = g_file_new_for_path (name);
if (_gtk_file_chooser_is_file_in_root (GTK_FILE_CHOOSER (impl), file))
if (_gtk_file_chooser_is_file_in_roots (GTK_FILE_CHOOSER (impl), file))
{
shortcuts_insert_file (impl, start_row, SHORTCUT_TYPE_FILE, NULL,
file, _("Desktop"), FALSE, SHORTCUTS_DESKTOP);
@@ -2006,7 +2006,7 @@ shortcuts_append_bookmarks (GtkFileChooserDefault *impl,
if (local_only && !g_file_is_native (file))
continue;
if (!_gtk_file_chooser_is_file_in_root (GTK_FILE_CHOOSER (impl), file))
if (!_gtk_file_chooser_is_file_in_roots (GTK_FILE_CHOOSER (impl), file))
continue;
if (shortcut_find_position (impl, file) != -1)
@@ -2142,8 +2142,8 @@ shortcuts_add_volumes (GtkFileChooserDefault *impl)
skip = TRUE;
else if (impl->root_uris != NULL &&
(base_file == NULL ||
!_gtk_file_chooser_is_file_in_root (GTK_FILE_CHOOSER (impl),
base_file)))
!_gtk_file_chooser_is_file_in_roots (GTK_FILE_CHOOSER (impl),
base_file)))
skip = TRUE;
if (base_file != NULL)
@@ -2325,7 +2325,7 @@ shortcuts_add_custom_folders (GtkFileChooserDefault *impl)
GFile *file = (GFile *)l->data;
if (impl->root_uris != NULL &&
_gtk_file_chooser_is_file_in_root (GTK_FILE_CHOOSER (impl), file))
_gtk_file_chooser_is_file_in_roots (GTK_FILE_CHOOSER (impl), file))
{
int pos = shortcuts_get_pos_for_shortcut_folder (impl,
impl->num_shortcuts);
@@ -5389,8 +5389,7 @@ set_root_uris (GtkFileChooserDefault *impl,
}
}
else if (impl->root_uris != NULL &&
!_gtk_file_chooser_is_file_in_root (GTK_FILE_CHOOSER (impl),
impl->current_folder))
!_gtk_file_chooser_is_file_in_roots (GTK_FILE_CHOOSER (impl), impl->current_folder))
{
/*
* If we are pointing to a folder outside of the root URI,
@@ -7263,8 +7262,7 @@ update_current_folder_get_info_cb (GCancellable *cancellable,
/* get parent path and try to change the folder to that */
if (parent_file &&
_gtk_file_chooser_is_file_in_root (GTK_FILE_CHOOSER (impl),
parent_file))
_gtk_file_chooser_is_file_in_roots (GTK_FILE_CHOOSER (impl), parent_file))
{
g_object_unref (data->file);
data->file = parent_file;
@@ -7414,7 +7412,7 @@ gtk_file_chooser_default_update_current_folder (GtkFileChooser *chooser,
return FALSE;
}
if (!_gtk_file_chooser_is_file_in_root (GTK_FILE_CHOOSER (impl), file))
if (!_gtk_file_chooser_is_file_in_roots (GTK_FILE_CHOOSER (impl), file))
{
g_set_error_literal (error,
GTK_FILE_CHOOSER_ERROR,
@@ -7988,8 +7986,7 @@ add_shortcut_get_info_cb (GCancellable *cancellable,
g_object_ref (data->file);
data->impl->shortcuts = g_slist_append (data->impl->shortcuts, data->file);
if (_gtk_file_chooser_is_file_in_root (GTK_FILE_CHOOSER (data->impl),
data->file))
if (_gtk_file_chooser_is_file_in_roots (GTK_FILE_CHOOSER (data->impl), data->file))
{
shortcuts_insert_file (data->impl, pos, SHORTCUT_TYPE_FILE, NULL,
data->file, NULL, FALSE, SHORTCUTS_SHORTCUTS);
@@ -9033,7 +9030,7 @@ search_add_hit (GtkFileChooserDefault *impl,
return;
if (!g_file_is_native (file) ||
!_gtk_file_chooser_is_file_in_root (GTK_FILE_CHOOSER (impl), file))
!_gtk_file_chooser_is_file_in_roots (GTK_FILE_CHOOSER (impl), file))
{
g_object_unref (file);
return;
@@ -9580,7 +9577,7 @@ recent_idle_load (gpointer data)
GtkRecentInfo *info = walk->data;
const char *uri = gtk_recent_info_get_uri (info);
if (_gtk_file_chooser_is_uri_in_root (GTK_FILE_CHOOSER (impl), uri))
if (_gtk_file_chooser_is_uri_in_roots (GTK_FILE_CHOOSER (impl), uri))
{
// We'll sort this later, so prepend for efficiency.
load_data->items = g_list_prepend(load_data->items, info);

View File

@@ -455,8 +455,8 @@ beep (GtkFileChooserEntry *chooser_entry)
}
static gboolean
is_file_in_root (GtkFileChooserEntry *chooser_entry,
GFile *file)
is_file_in_roots (GtkFileChooserEntry *chooser_entry,
GFile *file)
{
char *uri = g_file_get_uri (file);
gboolean result = _gtk_file_chooser_uri_has_prefix (uri, chooser_entry->root_uris);
@@ -1344,7 +1344,7 @@ populate_completion_store (GtkFileChooserEntry *chooser_entry)
file = tmp_list->data;
if (!is_file_in_root (chooser_entry, file))
if (!is_file_in_roots (chooser_entry, file))
continue;
info = _gtk_folder_get_info (chooser_entry->current_folder, file);
@@ -1490,8 +1490,7 @@ start_loading_current_folder (GtkFileChooserEntry *chooser_entry)
if ((chooser_entry->local_only
&& !g_file_is_native (chooser_entry->current_folder_file)) ||
(chooser_entry->root_uris != NULL
&& !is_file_in_root (chooser_entry,
chooser_entry->current_folder_file)))
&& !is_file_in_roots (chooser_entry, chooser_entry->current_folder_file)))
{
g_object_unref (chooser_entry->current_folder_file);
chooser_entry->current_folder_file = NULL;

View File

@@ -106,10 +106,10 @@ GSList * _gtk_file_chooser_list_shortcut_folder_files (GtkFileChooser *cho
GSList * _gtk_file_chooser_list_shortcut_folder_files (GtkFileChooser *chooser);
gboolean _gtk_file_chooser_is_uri_in_root (GtkFileChooser *chooser,
const char *uri);
gboolean _gtk_file_chooser_is_file_in_root (GtkFileChooser *chooser,
GFile *file);
gboolean _gtk_file_chooser_is_uri_in_roots (GtkFileChooser *chooser,
const char *uri);
gboolean _gtk_file_chooser_is_file_in_roots (GtkFileChooser *chooser,
GFile *file);
GSList * _gtk_file_chooser_get_visible_roots (GtkFileChooser *chooser);
gboolean _gtk_file_chooser_uri_has_prefix (const char *uri,

View File

@@ -1690,8 +1690,8 @@ struct SetFileInfo
};
static gboolean
is_file_in_root (GtkPathBar *path_bar,
GFile *file)
is_file_in_roots (GtkPathBar *path_bar,
GFile *file)
{
char *uri = g_file_get_uri (file);
gboolean result = _gtk_file_chooser_uri_has_prefix (uri, path_bar->root_uris);
@@ -1771,7 +1771,7 @@ gtk_path_bar_get_info_callback (GCancellable *cancellable,
display_name = g_file_info_get_display_name (info);
is_hidden = g_file_info_get_is_hidden (info) || g_file_info_get_is_backup (info);
if (!is_file_in_root (file_info->path_bar, file_info->file))
if (!is_file_in_roots (file_info->path_bar, file_info->file))
{
gtk_path_bar_set_file_finish (file_info, TRUE);
return;