Commit d2723a29 authored by Ian McKellar's avatar Ian McKellar
Browse files

Allow users to specify that if they want detailed remote views, and if

they don't, then don't download the top left text of text files.
parent bb315ce0
2000-05-22 Ian McKellar <yakk@yakk.net>
* libnautilus-extensions/nautilus-directory-private.h:
* libnautilus-extensions/nautilus-directory.c:
(nautilus_directory_new), (nautilus_directory_is_local):
* libnautilus-extensions/nautilus-directory.h:
* libnautilus-extensions/nautilus-file.c: (nautilus_file_is_local):
* libnautilus-extensions/nautilus-file.h:
Added nautilus_directory_is_local and nautilus_file_is_local.
* libnautilus-extensions/nautilus-global-preferences.c:
(global_preferences_create_dialog),
(global_preferences_register_for_ui):
* libnautilus-extensions/nautilus-global-preferences.h:
Added a preference to specify whether to display detailed remote
views.
* libnautilus-extensions/nautilus-directory-async.c:
(state_changed):
* libnautilus-extensions/nautilus-icon-factory.c:
(nautilus_icon_factory_get_icon_for_file):
Only download top left text if the file is local or if
the user has specified that they want detailed remote views.
2000-05-21 Andy Hertzfeld <andy@eazel.com>
* libnautilus-extensions/nautilus-icon-factory.c:
......
......@@ -28,6 +28,7 @@
#include "nautilus-directory-metafile.h"
#include "nautilus-file-private.h"
#include "nautilus-file-attributes.h"
#include "nautilus-global-preferences.h"
#include <gtk/gtkmain.h>
......@@ -1625,5 +1626,8 @@ state_changed (NautilusDirectory *directory)
start_getting_directory_counts (directory);
/* Start or stop getting top left pieces of files. */
start_getting_top_lefts (directory);
if(nautilus_directory_is_local(directory) ||
nautilus_preferences_get_boolean(NAUTILUS_PREFERENCES_REMOTE_VIEWS, FALSE)) {
start_getting_top_lefts (directory);
}
}
......@@ -80,6 +80,8 @@ struct NautilusDirectoryDetails
TopLeftTextReadState *top_left_read_state;
GList *file_operations_in_progress; /* list of FileOperation * */
gboolean is_local;
};
typedef struct {
......
......@@ -398,10 +398,19 @@ nautilus_directory_new (const char* uri)
directory->details->uri = vfs_uri;
directory->details->metafile_uri = metafile_uri;
directory->details->alternate_metafile_uri = alternate_metafile_uri;
directory->details->is_local = gnome_vfs_uri_is_local(vfs_uri);
return directory;
}
gboolean
nautilus_directory_is_local (NautilusDirectory *directory)
{
g_return_val_if_fail (NAUTILUS_IS_DIRECTORY (directory), FALSE);
return directory->details->is_local;
}
gboolean
nautilus_directory_are_all_files_seen (NautilusDirectory *directory)
{
......
......@@ -155,6 +155,11 @@ gboolean nautilus_directory_are_all_files_seen (NautilusDirectory
*/
gboolean nautilus_directory_metadata_loaded (NautilusDirectory *directory);
/* Return true if the directory is local.
*/
gboolean nautilus_directory_is_local (NautilusDirectory *directory);
typedef struct NautilusDirectoryDetails NautilusDirectoryDetails;
struct NautilusDirectory
......
......@@ -674,6 +674,15 @@ nautilus_file_matches_uri (NautilusFile *file, const char *uri_string)
return result;
}
gboolean
nautilus_file_is_local(NautilusFile *file)
{
g_return_val_if_fail (NAUTILUS_IS_FILE (file), FALSE);
return(nautilus_directory_is_local(file->details->directory));
}
gboolean
nautilus_file_update (NautilusFile *file, GnomeVFSFileInfo *info)
{
......
......@@ -176,6 +176,9 @@ char * nautilus_file_get_string_attribute (NautilusFile
gboolean nautilus_file_matches_uri (NautilusFile *file,
const char *uri);
/* Is the file local? */
gboolean nautilus_file_is_local (NautilusFile *file);
/* Compare file's state with a fresh file info struct, return FALSE if no change,
update file and return TRUE if the file info contains new state.
*/
......
......@@ -110,6 +110,13 @@ global_preferences_create_dialog (void)
NAUTILUS_PREFERENCES_CLICK_POLICY,
NAUTILUS_PREFERENCE_ITEM_ENUM);
nautilus_preferences_pane_add_group (NAUTILUS_PREFERENCES_PANE (directory_views_pane), "Remote Views");
nautilus_preferences_pane_add_item_to_nth_group (NAUTILUS_PREFERENCES_PANE (directory_views_pane),
2,
NAUTILUS_PREFERENCES_REMOTE_VIEWS,
NAUTILUS_PREFERENCE_ITEM_BOOLEAN);
/*
* Meta view pane
......@@ -312,6 +319,11 @@ global_preferences_register_for_ui ()
"Activate items with a double click",
NAUTILUS_CLICK_POLICY_DOUBLE);
nautilus_preferences_set_info (NAUTILUS_PREFERENCES_REMOTE_VIEWS,
"Fully Decorate Remote Views",
NAUTILUS_PREFERENCE_BOOLEAN,
(gconstpointer) FALSE);
/* User level */
nautilus_preferences_set_info (NAUTILUS_PREFERENCES_USER_LEVEL,
"User Level",
......
......@@ -60,6 +60,8 @@ enum
NAUTILUS_CLICK_POLICY_DOUBLE
};
#define NAUTILUS_PREFERENCES_REMOTE_VIEWS "/nautilus/preferences/remote_views"
void nautilus_global_preferences_startup (void);
void nautilus_global_preferences_shutdown (void);
void nautilus_global_preferences_show_dialog (void);
......
......@@ -800,7 +800,7 @@ nautilus_scalable_icon_equal (gconstpointer a,
NautilusScalableIcon *
nautilus_icon_factory_get_icon_for_file (NautilusFile *file, const char* modifier)
{
char *uri, *file_uri, *image_uri, *icon_name;
char *uri, *file_uri, *image_uri, *icon_name, *top_left_text = NULL;
NautilusScalableIcon *scalable_icon;
if (file == NULL) {
......@@ -847,12 +847,19 @@ nautilus_icon_factory_get_icon_for_file (NautilusFile *file, const char* modifie
if (icon_name == NULL) {
icon_name = g_strdup (nautilus_icon_factory_get_icon_name_for_file (file));
}
if (nautilus_file_is_local (file) ||
nautilus_preferences_get_boolean(NAUTILUS_PREFERENCES_REMOTE_VIEWS, FALSE)) {
top_left_text = nautilus_file_get_top_left_text (file);
}
/* Create the icon or find it in the cache if it's already there. */
scalable_icon = nautilus_scalable_icon_get (uri, icon_name, modifier,
nautilus_file_get_top_left_text (file));
top_left_text);
g_free (uri);
g_free (icon_name);
g_free (top_left_text);
return scalable_icon;
}
......
......@@ -28,6 +28,7 @@
#include "nautilus-directory-metafile.h"
#include "nautilus-file-private.h"
#include "nautilus-file-attributes.h"
#include "nautilus-global-preferences.h"
#include <gtk/gtkmain.h>
......@@ -1625,5 +1626,8 @@ state_changed (NautilusDirectory *directory)
start_getting_directory_counts (directory);
/* Start or stop getting top left pieces of files. */
start_getting_top_lefts (directory);
if(nautilus_directory_is_local(directory) ||
nautilus_preferences_get_boolean(NAUTILUS_PREFERENCES_REMOTE_VIEWS, FALSE)) {
start_getting_top_lefts (directory);
}
}
......@@ -80,6 +80,8 @@ struct NautilusDirectoryDetails
TopLeftTextReadState *top_left_read_state;
GList *file_operations_in_progress; /* list of FileOperation * */
gboolean is_local;
};
typedef struct {
......
......@@ -398,10 +398,19 @@ nautilus_directory_new (const char* uri)
directory->details->uri = vfs_uri;
directory->details->metafile_uri = metafile_uri;
directory->details->alternate_metafile_uri = alternate_metafile_uri;
directory->details->is_local = gnome_vfs_uri_is_local(vfs_uri);
return directory;
}
gboolean
nautilus_directory_is_local (NautilusDirectory *directory)
{
g_return_val_if_fail (NAUTILUS_IS_DIRECTORY (directory), FALSE);
return directory->details->is_local;
}
gboolean
nautilus_directory_are_all_files_seen (NautilusDirectory *directory)
{
......
......@@ -155,6 +155,11 @@ gboolean nautilus_directory_are_all_files_seen (NautilusDirectory
*/
gboolean nautilus_directory_metadata_loaded (NautilusDirectory *directory);
/* Return true if the directory is local.
*/
gboolean nautilus_directory_is_local (NautilusDirectory *directory);
typedef struct NautilusDirectoryDetails NautilusDirectoryDetails;
struct NautilusDirectory
......
......@@ -674,6 +674,15 @@ nautilus_file_matches_uri (NautilusFile *file, const char *uri_string)
return result;
}
gboolean
nautilus_file_is_local(NautilusFile *file)
{
g_return_val_if_fail (NAUTILUS_IS_FILE (file), FALSE);
return(nautilus_directory_is_local(file->details->directory));
}
gboolean
nautilus_file_update (NautilusFile *file, GnomeVFSFileInfo *info)
{
......
......@@ -176,6 +176,9 @@ char * nautilus_file_get_string_attribute (NautilusFile
gboolean nautilus_file_matches_uri (NautilusFile *file,
const char *uri);
/* Is the file local? */
gboolean nautilus_file_is_local (NautilusFile *file);
/* Compare file's state with a fresh file info struct, return FALSE if no change,
update file and return TRUE if the file info contains new state.
*/
......
......@@ -110,6 +110,13 @@ global_preferences_create_dialog (void)
NAUTILUS_PREFERENCES_CLICK_POLICY,
NAUTILUS_PREFERENCE_ITEM_ENUM);
nautilus_preferences_pane_add_group (NAUTILUS_PREFERENCES_PANE (directory_views_pane), "Remote Views");
nautilus_preferences_pane_add_item_to_nth_group (NAUTILUS_PREFERENCES_PANE (directory_views_pane),
2,
NAUTILUS_PREFERENCES_REMOTE_VIEWS,
NAUTILUS_PREFERENCE_ITEM_BOOLEAN);
/*
* Meta view pane
......@@ -312,6 +319,11 @@ global_preferences_register_for_ui ()
"Activate items with a double click",
NAUTILUS_CLICK_POLICY_DOUBLE);
nautilus_preferences_set_info (NAUTILUS_PREFERENCES_REMOTE_VIEWS,
"Fully Decorate Remote Views",
NAUTILUS_PREFERENCE_BOOLEAN,
(gconstpointer) FALSE);
/* User level */
nautilus_preferences_set_info (NAUTILUS_PREFERENCES_USER_LEVEL,
"User Level",
......
......@@ -60,6 +60,8 @@ enum
NAUTILUS_CLICK_POLICY_DOUBLE
};
#define NAUTILUS_PREFERENCES_REMOTE_VIEWS "/nautilus/preferences/remote_views"
void nautilus_global_preferences_startup (void);
void nautilus_global_preferences_shutdown (void);
void nautilus_global_preferences_show_dialog (void);
......
......@@ -800,7 +800,7 @@ nautilus_scalable_icon_equal (gconstpointer a,
NautilusScalableIcon *
nautilus_icon_factory_get_icon_for_file (NautilusFile *file, const char* modifier)
{
char *uri, *file_uri, *image_uri, *icon_name;
char *uri, *file_uri, *image_uri, *icon_name, *top_left_text = NULL;
NautilusScalableIcon *scalable_icon;
if (file == NULL) {
......@@ -847,12 +847,19 @@ nautilus_icon_factory_get_icon_for_file (NautilusFile *file, const char* modifie
if (icon_name == NULL) {
icon_name = g_strdup (nautilus_icon_factory_get_icon_name_for_file (file));
}
if (nautilus_file_is_local (file) ||
nautilus_preferences_get_boolean(NAUTILUS_PREFERENCES_REMOTE_VIEWS, FALSE)) {
top_left_text = nautilus_file_get_top_left_text (file);
}
/* Create the icon or find it in the cache if it's already there. */
scalable_icon = nautilus_scalable_icon_get (uri, icon_name, modifier,
nautilus_file_get_top_left_text (file));
top_left_text);
g_free (uri);
g_free (icon_name);
g_free (top_left_text);
return scalable_icon;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment