Commit c8853690 authored by Darin Adler's avatar Darin Adler

Added a controller object that lets GnomeIconContainer

	ask questions and perform actions, even though only the
	FMDirectoryViewIcons knows how to answer the questions
	and perform the actions.

	Replaced use of nautilus_file_get_info with specific
	accessors for various file info.

	* libnautilus/Makefile.am:
	libnautilus/nautilus-icons-controller.h:
	libnautilus/nautilus-icons-controller.c:
	libnautilus/gnome-icon-container-private.h:
	libnautilus/gnome-icon-container.h:
	libnautilus/gnome-icon-container.c:
	(icon_new_pixbuf):
	(gnome_icon_container_new):
	(gnome_icon_container_add):
	(gnome_icon_container_add_auto):
	Added NautilusIconsController, an interface provided so that the
	file manager can connect the icons up with the file code. This is
	all so we can keep the view/controller separation. This eliminates
	the need to pass around the icon name all the time, so the signals
	have changed to not take the icon name as a parameter.

	* src/file-manager/Makefile.am:
	src/file-manager/fm-icons-controller.c:
	src/file-manager/fm-icons-controller.h:
	Added FMIconsController, the actual controller used by the file
	manager instance of GnomeIconContainer.
	src/file-manager/fm-directory-view-icons.c:
	(create_icon_container):
	(add_icon_if_already_positioned):
	(add_icon_at_free_position):
	(icon_container_activate_cb):
	(fm_directory_view_icons_icon_moved_cb):
	Create and use the FMIconController.

	* libnautilus/gnome-icon-container-private.h:
	libnautilus/gnome-icon-container-dnd.c:
	(set_gnome_icon_list_selection):
	(set_uri_list_selection):
	libnautilus/gnome-icon-container.c:
	(gnome_icon_container_set_base_uri):
	src/file-manager/fm-directory-view-icons.c:
	(set_up_base_uri):
	(fm_directory_view_icons_begin_loading):
	Get rid of the old base_uri technique for handling drags. Instead
	the icon controller supplies URIs for icons when requested.

	* RENAMING: Proposed that we use NautilusIconsView as the new name
	for GnomeIconContainer instead of NautilusIconContainer.

	* libnautilus/gnome-icon-container-private.h:
	libnautilus/gnome-icon-container.h:
	libnautilus/gnome-icon-container.c:
	(gnome_icon_container_initialize):
	(handle_icon_enter_notify):
	(handle_icon_leave_notify):
	Renamed browser mode to linger selection mode.

	* libnautilus/gnome-icon-container-private.h:
	libnautilus/gnome-icon-container.h:
	libnautilus/gnome-icon-container.c:
	(icon_configure):
	(icon_position):
	(change_icon_mode):
	(gnome_icon_container_initialize):
	(gnome_icon_container_set_icon_mode):
	(gnome_icon_container_get_icon_mode):
	src/file-manager/fm-directory-view-icons.c:
	(fm_directory_view_icons_initialize):
	Got rid of icon mode, since we won't be using it.

	* libnautilus/gnome-icon-container-dnd.c:
	(get_gnome_icon_list_selection):
	Changed geometry parsing so it will not ignore extra characters
	after the numeric geometry.
	(gnome_icon_container_receive_dropped_icons):
	The code here tried to work when dragging icons between windows,
	but the implementation was actually only good within the same
	window, so I modified it to check for that case.

	* libnautilus/gnome-icon-container-dnd.c:
	(create_selection_shadow):
	(set_gnome_icon_list_selection):
	libnautilus/gnome-icon-container.c:
	(icon_position):
	Renamed GNOME_ICON_CONTAINER_ICON_XOFFSET to
	GNOME_ICON_CONTAINER_ICON_X_OFFSET and
	GNOME_ICON_CONTAINER_ICON_YOFFSET to
	GNOME_ICON_CONTAINER_ICON_Y_OFFSET. We use an underscore between
	words in identifiers.

	* libnautilus/gnome-icon-container.c:
	(destroy):
	Added code to remove timeouts and idles when the container is
	destroyed.

	* libnautilus/nautilus-directory.h:
	libnautilus/nautilus-directory.c:
	(nautilus_file_get_info):
	Get rid of the direct call to get GnomeVFSFileInfo. All info is
	accessed through individual functions.
	(nautilus_file_get_size):
	(nautilus_file_get_type):
	(nautilus_file_get_mime_type):
	(nautilus_file_is_executable):
	(nautilus_file_is_symbolic_link):
	Added new accessor functions as needed.
	src/file-manager/fm-directory-view.c:
	(display_selection_info):
	src/file-manager/fm-icon-cache.c:
	(fm_icon_cache_get_icon_set_for_file):
	(fm_icon_cache_get_icon_for_file):
	Change code to use the accessors instead of get_info.

	* libnautilus/nautilus-gtk-macros.h:
	(NAUTILUS_ASSIGN_MUST_OVERRIDE_SIGNAL):
	Changed macro to take a class pointer of the right type instead
	of taking both a casting macro name and a class pointer.
	src/file-manager/fm-directory-view.c:
	(fm_directory_view_initialize_class):
	Changed existing uses of macro to match.

	* src/file-manager/Makefile.am:
	src/file-manager/fm-icon-cache.c:
	src/file-manager/fm-default-file-icon.h:
	src/file-manager/fm-default-file-icon.c:
	Moved the default icon into its own file.
