Commit b6258ecd authored by Darin Adler's avatar Darin Adler

Ignore the generated files in this new directory.

	* components/services/trilobite/src/.cvsignore:
	Ignore the generated files in this new directory.

	* libnautilus-extensions/nautilus-gnome-extensions.h:
	* libnautilus-extensions/nautilus-gnome-extensions.c:
	(convert_varargs_to_name_array), (nautilus_simple_dialog):
	Moved simple-dialog function from dfos. It just calls
	gnome_dialog with the right options.

	* libnautilus-extensions/nautilus-gtk-extensions.h:
	Added another marshal function.

	* libnautilus-extensions/nautilus-icon-container.h:
	* libnautilus-extensions/nautilus-icon-private.h:
	* libnautilus-extensions/nautilus-icon-container.c:
	(reload_icon_positions), (nautilus_icon_container_move_icon),
	(nautilus_icon_container_initialize_class),
	(nautilus_icon_container_add),
	(nautilus_icon_container_request_update_all),
	(nautilus_icon_container_set_auto_layout),
	(nautilus_icon_container_freeze_icon_positions),
	(nautilus_icon_container_sort),
	(nautilus_icon_container_start_renaming_selected_item):
	Reorganized signals. Added NautilusIconPosition to simplify
	the interface for signals that deal with icon position. Removed the
	now-unused icon_text_edit_occurred signal. Added the layout_changed
	signal. Added nautilus_icon_container_sort function. Moved some code
	out of the "omit self check" conditional.

	* libnautilus-extensions/nautilus-icon-dnd.c:
	(confirm_switch_to_manual_layout), (handle_local_move): Added code
	that switches to manual layout if you move an icon within the window
	and it's on auto layout.

	* src/file-manager/dfos-xfer.h:
	* src/file-manager/dfos-xfer.c: (handle_xfer_vfs_error),
	(handle_xfer_overwrite), (dfos_xfer): Switch code to use the new
	nautilus_simple_dialog instead of file_operation_alert, which I
	removed from here.

	* src/file-manager/fm-icon-view.c:
	(get_stored_icon_position_callback), (update_layout_menus),
	(fm_icon_view_begin_loading), (auto_layout_callback),
	(manual_layout_callback), (layout_changed_callback),
	(fm_icon_view_merge_menus), (icon_position_changed_callback),
	(create_icon_container):
	Added workaround for Bonobo bug where it calls the radio menu item
	callback that was making it always use auto layout. Converted to use
	the updated signal parameters. Added a signal handler to update the
	layout menu to match the layout when the layout is changed elsewhere.
