From bfb2b657c75b2f965cb7f2d434aceb915267edaa Mon Sep 17 00:00:00 2001 From: William Jon McCann Date: Wed, 15 Aug 2012 20:10:39 -0400 Subject: Merge the settings for showing text and image previews Especially considering that the default GNOME theme does not do text previewing it doesn't make sense to have two different settings. https://bugzilla.gnome.org/show_bug.cgi?id=681956 --- libnautilus-private/nautilus-directory.c | 4 - libnautilus-private/nautilus-file.c | 52 +++------- libnautilus-private/nautilus-global-preferences.h | 5 +- .../org.gnome.nautilus.gschema.xml.in | 10 +- src/nautilus-canvas-view.c | 2 +- src/nautilus-file-management-properties.c | 16 +--- src/nautilus-file-management-properties.ui | 106 ++------------------- 7 files changed, 31 insertions(+), 164 deletions(-) diff --git a/libnautilus-private/nautilus-directory.c b/libnautilus-private/nautilus-directory.c index 801ce4738..fee04d7e3 100644 --- a/libnautilus-private/nautilus-directory.c +++ b/libnautilus-private/nautilus-directory.c @@ -305,10 +305,6 @@ add_preferences_callbacks (void) "changed::" NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES, G_CALLBACK(filtering_changed_callback), NULL); - g_signal_connect_swapped (nautilus_preferences, - "changed::" NAUTILUS_PREFERENCES_SHOW_TEXT_IN_ICONS, - G_CALLBACK (async_data_preference_changed_callback), - NULL); g_signal_connect_swapped (nautilus_preferences, "changed::" NAUTILUS_PREFERENCES_SHOW_DIRECTORY_ITEM_COUNTS, G_CALLBACK (async_data_preference_changed_callback), diff --git a/libnautilus-private/nautilus-file.c b/libnautilus-private/nautilus-file.c index a96e08f66..3a9d32112 100644 --- a/libnautilus-private/nautilus-file.c +++ b/libnautilus-private/nautilus-file.c @@ -115,6 +115,12 @@ static guint signals[LAST_SIGNAL]; static GHashTable *symbolic_links; +static guint64 cached_thumbnail_limit; +int cached_thumbnail_size; +static NautilusSpeedTradeoffValue show_file_thumbs; + +static NautilusSpeedTradeoffValue show_directory_item_count; + static GQuark attribute_name_q, attribute_size_q, attribute_type_q, @@ -3995,11 +4001,6 @@ get_custom_icon (NautilusFile *file) return icon; } - -static guint64 cached_thumbnail_limit; -int cached_thumbnail_size; -static int show_image_thumbs; - GFilesystemPreviewType nautilus_file_get_filesystem_use_preview (NautilusFile *file) { @@ -4039,13 +4040,13 @@ nautilus_file_should_show_thumbnail (NautilusFile *file) return FALSE; } - if (show_image_thumbs == NAUTILUS_SPEED_TRADEOFF_ALWAYS) { + if (show_file_thumbs == NAUTILUS_SPEED_TRADEOFF_ALWAYS) { if (use_preview == G_FILESYSTEM_PREVIEW_TYPE_NEVER) { return FALSE; } else { return TRUE; } - } else if (show_image_thumbs == NAUTILUS_SPEED_TRADEOFF_NEVER) { + } else if (show_file_thumbs == NAUTILUS_SPEED_TRADEOFF_NEVER) { return FALSE; } else { if (use_preview == G_FILESYSTEM_PREVIEW_TYPE_NEVER) { @@ -4474,15 +4475,6 @@ nautilus_file_get_date_as_string (NautilusFile *file, NautilusDateType date_type return result; } -static NautilusSpeedTradeoffValue show_directory_item_count; -static NautilusSpeedTradeoffValue show_text_in_icons; - -static void -show_text_in_icons_changed_callback (gpointer callback_data) -{ - show_text_in_icons = g_settings_get_enum (nautilus_preferences, NAUTILUS_PREFERENCES_SHOW_TEXT_IN_ICONS); -} - static void show_directory_item_count_changed_callback (gpointer callback_data) { @@ -4571,31 +4563,17 @@ nautilus_file_should_show_type (NautilusFile *file) gboolean nautilus_file_should_get_top_left_text (NautilusFile *file) { - static gboolean show_text_in_icons_callback_added = FALSE; - g_return_val_if_fail (NAUTILUS_IS_FILE (file), FALSE); - /* Add the callback once for the life of our process */ - if (!show_text_in_icons_callback_added) { - g_signal_connect_swapped (nautilus_preferences, - "changed::" NAUTILUS_PREFERENCES_SHOW_TEXT_IN_ICONS, - G_CALLBACK (show_text_in_icons_changed_callback), - NULL); - show_text_in_icons_callback_added = TRUE; - - /* Peek for the first time */ - show_text_in_icons_changed_callback (NULL); - } - - if (show_text_in_icons == NAUTILUS_SPEED_TRADEOFF_ALWAYS) { + if (show_file_thumbs == NAUTILUS_SPEED_TRADEOFF_ALWAYS) { return TRUE; } - if (show_text_in_icons == NAUTILUS_SPEED_TRADEOFF_NEVER) { + if (show_file_thumbs == NAUTILUS_SPEED_TRADEOFF_NEVER) { return FALSE; } - return get_speed_tradeoff_preference_for_file (file, show_text_in_icons); + return get_speed_tradeoff_preference_for_file (file, show_file_thumbs); } /** @@ -7857,7 +7835,7 @@ static void thumbnail_limit_changed_callback (gpointer user_data) { g_settings_get (nautilus_preferences, - NAUTILUS_PREFERENCES_IMAGE_FILE_THUMBNAIL_LIMIT, + NAUTILUS_PREFERENCES_FILE_THUMBNAIL_LIMIT, "t", &cached_thumbnail_limit); /* Tell the world that icons might have changed. We could invent a narrower-scope @@ -7883,7 +7861,7 @@ thumbnail_size_changed_callback (gpointer user_data) static void show_thumbnails_changed_callback (gpointer user_data) { - show_image_thumbs = g_settings_get_enum (nautilus_preferences, NAUTILUS_PREFERENCES_SHOW_IMAGE_FILE_THUMBNAILS); + show_file_thumbs = g_settings_get_enum (nautilus_preferences, NAUTILUS_PREFERENCES_SHOW_FILE_THUMBNAILS); /* Tell the world that icons might have changed. We could invent a narrower-scope * signal to mean only "thumbnails might have changed" if this ends up being slow @@ -7997,7 +7975,7 @@ nautilus_file_class_init (NautilusFileClass *class) thumbnail_limit_changed_callback (NULL); g_signal_connect_swapped (nautilus_preferences, - "changed::" NAUTILUS_PREFERENCES_IMAGE_FILE_THUMBNAIL_LIMIT, + "changed::" NAUTILUS_PREFERENCES_FILE_THUMBNAIL_LIMIT, G_CALLBACK (thumbnail_limit_changed_callback), NULL); thumbnail_size_changed_callback (NULL); @@ -8007,7 +7985,7 @@ nautilus_file_class_init (NautilusFileClass *class) NULL); show_thumbnails_changed_callback (NULL); g_signal_connect_swapped (nautilus_preferences, - "changed::" NAUTILUS_PREFERENCES_SHOW_IMAGE_FILE_THUMBNAILS, + "changed::" NAUTILUS_PREFERENCES_SHOW_FILE_THUMBNAILS, G_CALLBACK (show_thumbnails_changed_callback), NULL); diff --git a/libnautilus-private/nautilus-global-preferences.h b/libnautilus-private/nautilus-global-preferences.h index 520c33445..b897cd281 100644 --- a/libnautilus-private/nautilus-global-preferences.h +++ b/libnautilus-private/nautilus-global-preferences.h @@ -129,10 +129,9 @@ typedef enum NAUTILUS_SPEED_TRADEOFF_NEVER } NautilusSpeedTradeoffValue; -#define NAUTILUS_PREFERENCES_SHOW_TEXT_IN_ICONS "show-icon-text" #define NAUTILUS_PREFERENCES_SHOW_DIRECTORY_ITEM_COUNTS "show-directory-item-counts" -#define NAUTILUS_PREFERENCES_SHOW_IMAGE_FILE_THUMBNAILS "show-image-thumbnails" -#define NAUTILUS_PREFERENCES_IMAGE_FILE_THUMBNAIL_LIMIT "thumbnail-limit" +#define NAUTILUS_PREFERENCES_SHOW_FILE_THUMBNAILS "show-image-thumbnails" +#define NAUTILUS_PREFERENCES_FILE_THUMBNAIL_LIMIT "thumbnail-limit" typedef enum { diff --git a/libnautilus-private/org.gnome.nautilus.gschema.xml.in b/libnautilus-private/org.gnome.nautilus.gschema.xml.in index 932abb022..dffa14b59 100644 --- a/libnautilus-private/org.gnome.nautilus.gschema.xml.in +++ b/libnautilus-private/org.gnome.nautilus.gschema.xml.in @@ -83,12 +83,6 @@ <_summary>Whether to enable immediate deletion <_description>If set to true, then Nautilus will have a feature allowing you to delete a file immediately and in-place, instead of moving it to the trash. This feature can be dangerous, so use caution. - - - 'local-only' - <_summary>When to show preview text in icons - <_description>Speed tradeoff for when to show a preview of text file contents in the file's icon. If set to "always" then always show previews, even if the folder is on a remote server. If set to "local-only" then only show previews for local file systems. If set to "never" then never bother to read preview data. - 'local-only' @@ -128,8 +122,8 @@ 'local-only' - <_summary>When to show thumbnails of image files - <_description>Speed tradeoff for when to show an image file as a thumbnail. If set to "always" then always thumbnail, even if the folder is on a remote server. If set to "local-only" then only show thumbnails for local file systems. If set to "never" then never bother to thumbnail images, just use a generic icon. + <_summary>When to show thumbnails of files + <_description>Speed tradeoff for when to show a file as a thumbnail. If set to "always" then always thumbnail, even if the folder is on a remote server. If set to "local-only" then only show thumbnails for local file systems. If set to "never" then never bother to thumbnail files, just use a generic icon. Despite what the name may suggest, this applies to any previewable file type. 10485760 diff --git a/src/nautilus-canvas-view.c b/src/nautilus-canvas-view.c index 9ca6b1c73..a0a1fd736 100644 --- a/src/nautilus-canvas-view.c +++ b/src/nautilus-canvas-view.c @@ -2410,7 +2410,7 @@ nautilus_canvas_view_init (NautilusCanvasView *canvas_view) G_CALLBACK (default_sort_in_reverse_order_changed_callback), canvas_view); g_signal_connect_swapped (nautilus_preferences, - "changed::" NAUTILUS_PREFERENCES_SHOW_IMAGE_FILE_THUMBNAILS, + "changed::" NAUTILUS_PREFERENCES_SHOW_FILE_THUMBNAILS, G_CALLBACK (image_display_policy_changed_callback), canvas_view); diff --git a/src/nautilus-file-management-properties.c b/src/nautilus-file-management-properties.c index 77564eb54..d93279484 100644 --- a/src/nautilus-file-management-properties.c +++ b/src/nautilus-file-management-properties.c @@ -45,8 +45,7 @@ #define NAUTILUS_FILE_MANAGEMENT_PROPERTIES_ICON_VIEW_ZOOM_WIDGET "icon_view_zoom_combobox" #define NAUTILUS_FILE_MANAGEMENT_PROPERTIES_LIST_VIEW_ZOOM_WIDGET "list_view_zoom_combobox" #define NAUTILUS_FILE_MANAGEMENT_PROPERTIES_SORT_ORDER_WIDGET "sort_order_combobox" -#define NAUTILUS_FILE_MANAGEMENT_PROPERTIES_PREVIEW_TEXT_WIDGET "preview_text_combobox" -#define NAUTILUS_FILE_MANAGEMENT_PROPERTIES_PREVIEW_IMAGE_WIDGET "preview_image_combobox" +#define NAUTILUS_FILE_MANAGEMENT_PROPERTIES_PREVIEW_FILES_WIDGET "preview_image_combobox" #define NAUTILUS_FILE_MANAGEMENT_PROPERTIES_PREVIEW_FOLDER_WIDGET "preview_folder_combobox" /* bool preferences */ @@ -556,7 +555,6 @@ bind_builder_enum (GtkBuilder *builder, enum_values, NULL); } - typedef struct { const guint64 *values; int n_values; @@ -684,7 +682,7 @@ nautilus_file_management_properties_dialog_setup (GtkBuilder *builder, GtkWindow 3); nautilus_file_management_properties_size_group_create (builder, "preview_label", - 4); + 3); /* setup preferences */ bind_builder_bool (builder, nautilus_preferences, @@ -721,12 +719,8 @@ nautilus_file_management_properties_dialog_setup (GtkBuilder *builder, GtkWindow NAUTILUS_PREFERENCES_DEFAULT_SORT_ORDER, (const char **) sort_order_values); bind_builder_enum (builder, nautilus_preferences, - NAUTILUS_FILE_MANAGEMENT_PROPERTIES_PREVIEW_TEXT_WIDGET, - NAUTILUS_PREFERENCES_SHOW_TEXT_IN_ICONS, - (const char **) preview_values); - bind_builder_enum (builder, nautilus_preferences, - NAUTILUS_FILE_MANAGEMENT_PROPERTIES_PREVIEW_IMAGE_WIDGET, - NAUTILUS_PREFERENCES_SHOW_IMAGE_FILE_THUMBNAILS, + NAUTILUS_FILE_MANAGEMENT_PROPERTIES_PREVIEW_FILES_WIDGET, + NAUTILUS_PREFERENCES_SHOW_FILE_THUMBNAILS, (const char **) preview_values); bind_builder_enum (builder, nautilus_preferences, NAUTILUS_FILE_MANAGEMENT_PROPERTIES_PREVIEW_FOLDER_WIDGET, @@ -744,7 +738,7 @@ nautilus_file_management_properties_dialog_setup (GtkBuilder *builder, GtkWindow bind_builder_uint_enum (builder, nautilus_preferences, NAUTILUS_FILE_MANAGEMENT_PROPERTIES_THUMBNAIL_LIMIT_WIDGET, - NAUTILUS_PREFERENCES_IMAGE_FILE_THUMBNAIL_LIMIT, + NAUTILUS_PREFERENCES_FILE_THUMBNAIL_LIMIT, thumbnail_limit_values, G_N_ELEMENTS (thumbnail_limit_values)); diff --git a/src/nautilus-file-management-properties.ui b/src/nautilus-file-management-properties.ui index 8a8dbe56e..af00c153a 100644 --- a/src/nautilus-file-management-properties.ui +++ b/src/nautilus-file-management-properties.ui @@ -1027,100 +1027,6 @@ 12 vertical 18 - - - True - False - vertical - 6 - - - True - False - 0 - Text Files - - - - - - False - False - 0 - - - - - True - False - 12 - - - True - False - vertical - 6 - - - True - False - 12 - - - True - False - 0 - Show te_xt in icons: - True - preview_text_combobox - - - False - False - 0 - - - - - True - False - model6 - - - - 0 - - - - - False - False - 1 - - - - - False - False - 0 - - - - - - - False - False - 1 - - - - - False - True - 0 - - True @@ -1132,7 +1038,7 @@ True False 0 - Other Previewable Files + Files @@ -1160,7 +1066,7 @@ False 12 - + True False 0 @@ -1205,7 +1111,7 @@ False 12 - + True False 0 @@ -1257,7 +1163,7 @@ False True - 1 + 0 @@ -1299,7 +1205,7 @@ False 12 - + True False 0 @@ -1351,7 +1257,7 @@ False True - 3 + 2 -- cgit v1.2.1