예제 #1
0
static gboolean
settings_search_is_recursive (NautilusQueryEditor *editor)
{
    NautilusQueryEditorPrivate *priv;
    NautilusFile *file;
    gboolean recursive;

    priv = nautilus_query_editor_get_instance_private (editor);

    if (!priv->location)
    {
        return TRUE;
    }

    file = nautilus_file_get (priv->location);

    if (nautilus_file_is_remote (file))
    {
        recursive = g_settings_get_enum (nautilus_preferences, "recursive-search") == NAUTILUS_SPEED_TRADEOFF_ALWAYS;
    }
    else
    {
        recursive = g_settings_get_enum (nautilus_preferences, "recursive-search") == NAUTILUS_SPEED_TRADEOFF_LOCAL_ONLY ||
                    g_settings_get_enum (nautilus_preferences, "recursive-search") == NAUTILUS_SPEED_TRADEOFF_ALWAYS;
    }

    nautilus_file_unref (file);

    return recursive;
}
예제 #2
0
static void
update_information_label (NautilusQueryEditor *editor)
{
    NautilusQueryEditorPrivate *priv;
    gboolean fts_sensitive = TRUE;

    priv = nautilus_query_editor_get_instance_private (editor);

    if (priv->location)
    {
        NautilusFile *file;
        gchar *label;
        gchar *uri;

        file = nautilus_file_get (priv->location);
        label = NULL;
        uri = g_file_get_uri (priv->location);

        if (nautilus_file_is_other_locations (file))
        {
            label = _("Searching locations only");
            fts_sensitive = FALSE;
        }
        else if (g_str_has_prefix (uri, "computer://"))
        {
            label = _("Searching devices only");
        }
        else if (g_str_has_prefix (uri, "network://"))
        {
            label = _("Searching network locations only");
            fts_sensitive = FALSE;
        }
        else if (nautilus_file_is_remote (file) &&
                 !settings_search_is_recursive (editor))
        {
            label = _("Remote location — only searching the current folder");
            fts_sensitive = FALSE;
        }
        else if (!settings_search_is_recursive (editor))
        {
            label = _("Only searching the current folder");
        }

        nautilus_search_popover_set_fts_sensitive (NAUTILUS_SEARCH_POPOVER (priv->popover),
                                                   fts_sensitive);

        gtk_widget_set_visible (priv->label, label != NULL);
        gtk_label_set_label (GTK_LABEL (priv->label), label);

        g_free (uri);
        nautilus_file_unref (file);
    }
}
예제 #3
0
gboolean
nautilus_directory_is_remote (NautilusDirectory *directory)
{
        NautilusFile *file;
        gboolean is_remote;

        g_assert (NAUTILUS_IS_DIRECTORY (directory));

        file = nautilus_directory_get_corresponding_file (directory);
        is_remote = nautilus_file_is_remote (file);
        nautilus_file_unref (file);

        return is_remote;
}