Commit 1719a524 authored by Alexander Larsson's avatar Alexander Larsson Committed by Alexander Larsson

Fixes the icon position when creating a new folder, and the view is

2008-02-25  Alexander Larsson  <alexl@redhat.com>

        * libnautilus-private/nautilus-icon-container.[ch]:
        * src/file-manager/fm-directory-view.[ch]:
        * src/file-manager/fm-icon-view.c:
	Fixes the icon position when creating a new folder,
	and the view is zoomed.
	Patch from Christian Neumair


svn path=/trunk/; revision=13815
parent 93357905
2008-02-25 Alexander Larsson <alexl@redhat.com>
* libnautilus-private/nautilus-icon-container.[ch]:
* src/file-manager/fm-directory-view.[ch]:
* src/file-manager/fm-icon-view.c:
Fixes the icon position when creating a new folder,
and the view is zoomed.
Patch from Christian Neumair
2008-02-25 Alexander Larsson <alexl@redhat.com> 2008-02-25 Alexander Larsson <alexl@redhat.com>
* libnautilus-private/nautilus-icon-info.c (nautilus_icon_info_new_for_icon_info): * libnautilus-private/nautilus-icon-info.c (nautilus_icon_info_new_for_icon_info):
......
...@@ -7949,6 +7949,27 @@ nautilus_icon_container_accessible_select_all_selection (AtkSelection *accessibl ...@@ -7949,6 +7949,27 @@ nautilus_icon_container_accessible_select_all_selection (AtkSelection *accessibl
return TRUE; return TRUE;
} }
void
nautilus_icon_container_widget_to_file_operation_position (NautilusIconContainer *container,
GdkPoint *position)
{
double x, y;
g_return_if_fail (position != NULL);
x = position->x;
y = position->y;
eel_canvas_window_to_world (EEL_CANVAS (container), x, y, &x, &y);
position->x = (int) x;
position->y = (int) y;
/* ensure that we end up in the middle of the icon */
position->x -= nautilus_get_icon_size_for_zoom_level (container->details->zoom_level) / 2;
position->y -= nautilus_get_icon_size_for_zoom_level (container->details->zoom_level) / 2;
}
static void static void
nautilus_icon_container_accessible_selection_interface_init (AtkSelectionIface *iface) nautilus_icon_container_accessible_selection_interface_init (AtkSelectionIface *iface)
{ {
......
...@@ -304,6 +304,10 @@ void nautilus_icon_container_set_allow_moves (Nautilu ...@@ -304,6 +304,10 @@ void nautilus_icon_container_set_allow_moves (Nautilu
gboolean nautilus_icon_container_is_layout_rtl (NautilusIconContainer *container); gboolean nautilus_icon_container_is_layout_rtl (NautilusIconContainer *container);
void nautilus_icon_container_widget_to_file_operation_position (NautilusIconContainer *container,
GdkPoint *position);
#define CANVAS_WIDTH(container) ((GTK_WIDGET (container)->allocation.width \ #define CANVAS_WIDTH(container) ((GTK_WIDGET (container)->allocation.width \
- container->details->left_margin \ - container->details->left_margin \
- container->details->right_margin) \ - container->details->right_margin) \
......
...@@ -3819,6 +3819,9 @@ context_menu_to_file_operation_position (FMDirectoryView *directory_view) ...@@ -3819,6 +3819,9 @@ context_menu_to_file_operation_position (FMDirectoryView *directory_view)
if (fm_directory_view_using_manual_layout (directory_view) if (fm_directory_view_using_manual_layout (directory_view)
&& directory_view->details->context_menu_position.x >= 0 && directory_view->details->context_menu_position.x >= 0
&& directory_view->details->context_menu_position.y >= 0) { && directory_view->details->context_menu_position.y >= 0) {
EEL_CALL_METHOD (FM_DIRECTORY_VIEW_CLASS, directory_view,
widget_to_file_operation_position,
(directory_view, &directory_view->details->context_menu_position));
return &directory_view->details->context_menu_position; return &directory_view->details->context_menu_position;
} else { } else {
return NULL; return NULL;
......
...@@ -297,6 +297,15 @@ struct FMDirectoryViewClass { ...@@ -297,6 +297,15 @@ struct FMDirectoryViewClass {
NautilusFile *file, NautilusFile *file,
NautilusDirectory *directory); NautilusDirectory *directory);
/* convert *point from widget's coordinate system to a coordinate
* system used for specifying file operation positions, which is view-specific.
*
* This is used by the the icon view, which converts the screen position to a zoom
* level-independent coordinate system.
*/
void (* widget_to_file_operation_position) (FMDirectoryView *view,
GdkPoint *position);
/* Preference change callbacks, overriden by icon and list views. /* Preference change callbacks, overriden by icon and list views.
* Icon and list views respond by synchronizing to the new preference * Icon and list views respond by synchronizing to the new preference
* values and forcing an update if appropriate. * values and forcing an update if appropriate.
......
...@@ -1682,6 +1682,16 @@ fm_icon_view_using_manual_layout (FMDirectoryView *view) ...@@ -1682,6 +1682,16 @@ fm_icon_view_using_manual_layout (FMDirectoryView *view)
return !fm_icon_view_using_auto_layout (FM_ICON_VIEW (view)); return !fm_icon_view_using_auto_layout (FM_ICON_VIEW (view));
} }
static void
fm_icon_view_widget_to_file_operation_position (FMDirectoryView *view,
GdkPoint *position)
{
g_assert (FM_IS_ICON_VIEW (view));
nautilus_icon_container_widget_to_file_operation_position
(get_icon_container (FM_ICON_VIEW (view)), position);
}
static void static void
icon_container_activate_callback (NautilusIconContainer *container, icon_container_activate_callback (NautilusIconContainer *container,
GList *file_list, GList *file_list,
...@@ -2600,6 +2610,7 @@ fm_icon_view_class_init (FMIconViewClass *klass) ...@@ -2600,6 +2610,7 @@ fm_icon_view_class_init (FMIconViewClass *klass)
fm_directory_view_class->text_attribute_names_changed = fm_icon_view_text_attribute_names_changed; fm_directory_view_class->text_attribute_names_changed = fm_icon_view_text_attribute_names_changed;
fm_directory_view_class->update_menus = fm_icon_view_update_menus; fm_directory_view_class->update_menus = fm_icon_view_update_menus;
fm_directory_view_class->using_manual_layout = fm_icon_view_using_manual_layout; fm_directory_view_class->using_manual_layout = fm_icon_view_using_manual_layout;
fm_directory_view_class->widget_to_file_operation_position = fm_icon_view_widget_to_file_operation_position;
klass->clean_up = fm_icon_view_real_clean_up; klass->clean_up = fm_icon_view_real_clean_up;
klass->supports_auto_layout = real_supports_auto_layout; klass->supports_auto_layout = real_supports_auto_layout;
......
Markdown is supported
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