parent d12bae4b
2000-01-21 Darin Adler <darin@eazel.com>
Added a controller object that lets GnomeIconContainer
ask questions and perform actions, even though only the
FMDirectoryViewIcons knows how to answer the questions
and perform the actions.
Replaced use of nautilus_file_get_info with specific
accessors for various file info.
* libnautilus/Makefile.am:
libnautilus/nautilus-icons-controller.h:
libnautilus/nautilus-icons-controller.c:
libnautilus/gnome-icon-container-private.h:
libnautilus/gnome-icon-container.h:
libnautilus/gnome-icon-container.c:
(icon_new_pixbuf):
(gnome_icon_container_new):
(gnome_icon_container_add):
(gnome_icon_container_add_auto):
Added NautilusIconsController, an interface provided so that the
file manager can connect the icons up with the file code. This is
all so we can keep the view/controller separation. This eliminates
the need to pass around the icon name all the time, so the signals
have changed to not take the icon name as a parameter.
* src/file-manager/Makefile.am:
src/file-manager/fm-icons-controller.c:
src/file-manager/fm-icons-controller.h:
Added FMIconsController, the actual controller used by the file
manager instance of GnomeIconContainer.
src/file-manager/fm-directory-view-icons.c:
(create_icon_container):
(add_icon_if_already_positioned):
(add_icon_at_free_position):
(icon_container_activate_cb):
(fm_directory_view_icons_icon_moved_cb):
Create and use the FMIconController.
* libnautilus/gnome-icon-container-private.h:
libnautilus/gnome-icon-container-dnd.c:
(set_gnome_icon_list_selection):
(set_uri_list_selection):
libnautilus/gnome-icon-container.c:
(gnome_icon_container_set_base_uri):
src/file-manager/fm-directory-view-icons.c:
(set_up_base_uri):
(fm_directory_view_icons_begin_loading):
Get rid of the old base_uri technique for handling drags. Instead
the icon controller supplies URIs for icons when requested.
* RENAMING: Proposed that we use NautilusIconsView as the new name
for GnomeIconContainer instead of NautilusIconContainer.
* libnautilus/gnome-icon-container-private.h:
libnautilus/gnome-icon-container.h:
libnautilus/gnome-icon-container.c:
(gnome_icon_container_initialize):
(handle_icon_enter_notify):
(handle_icon_leave_notify):
Renamed browser mode to linger selection mode.
* libnautilus/gnome-icon-container-private.h:
libnautilus/gnome-icon-container.h:
libnautilus/gnome-icon-container.c:
(icon_configure):
(icon_position):
(change_icon_mode):
(gnome_icon_container_initialize):
(gnome_icon_container_set_icon_mode):
(gnome_icon_container_get_icon_mode):
src/file-manager/fm-directory-view-icons.c:
(fm_directory_view_icons_initialize):
Got rid of icon mode, since we won't be using it.
* libnautilus/gnome-icon-container-dnd.c:
(get_gnome_icon_list_selection):
Changed geometry parsing so it will not ignore extra characters
after the numeric geometry.
(gnome_icon_container_receive_dropped_icons):
The code here tried to work when dragging icons between windows,
but the implementation was actually only good within the same
window, so I modified it to check for that case.
* libnautilus/gnome-icon-container-dnd.c:
(create_selection_shadow):
(set_gnome_icon_list_selection):
libnautilus/gnome-icon-container.c:
(icon_position):
Renamed GNOME_ICON_CONTAINER_ICON_XOFFSET to
GNOME_ICON_CONTAINER_ICON_X_OFFSET and
GNOME_ICON_CONTAINER_ICON_YOFFSET to
GNOME_ICON_CONTAINER_ICON_Y_OFFSET. We use an underscore between
words in identifiers.
* libnautilus/gnome-icon-container.c:
(destroy):
Added code to remove timeouts and idles when the container is
destroyed.
* libnautilus/nautilus-directory.h:
libnautilus/nautilus-directory.c:
(nautilus_file_get_info):
Get rid of the direct call to get GnomeVFSFileInfo. All info is
accessed through individual functions.
(nautilus_file_get_size):
(nautilus_file_get_type):
(nautilus_file_get_mime_type):
(nautilus_file_is_executable):
(nautilus_file_is_symbolic_link):
Added new accessor functions as needed.
src/file-manager/fm-directory-view.c:
(display_selection_info):
src/file-manager/fm-icon-cache.c:
(fm_icon_cache_get_icon_set_for_file):
(fm_icon_cache_get_icon_for_file):
Change code to use the accessors instead of get_info.
* libnautilus/nautilus-gtk-macros.h:
(NAUTILUS_ASSIGN_MUST_OVERRIDE_SIGNAL):
Changed macro to take a class pointer of the right type instead
of taking both a casting macro name and a class pointer.
src/file-manager/fm-directory-view.c:
(fm_directory_view_initialize_class):
Changed existing uses of macro to match.
* src/file-manager/Makefile.am:
src/file-manager/fm-icon-cache.c:
src/file-manager/fm-default-file-icon.h:
src/file-manager/fm-default-file-icon.c:
Moved the default icon into its own file.
2000-01-24 John Sullivan <sullivan@eazel.com>
* libnautilus/gnome-icon-container.c:
(button_event_modifies_selection): New function, encapsulates idea
of which button events modify the selection. Formerly this was
done in several places and the answer was "those with the Control
key down". Now the answer is "those with the Control or Shift key down"
to match list view (and traditional, i.e. Mac) behavior more closely.
(button_press_event), (button_release_event), (handle_icon_button_press):
Deployed button_event_modifies_selection.
(button_release_event): Check whether modifying selection and don't
activate on single-click if so.
key down". Now the answer is "those with the Control or Shift key
down" to match list view (and traditional, i.e. Mac) behavior more
closely.
(button_press_event), (button_release_event),
(handle_icon_button_press): Deployed
button_event_modifies_selection.
(button_release_event): Check whether modifying selection and
don't activate on single-click if so.
(kbd_move_to): Just added comment.
2000-01-22 Havoc Pennington <hp@pobox.com>
* configure.in: check for libwww
......@@ -38,7 +171,6 @@
* configure.in: Look for gnomecanvaspixbuf properly (via
gnome-config)
2000-01-21 John Sullivan <sullivan@eazel.com>
* src/ntl-window.c: Move Preferences item to Edit menu, its
......@@ -80,8 +212,10 @@
* src/file-manager/fm-directory-view-list.c:
(struct _FMDirectoryViewListDetails): Add icon_size field.
(fm_directory_view_list_initialize): Initialize icon_size field.
(create_flist): Determine icon column width and row height from icon size. (add_to_flist): Change parameters to take FMDirectoryViewList instead of
GtkFList, and remove FMIconCache parameter. Now calls install_icon.
(create_flist): Determine icon column width and row height from icon size.
(add_to_flist): Change parameters to take FMDirectoryViewList
instead of GtkFList, and remove FMIconCache parameter. Now calls
install_icon.
(fm_directory_view_list_add_entry): Update add_to_flist parameters.
(install_icon): New function, gets an appropriately-sized icon for
a NautilusFile and puts it into icon column in list.
......@@ -89,13 +223,16 @@
2000-01-21 Elliot Lee <sopwith@redhat.com>
* src/ntl-window.[ch], src/ntl-window-msgs.c,
src/ntl-window-private.h: Add a specific flag to indicate reload, and make use of it.
src/ntl-window-private.h: Add a specific flag to indicate reload,
and make use of it.
* libnautilus/nautilus-directory.c: Allocate an extra byte in the
buffer, for safety's sake.
* src/ntl-window-msgs.c: Fix back/fwd buttons.
* src/ntl-window-msgs.c: Remove debugging printouts, and display error dialogs.
* src/ntl-window-msgs.c, src/ntl-window.h: Fix the bug that was causing list view to be blank.
* src/ntl-window-msgs.c: Remove debugging printouts, and display
error dialogs.
* src/ntl-window-msgs.c, src/ntl-window.h: Fix the bug that was
causing list view to be blank.
2000-01-21 Darin Adler <darin@eazel.com>
......
......@@ -2,7 +2,7 @@ We put plans for renaming in here so we can think about them for a while.
ExplorerLocationBar -> NautilusLocationBar
FMIconCache -> NautilusIconFactory
GnomeIconContainer -> NautilusIconContainer
GnomeIconContainer -> NautilusIconsView
GtkFList -> NautilusList
gdk-extensions -> nautilus-gdk-extensions
ntl* -> nautilus*
......@@ -35,6 +35,7 @@ libnautilusinclude_HEADERS= \
nautilus-directory.h \
nautilus-file-utilities.h \
nautilus-gtk-extensions.h \
nautilus-icons-controller.h \
nautilus-lib-self-check-functions.h \
nautilus-self-checks.h \
nautilus-string.h \
......@@ -54,6 +55,7 @@ libnautilus_la_SOURCES=$(nautilus_idl_sources) \
nautilus-directory.c \
nautilus-file-utilities.c \
nautilus-gtk-extensions.c \
nautilus-icons-controller.c \
nautilus-lib-self-check-functions.c \
nautilus-self-checks.c \
nautilus-string.c \
......
......@@ -33,6 +33,11 @@
#include "nautilus-background.h"
#include "nautilus-gtk-extensions.h"
#include <libgnomeui/gnome-canvas-rect-ellipse.h>
#include <string.h>
#include <stdio.h>
#include <gtk/gtksignal.h>
struct _DndSelectionItem {
......@@ -219,28 +224,25 @@ set_gnome_icon_list_selection (GnomeIconContainer *container,
data = g_string_new (NULL);
for (p = details->icons; p != NULL; p = p->next) {
GnomeIconContainerIcon *icon;
gchar *s;
gint x, y;
char *uri;
char *s;
int x, y;
icon = p->data;
if (! icon->is_selected)
if (!icon->is_selected)
continue;
x = (gint) (icon->x - x_offset);
y = (gint) (icon->y - y_offset);
x += (GNOME_ICON_CONTAINER_ICON_XOFFSET (container)
x += (GNOME_ICON_CONTAINER_ICON_X_OFFSET (container)
- GNOME_ICON_CONTAINER_ICON_WIDTH (container) / 2);
y += (GNOME_ICON_CONTAINER_ICON_YOFFSET (container)
y += (GNOME_ICON_CONTAINER_ICON_Y_OFFSET (container)
- GNOME_ICON_CONTAINER_ICON_HEIGHT (container) / 2);
if (details->base_uri != NULL)
s = g_strdup_printf ("%s/%s\r%d:%d\r\n",
details->base_uri, icon->text,
x, y);
else
s = g_strdup_printf ("%s\r%d:%d\r\n",
icon->text, x, y);
uri = nautilus_icons_controller_get_icon_uri (details->controller, icon->data);
s = g_strdup_printf ("%s\r%d:%d\r\n", uri, x, y);
g_free (uri);
g_string_append (data, s);
g_free (s);
......@@ -278,12 +280,13 @@ set_uri_list_selection (GnomeIconContainer *container,
GnomeIconContainerIcon *icon;
icon = p->data;
if (! icon->is_selected)
if (!icon->is_selected)
continue;
temp_data = g_strdup_printf ("%s/%s\r\n", details->base_uri, icon->text);
g_string_append(data, temp_data);
g_free(temp_data);
temp_data = nautilus_icons_controller_get_icon_uri (details->controller, icon->data);
g_string_append (data, temp_data);
g_string_append (data, "\r\n");
g_free (temp_data);
}
gtk_selection_data_set (selection_data,
......@@ -381,7 +384,7 @@ get_gnome_icon_list_selection (GnomeIconContainer *container,
/* 2: Decode geometry information. */
if (sscanf (p, "%d:%d", &item->x, &item->y) != 2)
if (sscanf (p, "%d:%d%*s", &item->x, &item->y) != 2)
g_warning ("Invalid special/x-gnome-icon-list data received: "
"invalid geometry specification.");
......@@ -534,35 +537,17 @@ drag_end_cb (GtkWidget *widget,
dnd_info->selection_list = NULL;
}
/* utility routine to extract the directory from an item_uri (which may have geometry info attached) */
static gchar*
extract_directory(const gchar* item_uri)
{
gchar *last_slash;
gchar *temp_str = strdup(item_uri);
gchar *geom_ptr = strchr(temp_str, '\r');
/* strip geometry info if present */
if (geom_ptr) {
*geom_ptr = '\0';
}
last_slash = strrchr(temp_str, '/');
if (last_slash)
*last_slash = '\0';
return temp_str;
}
/* Utility routine to extract the directory from an item_uri
(which may have geometry info attached).
*/
static void
gnome_icon_container_receive_dropped_icons (GnomeIconContainer *container,
GdkDragContext *context,
int x, int y)
GdkDragContext *context,
int x, int y)
{
GnomeIconContainerDndInfo *dnd_info;
DndSelectionItem *item;
char *item_directory_uri;
dnd_info = container->details->dnd_info;
......@@ -570,28 +555,38 @@ gnome_icon_container_receive_dropped_icons (GnomeIconContainer *container,
return;
item = dnd_info->selection_list->data;
item_directory_uri = extract_directory(item->uri);
if (strcmp(item_directory_uri, container->details->base_uri) != 0) {
g_warning ("not implemented: drop from other directory: %s", item_directory_uri);
} else {
/* copy files in same directory */
/* Move files in same window.
FIXME: This won't work between windows for two reasons.
First, we have to figure out whether we need to actually
move or copy some files. For directory views this is based
on the URIs, but that should be done by the controller, not
here in the view.
Second, the start_x and start_y values are only good for
this window. To make dragging between multiple windows work,
we need to communicate the offset between the mouse and the
corner of the selection along with the other selection info
so we can position the icons correctly in the window they
are dropped in. The geometry that's currently included along
with the selection is not sufficient.
*/
if (context->source_window != context->dest_window)
g_warning ("moving files between windows is not yet implemented");
if (context->action == GDK_ACTION_MOVE) {
double world_x, world_y;
if (context->action == GDK_ACTION_MOVE) {
double world_x, world_y;
gnome_canvas_window_to_world (GNOME_CANVAS (container),
x, y, &world_x, &world_y);
gnome_icon_container_xlate_selected (container,
world_x - dnd_info->start_x,
world_y - dnd_info->start_y,
TRUE);
}
gnome_canvas_window_to_world (GNOME_CANVAS (container),
x, y, &world_x, &world_y);
gnome_icon_container_xlate_selected (container,
world_x - dnd_info->start_x,
world_y - dnd_info->start_y,
TRUE);
}
g_free(item_directory_uri);
destroy_selection_list (dnd_info->selection_list);
dnd_info->selection_list = NULL;
}
......@@ -749,7 +744,7 @@ gnome_icon_container_dnd_begin_drag (GnomeIconContainer *container,
dnd_info = container->details->dnd_info;
g_return_if_fail (dnd_info != NULL);
/* Notice that the event is already in world coordinates, because of
the way the canvas handles events! */
dnd_info->start_x = event->x;
......
......@@ -28,6 +28,8 @@
#include "gnome-icon-container.h"
#include <gtk/gtkdnd.h>
typedef struct _GnomeIconContainerDndInfo GnomeIconContainerDndInfo;
typedef enum _GnomeIconContainerDndTargetType GnomeIconContainerDndTargetType;
......
......@@ -2,6 +2,7 @@
/* gnome-icon-container-private.h
Copyright (C) 1999, 2000 Free Software Foundation
Copyright (C) 2000 Eazel, Inc.
The Gnome Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
......@@ -26,6 +27,7 @@
#include "gnome-icon-container.h"
#include "gnome-icon-container-dnd.h"
#include <libgnomeui/gnome-icon-item.h>
/* An Icon. */
......@@ -62,7 +64,7 @@ struct _GnomeIconContainerIcon {
/* Whether this item was selected before rubberbanding. */
gboolean was_selected_before_rubberband : 1;
gpointer data;
NautilusControllerIcon *data;
};
typedef struct _GnomeIconContainerIcon GnomeIconContainerIcon;
......@@ -107,25 +109,19 @@ struct _GnomeIconContainerRubberbandInfo {
typedef struct _GnomeIconContainerRubberbandInfo GnomeIconContainerRubberbandInfo;
struct _GnomeIconContainerDetails {
/* Base URI for Drag & Drop. */
gchar *base_uri;
NautilusIconsController *controller;
/* linger selection mode setting. */
gboolean linger_selection_mode : 1;
/* Browser mode setting. */
gboolean browser_mode : 1;
/* single-click mode setting */
gboolean single_click_mode : 1;
/* Current icon mode (index into `icon_mode_info[]' -- see
`gnome-icon-container.c'). */
GnomeIconContainerIconMode icon_mode;
/* Size of the container. */
guint width, height;
/* List of icons. */
GList *icons;
/* Total number of icons. */
guint num_icons;
/* The grid. */
......@@ -142,19 +138,19 @@ struct _GnomeIconContainerDetails {
/* Current icon for keyboard navigation. */
GnomeIconContainerIcon *kbd_current;
/* Rubberbanding status. */
/* Rubberbanding status. */
GnomeIconContainerRubberbandInfo rubberband_info;
/* Timeout used to make a selected icon fully visible after a short
period of time. (The timeout is needed to make sure
double-clicking still works.) */
gint kbd_icon_visibility_timer_tag;
int kbd_icon_visibility_timer_tag;
/* the time the mouse button went down in milliseconds */
guint32 button_down_time;
/* Position of the pointer during the last click. */
gint drag_x, drag_y;
int drag_x, drag_y;
/* Button currently pressed, possibly for dragging. */
guint drag_button;
......@@ -166,58 +162,35 @@ struct _GnomeIconContainerDetails {
gboolean doing_drag;
/* Drag offset. */
gint drag_x_offset, drag_y_offset;
int drag_x_offset, drag_y_offset;
/* Idle ID. */
guint idle_id;
/* Timeout for selection in browser mode. */
gint browser_mode_selection_timer_tag;
int linger_selection_mode_timer_tag;
/* Icon to be selected at timeout in browser mode. */
GnomeIconContainerIcon *browser_mode_selection_icon;
GnomeIconContainerIcon *linger_selection_mode_icon;
/* DnD info. */
GnomeIconContainerDndInfo *dnd_info;
};
/* Definition of the available icon container modes. */
struct _GnomeIconContainerIconModeInfo {
guint icon_width;
guint icon_height;
guint cell_width;
guint cell_height;
guint cell_spacing;
guint icon_xoffset;
guint icon_yoffset;
};
typedef struct _GnomeIconContainerIconModeInfo GnomeIconContainerIconModeInfo;
extern GnomeIconContainerIconModeInfo gnome_icon_container_icon_mode_info[];
#define GNOME_ICON_CONTAINER_ICON_WIDTH(container) \
gnome_icon_container_icon_mode_info[container->details->icon_mode].icon_width
#define GNOME_ICON_CONTAINER_ICON_HEIGHT(container) \
gnome_icon_container_icon_mode_info[container->details->icon_mode].icon_height
#define GNOME_ICON_CONTAINER_CELL_WIDTH(container) \
gnome_icon_container_icon_mode_info[container->details->icon_mode].cell_width
/* Layout and icon size constants.
These will change based on the zoom level eventually, so they
should probably become function calls instead of macros.
*/
#define GNOME_ICON_CONTAINER_CELL_HEIGHT(container) \
gnome_icon_container_icon_mode_info[container->details->icon_mode].cell_height
#define GNOME_ICON_CONTAINER_CELL_WIDTH(container) 80
#define GNOME_ICON_CONTAINER_CELL_HEIGHT(container) 80
#define GNOME_ICON_CONTAINER_CELL_SPACING(container) \
gnome_icon_container_icon_mode_info[container->details->icon_mode].cell_spacing
#define GNOME_ICON_CONTAINER_CELL_SPACING(container) 4
#define GNOME_ICON_CONTAINER_ICON_XOFFSET(container) \
gnome_icon_container_icon_mode_info[container->details->icon_mode].icon_xoffset
#define GNOME_ICON_CONTAINER_ICON_X_OFFSET(container) 12
#define GNOME_ICON_CONTAINER_ICON_Y_OFFSET(container) 28
#define GNOME_ICON_CONTAINER_ICON_YOFFSET(container) \
gnome_icon_container_icon_mode_info[container->details->icon_mode].icon_yoffset
#define GNOME_ICON_CONTAINER_ICON_WIDTH(container) 48
#define GNOME_ICON_CONTAINER_ICON_HEIGHT(container) 48
#endif /* GNOME_ICON_CONTAINER_PRIVATE_H */
......@@ -31,6 +31,10 @@
#include "gnome-icon-container-private.h"
#include "gnome-icon-container-dnd.h"
#include <gdk/gdkkeysyms.h>
#include <gtk/gtksignal.h>
#include <gtk/gtkmain.h>
#include <libgnomeui/gnome-canvas-rect-ellipse.h>
#include <gdk-pixbuf/gnome-canvas-pixbuf.h>
#include "nautilus-gtk-macros.h"
......@@ -43,9 +47,10 @@
but there is no way to access its value from outside. */
#define KBD_ICON_VISIBILITY_TIMEOUT 300
/* Timeout for selecting an icon in "browser mode" (i.e. by just placing the
pointer over the icon, without pressing any button). */
#define BROWSER_MODE_SELECTION_TIMEOUT 800
/* Timeout for selecting an icon in "linger-select" mode (i.e. by just placing the
pointer over the icon, without pressing any button).
*/
#define LINGER_SELECTION_MODE_TIMEOUT 800
/* maximum amount of milliseconds the mouse button is allowed to stay down and still be considered a click */
#define MAX_CLICK_TIME 1500
......@@ -56,17 +61,7 @@ static void gnome_icon_container_initialize (GnomeIconContainer *container);
NAUTILUS_DEFINE_CLASS_BOILERPLATE (GnomeIconContainer, gnome_icon_container, GNOME_TYPE_CANVAS)
/* WARNING: Keep this in sync with the `GnomeIconContainerIconMode' enum in
`gnome-icon-container.h'. */
GnomeIconContainerIconModeInfo gnome_icon_container_icon_mode_info[] = {
{ 48, 48, 80, 80, 4, 12, 28 }, /* GNOME_ICON_CONTAINER_NORMAL_ICONS */
{ 24, 24, 100, 40, 4, 16, 16 } /* GNOME_ICON_CONTAINER_SMALL_ICONS */
};
#define NUM_ICON_MODES (sizeof (gnome_icon_container_icon_mode_info) \
/ sizeof (*gnome_icon_container_icon_mode_info))
/* The GnomeIconContainer signals. */
enum _GnomeIconContainerSignalNumber {
SELECTION_CHANGED,
......@@ -97,36 +92,16 @@ static void
icon_configure (GnomeIconContainerIcon *icon,
GnomeIconContainer *container)
{
switch (container->details->icon_mode) {
case GNOME_ICON_CONTAINER_NORMAL_ICONS:
gnome_icon_text_item_configure
(icon->text_item,
GNOME_ICON_CONTAINER_CELL_SPACING (container),
GNOME_ICON_CONTAINER_ICON_HEIGHT (container),
(GNOME_ICON_CONTAINER_CELL_WIDTH (container)
- 2 * GNOME_ICON_CONTAINER_CELL_SPACING (container)),
NULL,
icon->text,
TRUE,
TRUE);
break;
case GNOME_ICON_CONTAINER_SMALL_ICONS:
gnome_icon_text_item_configure
(icon->text_item,
(GNOME_ICON_CONTAINER_ICON_WIDTH (container)
+ GNOME_ICON_CONTAINER_CELL_SPACING (container)),
GNOME_ICON_CONTAINER_CELL_HEIGHT (container) / 2,
(GNOME_ICON_CONTAINER_CELL_WIDTH (container)
- 2 * GNOME_ICON_CONTAINER_CELL_SPACING (container)
- GNOME_ICON_CONTAINER_ICON_WIDTH (container)),
NULL,
icon->text,