[nautilus] Merge the settings for showing text and image previews
- From: William Jon McCann <mccann src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] Merge the settings for showing text and image previews
- Date: Thu, 16 Aug 2012 02:06:00 +0000 (UTC)
commit bfb2b657c75b2f965cb7f2d434aceb915267edaa
Author: William Jon McCann <jmccann redhat com>
Date: Wed Aug 15 20:10:39 2012 -0400
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 801ce47..fee04d7 100644
--- a/libnautilus-private/nautilus-directory.c
+++ b/libnautilus-private/nautilus-directory.c
@@ -306,10 +306,6 @@ add_preferences_callbacks (void)
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),
NULL);
diff --git a/libnautilus-private/nautilus-file.c b/libnautilus-private/nautilus-file.c
index a96e08f..3a9d321 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 520c334..b897cd2 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 932abb0..dffa14b 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</_summary>
<_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.</_description>
</key>
- <key name="show-icon-text" enum="org.gnome.nautilus.SpeedTradeoff">
- <aliases><alias value='local_only' target='local-only'/></aliases>
- <default>'local-only'</default>
- <_summary>When to show preview text in icons</_summary>
- <_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.</_description>
- </key>
<key name="show-directory-item-counts" enum="org.gnome.nautilus.SpeedTradeoff">
<aliases><alias value='local_only' target='local-only'/></aliases>
<default>'local-only'</default>
@@ -128,8 +122,8 @@
<key name="show-image-thumbnails" enum="org.gnome.nautilus.SpeedTradeoff">
<aliases><alias value='local_only' target='local-only'/></aliases>
<default>'local-only'</default>
- <_summary>When to show thumbnails of image files</_summary>
- <_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.</_description>
+ <_summary>When to show thumbnails of files</_summary>
+ <_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.</_description>
</key>
<key name="thumbnail-limit" type="t">
<default>10485760</default>
diff --git a/src/nautilus-canvas-view.c b/src/nautilus-canvas-view.c
index 9ca6b1c..a0a1fd7 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 77564eb..d932794 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 8a8dbe5..af00c15 100644
--- a/src/nautilus-file-management-properties.ui
+++ b/src/nautilus-file-management-properties.ui
@@ -1028,100 +1028,6 @@
<property name="orientation">vertical</property>
<property name="spacing">18</property>
<child>
- <object class="GtkBox" id="vbox10">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="orientation">vertical</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkLabel" id="label16">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Text Files</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- </attributes>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkAlignment" id="alignment10">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="left_padding">12</property>
- <child>
- <object class="GtkBox" id="vbox20">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="orientation">vertical</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkBox" id="hbox24">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="spacing">12</property>
- <child>
- <object class="GtkLabel" id="preview_label_0">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Show te_xt in icons:</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">preview_text_combobox</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkComboBox" id="preview_text_combobox">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="model">model6</property>
- <child>
- <object class="GtkCellRendererText" id="renderer6"/>
- <attributes>
- <attribute name="text">0</attribute>
- </attributes>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
<object class="GtkBox" id="vbox11">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -1132,7 +1038,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">Other Previewable Files</property>
+ <property name="label" translatable="yes">Files</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
@@ -1160,7 +1066,7 @@
<property name="can_focus">False</property>
<property name="spacing">12</property>
<child>
- <object class="GtkLabel" id="preview_label_1">
+ <object class="GtkLabel" id="preview_label_0">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
@@ -1205,7 +1111,7 @@
<property name="can_focus">False</property>
<property name="spacing">12</property>
<child>
- <object class="GtkLabel" id="preview_label_2">
+ <object class="GtkLabel" id="preview_label_1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
@@ -1257,7 +1163,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">1</property>
+ <property name="position">0</property>
</packing>
</child>
<child>
@@ -1299,7 +1205,7 @@
<property name="can_focus">False</property>
<property name="spacing">12</property>
<child>
- <object class="GtkLabel" id="preview_label_3">
+ <object class="GtkLabel" id="preview_label_2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
@@ -1351,7 +1257,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">3</property>
+ <property name="position">2</property>
</packing>
</child>
</object>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]