diff options
author | Marcus Carlson <mdc@src.gnome.org> | 2010-08-09 21:50:42 +0200 |
---|---|---|
committer | Cosimo Cecchi <cosimoc@gnome.org> | 2010-08-12 12:52:29 +0200 |
commit | ab97991f3d5c04cd4fcfc94d1efffaff37458ae7 (patch) | |
tree | c1fec420b666d2b5c8e808ea9b174927b780aed0 /src/file-manager/fm-icon-view.c | |
parent | 97bb1989ddd6d8f04bcec96ce3652f6462c78a0e (diff) | |
download | nautilus-ab97991f3d5c04cd4fcfc94d1efffaff37458ae7.tar.gz |
Enable scaling of icons on desktop only (#589295)
Diffstat (limited to 'src/file-manager/fm-icon-view.c')
-rw-r--r-- | src/file-manager/fm-icon-view.c | 51 |
1 files changed, 41 insertions, 10 deletions
diff --git a/src/file-manager/fm-icon-view.c b/src/file-manager/fm-icon-view.c index e12e75f12..3771e9751 100644 --- a/src/file-manager/fm-icon-view.c +++ b/src/file-manager/fm-icon-view.c @@ -176,7 +176,8 @@ static void fm_icon_view_update_click_mode (FMIconVie static void fm_icon_view_set_directory_tighter_layout (FMIconView *icon_view, NautilusFile *file, gboolean tighter_layout); -static gboolean fm_icon_view_supports_manual_layout (FMIconView *icon_view); +static gboolean fm_icon_view_supports_manual_layout (FMIconView *icon_view); +static gboolean fm_icon_view_supports_scaling (FMIconView *icon_view); static void fm_icon_view_reveal_selection (FMDirectoryView *view); static const SortCriterion *get_sort_criterion_by_sort_type (NautilusFileSortType sort_type); static void set_sort_criterion_by_sort_type (FMIconView *icon_view, @@ -275,15 +276,20 @@ get_stored_icon_position_callback (NautilusIconContainer *container, /* If it is the desktop directory, maybe the gnome-libs metadata has information about it */ - /* Get the scale of the icon from the metadata. */ - scale_string = nautilus_file_get_metadata - (file, NAUTILUS_METADATA_KEY_ICON_SCALE, "1"); - position->scale = g_ascii_strtod (scale_string, NULL); - if (errno != 0) { - position->scale = 1.0; - } + /* Disable scaling if not on the desktop */ + if (fm_icon_view_supports_scaling (icon_view)) { + /* Get the scale of the icon from the metadata. */ + scale_string = nautilus_file_get_metadata + (file, NAUTILUS_METADATA_KEY_ICON_SCALE, "1"); + position->scale = g_ascii_strtod (scale_string, NULL); + if (errno != 0) { + position->scale = 1.0; + } - g_free (scale_string); + g_free (scale_string); + } else { + position->scale = 1.0; + } return position_good; } @@ -618,6 +624,16 @@ fm_icon_view_supports_auto_layout (FMIconView *view) } static gboolean +fm_icon_view_supports_scaling (FMIconView *view) +{ + g_return_val_if_fail (FM_IS_ICON_VIEW (view), FALSE); + + return EEL_CALL_METHOD_WITH_RETURN_VALUE + (FM_ICON_VIEW_CLASS, view, + supports_scaling, (view)); +} + +static gboolean fm_icon_view_supports_manual_layout (FMIconView *view) { g_return_val_if_fail (FM_IS_ICON_VIEW (view), FALSE); @@ -1043,6 +1059,14 @@ real_supports_auto_layout (FMIconView *view) } static gboolean +real_supports_scaling (FMIconView *view) +{ + g_return_val_if_fail (FM_IS_ICON_VIEW (view), FALSE); + + return FALSE; +} + +static gboolean real_supports_manual_layout (FMIconView *view) { g_return_val_if_fail (FM_IS_ICON_VIEW (view), FALSE); @@ -1692,7 +1716,7 @@ fm_icon_view_merge_menus (FMDirectoryView *view) gtk_action_set_visible (action, FALSE); } - if (FM_IS_DESKTOP_ICON_VIEW (icon_view)) { + if (fm_icon_view_supports_scaling (icon_view)) { gtk_ui_manager_add_ui (ui_manager, icon_view->details->icon_merge_id, POPUP_PATH_ICON_APPEARANCE, @@ -1755,6 +1779,9 @@ fm_icon_view_update_menus (FMDirectoryView *view) && icon_container != NULL && !nautilus_icon_container_has_stretch_handles (icon_container)); + gtk_action_set_visible (action, + fm_icon_view_supports_scaling (icon_view)); + action = gtk_action_group_get_action (icon_view->details->icon_action_group, FM_ACTION_UNSTRETCH); g_object_set (action, "label", @@ -1766,6 +1793,9 @@ fm_icon_view_update_menus (FMDirectoryView *view) icon_container != NULL && nautilus_icon_container_is_stretched (icon_container)); + gtk_action_set_visible (action, + fm_icon_view_supports_scaling (icon_view)); + nautilus_file_list_free (selection); editable = fm_directory_view_is_editable (view); @@ -2996,6 +3026,7 @@ fm_icon_view_class_init (FMIconViewClass *klass) klass->clean_up = fm_icon_view_real_clean_up; klass->supports_auto_layout = real_supports_auto_layout; + klass->supports_scaling = real_supports_scaling; klass->supports_manual_layout = real_supports_manual_layout; klass->supports_keep_aligned = real_supports_keep_aligned; klass->supports_labels_beside_icons = real_supports_labels_beside_icons; |