parent 71b1af4b
2000-05-10 Darin Adler <darin@eazel.com>
* components/services/trilobite/src/.cvsignore:
Ignore the generated files in this new directory.
* libnautilus-extensions/nautilus-gnome-extensions.h:
* libnautilus-extensions/nautilus-gnome-extensions.c:
(convert_varargs_to_name_array), (nautilus_simple_dialog):
Moved simple-dialog function from dfos. It just calls
gnome_dialog with the right options.
* libnautilus-extensions/nautilus-gtk-extensions.h:
Added another marshal function.
* libnautilus-extensions/nautilus-icon-container.h:
* libnautilus-extensions/nautilus-icon-private.h:
* libnautilus-extensions/nautilus-icon-container.c:
(reload_icon_positions), (nautilus_icon_container_move_icon),
(nautilus_icon_container_initialize_class),
(nautilus_icon_container_add),
(nautilus_icon_container_request_update_all),
(nautilus_icon_container_set_auto_layout),
(nautilus_icon_container_freeze_icon_positions),
(nautilus_icon_container_sort),
(nautilus_icon_container_start_renaming_selected_item):
Reorganized signals. Added NautilusIconPosition to simplify
the interface for signals that deal with icon position. Removed the
now-unused icon_text_edit_occurred signal. Added the layout_changed
signal. Added nautilus_icon_container_sort function. Moved some code
out of the "omit self check" conditional.
* libnautilus-extensions/nautilus-icon-dnd.c:
(confirm_switch_to_manual_layout), (handle_local_move): Added code
that switches to manual layout if you move an icon within the window
and it's on auto layout.
* src/file-manager/dfos-xfer.h:
* src/file-manager/dfos-xfer.c: (handle_xfer_vfs_error),
(handle_xfer_overwrite), (dfos_xfer): Switch code to use the new
nautilus_simple_dialog instead of file_operation_alert, which I
removed from here.
* src/file-manager/fm-icon-view.c:
(get_stored_icon_position_callback), (update_layout_menus),
(fm_icon_view_begin_loading), (auto_layout_callback),
(manual_layout_callback), (layout_changed_callback),
(fm_icon_view_merge_menus), (icon_position_changed_callback),
(create_icon_container):
Added workaround for Bonobo bug where it calls the radio menu item
callback that was making it always use auto layout. Converted to use
the updated signal parameters. Added a signal handler to update the
layout menu to match the layout when the layout is changed elsewhere.
2000-05-10 John Sullivan <set EMAIL_ADDRESS environment variable>
* src/file-manager/fm-properties-window.c: (create_emblems_page):
......@@ -51,7 +104,7 @@
2000-05-09 Andy Hertzfeld <andy@eazel.com>
* src/libnautilus-extensions/nautilus-icon-factory.c:
* libnautilus-extensions/nautilus-icon-factory.c:
taught the icon factory to look in the user's home directory
for user-defined emblem images
......@@ -99,7 +152,7 @@
I/O when the file is destroyed (we already had the hook).
* libnautilus-extensions/nautilus-directory-async.c:
(lacks_top_left),
(lacks_top_left):
* libnautilus-extensions/nautilus-file-private.h:
* libnautilus-extensions/nautilus-file.c:
(nautilus_file_contains_text), (nautilus_file_get_top_left_text):
......
Makefile
Makefile.in
.deps
.libs
*.la
*.lo
trilobite-service-common.c
trilobite-service-skels.c
trilobite-service-stubs.c
trilobite-service.h
......@@ -29,8 +29,9 @@
#include <libgnomevfs/gnome-vfs-find-directory.h>
#include "dfos-xfer.h"
#include "libnautilus-extensions/nautilus-file-changes-queue.h"
#include "libnautilus-extensions/nautilus-glib-extensions.h"
#include <libnautilus-extensions/nautilus-file-changes-queue.h>
#include <libnautilus-extensions/nautilus-glib-extensions.h>
#include <libnautilus-extensions/nautilus-gnome-extensions.h>
#include "fm-directory-view.h"
typedef enum {
......@@ -209,9 +210,10 @@ handle_xfer_vfs_error (const GnomeVFSXferProgressInfo *progress_info,
"Would you like to continue?"),
gnome_vfs_result_to_string (progress_info->vfs_status),
progress_info->source_name);
result = file_operation_alert (xfer_info->parent_view, text,
_("File copy error"),
_("Skip"), _("Retry"), _("Stop"));
result = nautilus_simple_dialog
(xfer_info->parent_view, text,
_("File copy error"),
_("Skip"), _("Retry"), _("Stop"), NULL);
switch (result) {
case 0:
......@@ -251,9 +253,10 @@ handle_xfer_overwrite (const GnomeVFSXferProgressInfo *progress_info,
/* we are going to only get one duplicate alert, don't offer
* Replace All
*/
result = file_operation_alert (xfer_info->parent_view, text,
_("File copy conflict"),
_("Replace"), _("Skip"), NULL);
result = nautilus_simple_dialog
(xfer_info->parent_view, text,
_("File copy conflict"),
_("Replace"), _("Skip"), NULL);
switch (result) {
case 0:
return GNOME_VFS_XFER_OVERWRITE_ACTION_REPLACE;
......@@ -261,9 +264,10 @@ handle_xfer_overwrite (const GnomeVFSXferProgressInfo *progress_info,
return GNOME_VFS_XFER_OVERWRITE_ACTION_SKIP;
}
} else {
result = file_operation_alert (xfer_info->parent_view, text,
_("File copy conflict"),
_("Replace All"), _("Replace"), _("Skip"));
result = nautilus_simple_dialog
(xfer_info->parent_view, text,
_("File copy conflict"),
_("Replace All"), _("Replace"), _("Skip"), NULL);
switch (result) {
case 0:
......@@ -403,43 +407,6 @@ dfos_xfer (DFOS *dfos,
}
}
int
file_operation_alert (GtkWidget *parent_view, const char *text,
const char *title, const char *button_1_text,
const char *button_2_text, const char *button_3_text)
{
GtkWidget *dialog;
GtkWidget *prompt_widget;
GtkWidget *top_widget;
/* Don't use GNOME_STOCK_BUTTON_CANCEL because the
* red X is confusing in this context.
*/
dialog = gnome_dialog_new (title,
button_1_text,
button_2_text,
button_3_text,
NULL);
gnome_dialog_set_close (GNOME_DIALOG (dialog), TRUE);
gnome_dialog_close_hides (GNOME_DIALOG (dialog), TRUE);
top_widget = gtk_widget_get_toplevel (parent_view);
g_assert (GTK_IS_WINDOW (top_widget));
gnome_dialog_set_parent (GNOME_DIALOG (dialog), GTK_WINDOW (top_widget));
prompt_widget = gtk_label_new (text);
gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox),
prompt_widget,
TRUE, TRUE, GNOME_PAD);
gtk_widget_show_all (dialog);
return gnome_dialog_run (GNOME_DIALOG (dialog));
}
static void
get_parent_make_name_list (const GList *item_uris, GnomeVFSURI **source_dir_uri,
GList **item_names)
......
......@@ -21,8 +21,8 @@
Author: Ettore Perazzoli <ettore@gnu.org>
*/
#ifndef _XFER_H
#define _XFER_H
#ifndef DFOS_XFER_H
#define DFOS_XFER_H
#include <libgnomevfs/gnome-vfs.h>
#include "dfos.h"
......@@ -47,11 +47,4 @@ void fs_move_to_trash (const GList *item_uris,
void fs_empty_trash (GtkWidget *parent_view);
int file_operation_alert (GtkWidget *parent_view,
const char *text,
const char *title,
const char *button_1_text,
const char *button_2_text,
const char *button_3_text);
#endif /* _XFER_H */
#endif /* DFOS_XFER_H */
......@@ -27,6 +27,11 @@
#include <config.h>
#include "nautilus-gnome-extensions.h"
#include <gtk/gtkbox.h>
#include <gtk/gtklabel.h>
#include <libgnomeui/gnome-dialog.h>
#include <libgnomeui/gnome-uidefs.h>
void
nautilus_gnome_canvas_world_to_window_rectangle (GnomeCanvas *canvas,
const ArtDRect *world_rect,
......@@ -178,3 +183,67 @@ nautilus_gnome_canvas_item_get_world_bounds (GnomeCanvasItem *item,
&world_bounds->y1);
}
}
static const char **
convert_varargs_to_name_array (va_list args)
{
GPtrArray *resizeable_array;
const char *name;
const char **plain_ole_array;
resizeable_array = g_ptr_array_new ();
do {
name = va_arg (args, const char *);
g_ptr_array_add (resizeable_array, (gpointer) name);
} while (name != NULL);
plain_ole_array = (const char **) resizeable_array->pdata;
g_ptr_array_free (resizeable_array, FALSE);
return plain_ole_array;
}
int
nautilus_simple_dialog (GtkWidget *parent, const char *text, const char *title, ...)
{
va_list button_title_args;
const char **button_titles;
GtkWidget *dialog;
GtkWidget *top_widget;
GtkWidget *prompt_widget;
/* Create the dialog. */
va_start (button_title_args, title);
button_titles = convert_varargs_to_name_array (button_title_args);
va_end (button_title_args);
dialog = gnome_dialog_newv (title, button_titles);
g_free (button_titles);
/* Allow close. */
gnome_dialog_set_close (GNOME_DIALOG (dialog), TRUE);
gnome_dialog_close_hides (GNOME_DIALOG (dialog), TRUE);
/* Parent it if asked to. */
if (parent != NULL) {
top_widget = gtk_widget_get_toplevel (parent);
if (GTK_IS_WINDOW (top_widget)) {
gnome_dialog_set_parent (GNOME_DIALOG (dialog), GTK_WINDOW (top_widget));
}
}
/* Title it if asked to. */
if (text != NULL) {
prompt_widget = gtk_label_new (text);
gtk_label_set_justify (GTK_LABEL (prompt_widget),
GTK_JUSTIFY_LEFT);
gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox),
prompt_widget,
TRUE, TRUE, GNOME_PAD);
}
/* Run it. */
gtk_widget_show_all (dialog);
return gnome_dialog_run_and_close (GNOME_DIALOG (dialog));
}
......@@ -74,4 +74,10 @@ gboolean nautilus_art_irect_hits_irect (const ArtIRect *
gboolean nautilus_art_irect_contains_irect (const ArtIRect *outer_rect,
const ArtIRect *inner_rect);
int nautilus_simple_dialog (GtkWidget *parent,
const char *text,
const char *title,
...);
#endif /* NAUTILUS_GNOME_EXTENSIONS_H */
......@@ -78,6 +78,7 @@ void nautilus_gtk_style_set_font_by_name (GtkStyle
#define nautilus_gtk_marshal_NONE__BOXED_BOXED gtk_marshal_NONE__POINTER_POINTER
#define nautilus_gtk_marshal_NONE__POINTER_STRING_STRING nautilus_gtk_marshal_NONE__POINTER_POINTER_POINTER
#define nautilus_gtk_marshal_BOOL__POINTER_POINTER nautilus_gtk_marshal_INT__POINTER_POINTER
#define nautilus_gtk_marshal_INT__POINTER_STRING nautilus_gtk_marshal_INT__POINTER_POINTER
#define nautilus_gtk_marshal_POINTER__POINTER_STRING_POINTER nautilus_gtk_marshal_POINTER__POINTER_POINTER_POINTER
#define nautilus_gtk_marshal_POINTER__POINTER_INT_INT_STRING_POINTER nautilus_gtk_marshal_POINTER__POINTER_INT_INT_POINTER_POINTER
......
......@@ -110,7 +110,7 @@ enum {
GET_STORED_ICON_POSITION,
ICON_POSITION_CHANGED,
ICON_TEXT_CHANGED,
ICON_TEXT_EDIT_OCCURRED,
LAYOUT_CHANGED,
MOVE_COPY_ITEMS,
SELECTION_CHANGED,
LAST_SIGNAL
......@@ -131,33 +131,6 @@ icon_free (NautilusIcon *icon)
g_free (icon);
}
static NautilusIcon *
icon_new (NautilusIconContainer *container,
NautilusIconData *data)
{
NautilusIcon *icon;
GnomeCanvas *canvas;
canvas = GNOME_CANVAS (container);
icon = g_new0 (NautilusIcon, 1);
icon->scale_x = 1.0;
icon->scale_y = 1.0;
icon->data = data;
icon->item = NAUTILUS_ICON_CANVAS_ITEM
(gnome_canvas_item_new (GNOME_CANVAS_GROUP (canvas->root),
nautilus_icon_canvas_item_get_type (),
NULL));
icon->item->user_data = icon;
nautilus_icon_container_update_icon (container, icon);
return icon;
}
static void
icon_set_position (NautilusIcon *icon,
double x, double y)
......@@ -600,8 +573,7 @@ reload_icon_positions (NautilusIconContainer *container)
GList *p, *no_position_icons;
NautilusIcon *icon;
gboolean have_stored_position;
int x, y;
double scale_x, scale_y;
NautilusIconPosition position;
g_assert (!container->details->auto_layout);
......@@ -617,13 +589,10 @@ reload_icon_positions (NautilusIconContainer *container)
gtk_signal_emit (GTK_OBJECT (container),
signals[GET_STORED_ICON_POSITION],
icon->data,
&have_stored_position,
&x,
&y,
&scale_x,
&scale_y);
&position,
&have_stored_position);
if (have_stored_position) {
icon_set_position (icon, x, y);
icon_set_position (icon, position.x, position.y);
nautilus_icon_grid_add (container->details->grid, icon);
} else {
no_position_icons = g_list_prepend (no_position_icons, icon);
......@@ -717,6 +686,7 @@ nautilus_icon_container_move_icon (NautilusIconContainer *container,
{
NautilusIconContainerDetails *details;
gboolean emit_signal;
NautilusIconPosition position;
details = container->details;
......@@ -738,8 +708,12 @@ nautilus_icon_container_move_icon (NautilusIconContainer *container,
}
if (emit_signal) {
position.x = x;
position.y = y;
position.scale_x = scale_x;
position.scale_y = scale_y;
gtk_signal_emit (GTK_OBJECT (container), signals[ICON_POSITION_CHANGED],
icon->data, x, y, scale_x, scale_y);
icon->data, &position);
}
if (raise) {
......@@ -2232,21 +2206,10 @@ nautilus_icon_container_initialize_class (NautilusIconContainerClass *class)
object_class->type,
GTK_SIGNAL_OFFSET (NautilusIconContainerClass,
icon_position_changed),
nautilus_gtk_marshal_NONE__POINTER_INT_INT_DOUBLE_DOUBLE,
GTK_TYPE_NONE, 5,
gtk_marshal_NONE__POINTER_POINTER,
GTK_TYPE_NONE, 2,
GTK_TYPE_POINTER,
GTK_TYPE_INT,
GTK_TYPE_INT,
GTK_TYPE_DOUBLE,
GTK_TYPE_DOUBLE);
signals[ICON_TEXT_EDIT_OCCURRED]
= gtk_signal_new ("icon_text_edit_occurred",
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (NautilusIconContainerClass,
icon_text_edit_occurred),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
GTK_TYPE_POINTER);
signals[ICON_TEXT_CHANGED]
= gtk_signal_new ("icon_text_changed",
GTK_RUN_LAST,
......@@ -2336,14 +2299,18 @@ nautilus_icon_container_initialize_class (NautilusIconContainerClass *class)
object_class->type,
GTK_SIGNAL_OFFSET (NautilusIconContainerClass,
get_stored_icon_position),
nautilus_gtk_marshal_NONE__POINTER_POINTER_POINTER_POINTER_POINTER_POINTER,
GTK_TYPE_NONE, 6,
GTK_TYPE_POINTER,
GTK_TYPE_POINTER,
GTK_TYPE_POINTER,
GTK_TYPE_POINTER,
nautilus_gtk_marshal_BOOL__POINTER_POINTER,
GTK_TYPE_BOOL, 2,
GTK_TYPE_POINTER,
GTK_TYPE_POINTER);
signals[LAYOUT_CHANGED]
= gtk_signal_new ("layout_changed",
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (NautilusIconContainerClass,
layout_changed),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
......@@ -2787,8 +2754,7 @@ nautilus_icon_container_add (NautilusIconContainer *container,
NautilusIconContainerDetails *details;
NautilusIcon *icon;
gboolean have_stored_position;
int x, y;
double scale_x, scale_y;
NautilusIconPosition position;
g_return_if_fail (NAUTILUS_IS_ICON_CONTAINER (container));
g_return_if_fail (data != NULL);
......@@ -2796,41 +2762,49 @@ nautilus_icon_container_add (NautilusIconContainer *container,
details = container->details;
have_stored_position = FALSE;
scale_x = 1.0;
scale_y = 1.0;
position.scale_x = 1.0;
position.scale_y = 1.0;
gtk_signal_emit (GTK_OBJECT (container),
signals[GET_STORED_ICON_POSITION],
data,
&have_stored_position,
&x,
&y,
&scale_x,
&scale_y);
&position,
&have_stored_position);
icon = icon_new (container, data);
icon = g_new0 (NautilusIcon, 1);
icon->scale_x = position.scale_x;
icon->scale_y = position.scale_y;
icon->data = data;
icon->scale_x = scale_x;
icon->scale_y = scale_y;
icon->item = NAUTILUS_ICON_CANVAS_ITEM
(gnome_canvas_item_new (GNOME_CANVAS_GROUP (GNOME_CANVAS (container)->root),
nautilus_icon_canvas_item_get_type (),
NULL));
icon->item->user_data = icon;
if (!details->auto_layout && have_stored_position) {
icon_set_position (icon, x, y);
icon_set_position (icon, position.x, position.y);
} else {
auto_position_icon (container, icon);
}
details->icons = g_list_prepend (details->icons, icon);
nautilus_icon_container_update_icon (container, icon);
icon_show (icon);
nautilus_icon_canvas_item_update_bounds (icon->item);
nautilus_icon_grid_add (details->grid, icon);
/* Must connect the bounds_changed signal after adding the icon to the
* grid, because it will try to remove/add the icon too.
*/
gtk_signal_connect (GTK_OBJECT (icon->item), "event",
GTK_SIGNAL_FUNC (item_event_callback), container);
gtk_signal_connect (GTK_OBJECT (icon->item), "bounds_changed",
GTK_SIGNAL_FUNC (bounds_changed_callback), container);
nautilus_icon_container_update_icon (container, icon);
icon_show (icon);
request_idle (container);
}
......@@ -2947,6 +2921,7 @@ nautilus_icon_container_request_update_all (NautilusIconContainer *container)
for (p = container->details->icons; p != NULL; p = p->next) {
nautilus_icon_container_update_icon (container, p->data);
}
relayout (container);
}
......@@ -3348,6 +3323,7 @@ nautilus_icon_container_set_auto_layout (NautilusIconContainer *container,
reload_icon_positions (container);
nautilus_icon_container_freeze_icon_positions (container);
}
gtk_signal_emit (GTK_OBJECT (container), signals[LAYOUT_CHANGED]);
}
/* Switch from automatic to manual layout, freezing all the icons in their
......@@ -3357,51 +3333,52 @@ nautilus_icon_container_set_auto_layout (NautilusIconContainer *container,
void
nautilus_icon_container_freeze_icon_positions (NautilusIconContainer *container)
{
gboolean changed;
GList *p;
NautilusIcon *icon;
NautilusIconPosition position;
changed = container->details->auto_layout;
container->details->auto_layout = FALSE;
for (p = container->details->icons; p != NULL; p = p->next) {
icon = p->data;
position.x = icon->x;
position.y = icon->y;
position.scale_x = icon->scale_x;
position.scale_y = icon->scale_y;
gtk_signal_emit (GTK_OBJECT (container), signals[ICON_POSITION_CHANGED],
icon->data,
(int) icon->x, (int) icon->y,
(double) icon->scale_x, (double) icon->scale_y);
icon->data, &position);
}
if (changed) {
gtk_signal_emit (GTK_OBJECT (container), signals[LAYOUT_CHANGED]);
}
}
gboolean
nautilus_icon_container_is_auto_layout (NautilusIconContainer *container)
/* Re-sort, switching to automatic layout if it was in manual layout. */
void
nautilus_icon_container_sort (NautilusIconContainer *container)
{
g_return_val_if_fail (NAUTILUS_IS_ICON_CONTAINER (container), FALSE);
gboolean changed;
return container->details->auto_layout;
}
#if ! defined (NAUTILUS_OMIT_SELF_CHECK)
changed = !container->details->auto_layout;
container->details->auto_layout = TRUE;
static char *
nautilus_self_check_compute_stretch (int icon_x, int icon_y, int icon_size,
int start_pointer_x, int start_pointer_y,
int end_pointer_x, int end_pointer_y)
{
StretchState start, current;
relayout (container);
start.icon_x = icon_x;
start.icon_y = icon_y;
start.icon_size = icon_size;
start.pointer_x = start_pointer_x;
start.pointer_y = start_pointer_y;
current.pointer_x = end_pointer_x;
current.pointer_y = end_pointer_y;
if (changed) {
gtk_signal_emit (GTK_OBJECT (container), signals[LAYOUT_CHANGED]);
}
}
compute_stretch (&start, &current);
gboolean
nautilus_icon_container_is_auto_layout (NautilusIconContainer *container)
{
g_return_val_if_fail (NAUTILUS_IS_ICON_CONTAINER (container), FALSE);
return g_strdup_printf ("%d,%d:%d",
current.icon_x,
current.icon_y,
current.icon_size);
return container->details->auto_layout;
}
/**
......@@ -3458,9 +3435,10 @@ nautilus_icon_container_start_renaming_selected_item (NautilusIconContainer *con
details->original_text = g_strdup (editable_text);
/* Create text renaming widget */
details->rename_widget = NAUTILUS_ICON_TEXT_ITEM (gnome_canvas_item_new (gnome_canvas_root (GNOME_CANVAS (container)),
nautilus_icon_text_item_get_type (),
NULL));
details->rename_widget = NAUTILUS_ICON_TEXT_ITEM
(gnome_canvas_item_new (gnome_canvas_root (GNOME_CANVAS (container)),
nautilus_icon_text_item_get_type (),
NULL));
/* Determine widget position widget in container */
font = details->label_font[details->zoom_level];
......@@ -3492,7 +3470,6 @@ nautilus_icon_container_start_renaming_selected_item (NautilusIconContainer *con
container);
nautilus_icon_text_item_start_editing (details->rename_widget);
nautilus_icon_container_update_icon (container, icon);
/* We are in renaming mode */
......@@ -3564,6 +3541,55 @@ click_policy_changed_callback (gpointer user_data)
NAUTILUS_CLICK_POLICY_SINGLE) == NAUTILUS_CLICK_POLICY_SINGLE);
}
gboolean
nautilus_icon_container_has_stored_icon_positions (NautilusIconContainer *container)
{
GList *p;
NautilusIcon *icon;
gboolean have_stored_position;
NautilusIconPosition position;
for (p = container->details->icons; p != NULL; p = p->next) {
icon = p->data;
have_stored_position = FALSE;
gtk_signal_emit (GTK_OBJECT (container),
signals[GET_STORED_ICON_POSITION],
icon->data,
&position,
&have_stored_position);
if (have_stored_position) {
return TRUE;
}
}
return FALSE;
}
#if ! defined (NAUTILUS_OMIT_SELF_CHECK)
static char *
nautilus_self_check_compute_stretch (int icon_x, int icon_y, int icon_size,
int start_pointer_x, int start_pointer_y,
int end_pointer_x, int end_pointer_y)
{
StretchState start, current;
start.icon_x = icon_x;
start.icon_y = icon_y;
start.icon_size = icon_size;
start.pointer_x = start_pointer_x;
start.pointer_y = start_pointer_y;
current.pointer_x = end_pointer_x;
current.pointer_y = end_pointer_y;
compute_stretch (&start, &current);
return g_strdup_printf ("%d,%d:%d",
current.icon_x,
current.icon_y,
current.icon_size);
}
void
nautilus_self_check_icon_container (void)
{
......
......@@ -49,46 +49,43 @@ struct NautilusIconContainer {
NautilusIconContainerDetails *details;
};
typedef struct {
int x;
int y;
double scale_x;
double scale_y;
} NautilusIconPosition;
struct NautilusIconContainerClass {
GnomeCanvasClass parent_class;
/* Operations on the container. */
int (* button_press) (NautilusIconContainer *container,
GdkEventButton *event);
void (* context_click_background) (NautilusIconContainer *container);
/* Operations on icons. */
void (* activate) (NautilusIconContainer *container,
NautilusIconData *data);
void (* context_click_selection) (NautilusIconContainer *container);
void (* context_click_background) (NautilusIconContainer *container);
void (* selection_changed) (NautilusIconContainer *container);