Commit 6b72c37f authored by Darin Adler's avatar Darin Adler

Removed bogus warning. Need to do some more work to get dragging working

	* gnome-icon-container-dnd.c:
	(gnome_icon_container_receive_dropped_icons):
	Removed bogus warning. Need to do some more work to get
	dragging working with multiple windows, but there's no
	easy way to detect that case, so just let it go.

	* fm-directory-view-icons.c:
	(icon_container_context_click_icon_cb):
	(icon_container_context_click_background_cb):
	Fixed the callbacks to match the new interface without the
	icon name. I missed this in my check-in earlier today.
parent c428ff2c
2000-01-24 Darin Adler <darin@eazel.com>
* gnome-icon-container-dnd.c:
(gnome_icon_container_receive_dropped_icons):
Removed bogus warning. Need to do some more work to get
dragging working with multiple windows, but there's no
easy way to detect that case, so just let it go.
* fm-directory-view-icons.c:
(icon_container_context_click_icon_cb):
(icon_container_context_click_background_cb):
Fixed the callbacks to match the new interface without the
icon name. I missed this in my check-in earlier today.
2000-01-24 John Sullivan <sullivan@eazel.com>
Added sort indicators to list view column titles
......
......@@ -41,8 +41,8 @@
struct _DndSelectionItem {
gchar *uri;
gint x, y;
char *uri;
int x, y;
};
typedef struct _DndSelectionItem DndSelectionItem;
......@@ -71,11 +71,11 @@ create_selection_shadow (GnomeIconContainer *container,
GnomeCanvasGroup *group;
GnomeCanvas *canvas;
GdkBitmap *stipple;
gint max_x, max_y;
gint min_x, min_y;
gint icon_width, icon_height;
gint cell_width, cell_height;
gint x_offset;
int max_x, max_y;
int min_x, min_y;
int icon_width, icon_height;
int cell_width;
int x_offset;
GList *p;
if (list == NULL)
......@@ -87,7 +87,6 @@ create_selection_shadow (GnomeIconContainer *container,
icon_width = GNOME_ICON_CONTAINER_ICON_WIDTH (container);
icon_height = GNOME_ICON_CONTAINER_ICON_HEIGHT (container);
cell_width = GNOME_ICON_CONTAINER_CELL_WIDTH (container);
cell_height = GNOME_ICON_CONTAINER_CELL_HEIGHT (container);
x_offset = cell_width - icon_width - SHADOW_MARGIN;
canvas = GNOME_CANVAS (container);
......@@ -111,8 +110,8 @@ create_selection_shadow (GnomeIconContainer *container,
for (p = list; p != NULL; p = p->next) {
DndSelectionItem *item;
gint x1, y1;
gint x2, y2;
int x1, y1;
int x2, y2;
item = p->data;
......@@ -192,7 +191,7 @@ destroy_selection_list (GList *list)
return;
for (p = list; p != NULL; p = p->next)
dnd_selection_item_destroy ((DndSelectionItem *) p->data);
dnd_selection_item_destroy (p->data);
g_list_free (list);
}
......@@ -210,16 +209,8 @@ set_gnome_icon_list_selection (GnomeIconContainer *container,
gdouble x_offset, y_offset;
details = container->details;
if (details->icons == NULL) {
/* FIXME? Actually this probably shouldn't happen. */
gtk_selection_data_set (selection_data,
selection_data->target,
8, NULL, 0);
return;
}
x_offset = container->details->dnd_info->start_x;
y_offset = container->details->dnd_info->start_y;
x_offset = details->dnd_info->start_x;
y_offset = details->dnd_info->start_y;
data = g_string_new (NULL);
for (p = details->icons; p != NULL; p = p->next) {
......@@ -232,13 +223,13 @@ set_gnome_icon_list_selection (GnomeIconContainer *container,
if (!icon->is_selected)
continue;
x = (gint) (icon->x - x_offset);
y = (gint) (icon->y - y_offset);
x = icon->x - x_offset;
y = icon->y - y_offset;
x += (GNOME_ICON_CONTAINER_ICON_X_OFFSET (container)
- GNOME_ICON_CONTAINER_ICON_WIDTH (container) / 2);
y += (GNOME_ICON_CONTAINER_ICON_Y_OFFSET (container)
- GNOME_ICON_CONTAINER_ICON_HEIGHT (container) / 2);
x += GNOME_ICON_CONTAINER_ICON_X_OFFSET (container)
- GNOME_ICON_CONTAINER_ICON_WIDTH (container) / 2;
y += GNOME_ICON_CONTAINER_ICON_Y_OFFSET (container)
- GNOME_ICON_CONTAINER_ICON_HEIGHT (container) / 2;
uri = nautilus_icons_controller_get_icon_uri (details->controller, icon->data);
s = g_strdup_printf ("%s\r%d:%d\r\n", uri, x, y);
......@@ -262,17 +253,10 @@ set_uri_list_selection (GnomeIconContainer *container,
{
GnomeIconContainerDetails *details;
GList *p;
gchar *temp_data;
char *uri;
GString *data;
details = container->details;
if (details->icons == NULL) {
/* FIXME? Actually this probably shouldn't happen. */
gtk_selection_data_set (selection_data,
selection_data->target,
8, NULL, 0);
return;
}
data = g_string_new (NULL);
......@@ -283,10 +267,11 @@ set_uri_list_selection (GnomeIconContainer *container,
if (!icon->is_selected)
continue;
temp_data = nautilus_icons_controller_get_icon_uri (details->controller, icon->data);
g_string_append (data, temp_data);
uri = nautilus_icons_controller_get_icon_uri (details->controller, icon->data);
g_string_append (data, uri);
g_free (uri);
g_string_append (data, "\r\n");
g_free (temp_data);
}
gtk_selection_data_set (selection_data,
......@@ -547,15 +532,11 @@ gnome_icon_container_receive_dropped_icons (GnomeIconContainer *container,
int x, int y)
{
GnomeIconContainerDndInfo *dnd_info;
DndSelectionItem *item;
dnd_info = container->details->dnd_info;
if (dnd_info->selection_list == NULL)
return;
item = dnd_info->selection_list->data;
/* Move files in same window.
FIXME: This won't work between windows for two reasons.
......@@ -573,8 +554,6 @@ gnome_icon_container_receive_dropped_icons (GnomeIconContainer *container,
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;
......
......@@ -41,8 +41,8 @@
struct _DndSelectionItem {
gchar *uri;
gint x, y;
char *uri;
int x, y;
};
typedef struct _DndSelectionItem DndSelectionItem;
......@@ -71,11 +71,11 @@ create_selection_shadow (GnomeIconContainer *container,
GnomeCanvasGroup *group;
GnomeCanvas *canvas;
GdkBitmap *stipple;
gint max_x, max_y;
gint min_x, min_y;
gint icon_width, icon_height;
gint cell_width, cell_height;
gint x_offset;
int max_x, max_y;
int min_x, min_y;
int icon_width, icon_height;
int cell_width;
int x_offset;
GList *p;
if (list == NULL)
......@@ -87,7 +87,6 @@ create_selection_shadow (GnomeIconContainer *container,
icon_width = GNOME_ICON_CONTAINER_ICON_WIDTH (container);
icon_height = GNOME_ICON_CONTAINER_ICON_HEIGHT (container);
cell_width = GNOME_ICON_CONTAINER_CELL_WIDTH (container);
cell_height = GNOME_ICON_CONTAINER_CELL_HEIGHT (container);
x_offset = cell_width - icon_width - SHADOW_MARGIN;
canvas = GNOME_CANVAS (container);
......@@ -111,8 +110,8 @@ create_selection_shadow (GnomeIconContainer *container,
for (p = list; p != NULL; p = p->next) {
DndSelectionItem *item;
gint x1, y1;
gint x2, y2;
int x1, y1;
int x2, y2;
item = p->data;
......@@ -192,7 +191,7 @@ destroy_selection_list (GList *list)
return;
for (p = list; p != NULL; p = p->next)
dnd_selection_item_destroy ((DndSelectionItem *) p->data);
dnd_selection_item_destroy (p->data);
g_list_free (list);
}
......@@ -210,16 +209,8 @@ set_gnome_icon_list_selection (GnomeIconContainer *container,
gdouble x_offset, y_offset;
details = container->details;
if (details->icons == NULL) {
/* FIXME? Actually this probably shouldn't happen. */
gtk_selection_data_set (selection_data,
selection_data->target,
8, NULL, 0);
return;
}
x_offset = container->details->dnd_info->start_x;
y_offset = container->details->dnd_info->start_y;
x_offset = details->dnd_info->start_x;
y_offset = details->dnd_info->start_y;
data = g_string_new (NULL);
for (p = details->icons; p != NULL; p = p->next) {
......@@ -232,13 +223,13 @@ set_gnome_icon_list_selection (GnomeIconContainer *container,
if (!icon->is_selected)
continue;
x = (gint) (icon->x - x_offset);
y = (gint) (icon->y - y_offset);
x = icon->x - x_offset;
y = icon->y - y_offset;
x += (GNOME_ICON_CONTAINER_ICON_X_OFFSET (container)
- GNOME_ICON_CONTAINER_ICON_WIDTH (container) / 2);
y += (GNOME_ICON_CONTAINER_ICON_Y_OFFSET (container)
- GNOME_ICON_CONTAINER_ICON_HEIGHT (container) / 2);
x += GNOME_ICON_CONTAINER_ICON_X_OFFSET (container)
- GNOME_ICON_CONTAINER_ICON_WIDTH (container) / 2;
y += GNOME_ICON_CONTAINER_ICON_Y_OFFSET (container)
- GNOME_ICON_CONTAINER_ICON_HEIGHT (container) / 2;
uri = nautilus_icons_controller_get_icon_uri (details->controller, icon->data);
s = g_strdup_printf ("%s\r%d:%d\r\n", uri, x, y);
......@@ -262,17 +253,10 @@ set_uri_list_selection (GnomeIconContainer *container,
{
GnomeIconContainerDetails *details;
GList *p;
gchar *temp_data;
char *uri;
GString *data;
details = container->details;
if (details->icons == NULL) {
/* FIXME? Actually this probably shouldn't happen. */
gtk_selection_data_set (selection_data,
selection_data->target,
8, NULL, 0);
return;
}
data = g_string_new (NULL);
......@@ -283,10 +267,11 @@ set_uri_list_selection (GnomeIconContainer *container,
if (!icon->is_selected)
continue;
temp_data = nautilus_icons_controller_get_icon_uri (details->controller, icon->data);
g_string_append (data, temp_data);
uri = nautilus_icons_controller_get_icon_uri (details->controller, icon->data);
g_string_append (data, uri);
g_free (uri);
g_string_append (data, "\r\n");
g_free (temp_data);
}
gtk_selection_data_set (selection_data,
......@@ -547,15 +532,11 @@ gnome_icon_container_receive_dropped_icons (GnomeIconContainer *container,
int x, int y)
{
GnomeIconContainerDndInfo *dnd_info;
DndSelectionItem *item;
dnd_info = container->details->dnd_info;
if (dnd_info->selection_list == NULL)
return;
item = dnd_info->selection_list->data;
/* Move files in same window.
FIXME: This won't work between windows for two reasons.
......@@ -573,8 +554,6 @@ gnome_icon_container_receive_dropped_icons (GnomeIconContainer *container,
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;
......
......@@ -41,8 +41,8 @@
struct _DndSelectionItem {
gchar *uri;
gint x, y;
char *uri;
int x, y;
};
typedef struct _DndSelectionItem DndSelectionItem;
......@@ -71,11 +71,11 @@ create_selection_shadow (GnomeIconContainer *container,
GnomeCanvasGroup *group;
GnomeCanvas *canvas;
GdkBitmap *stipple;
gint max_x, max_y;
gint min_x, min_y;
gint icon_width, icon_height;
gint cell_width, cell_height;
gint x_offset;
int max_x, max_y;
int min_x, min_y;
int icon_width, icon_height;
int cell_width;
int x_offset;
GList *p;
if (list == NULL)
......@@ -87,7 +87,6 @@ create_selection_shadow (GnomeIconContainer *container,
icon_width = GNOME_ICON_CONTAINER_ICON_WIDTH (container);
icon_height = GNOME_ICON_CONTAINER_ICON_HEIGHT (container);
cell_width = GNOME_ICON_CONTAINER_CELL_WIDTH (container);
cell_height = GNOME_ICON_CONTAINER_CELL_HEIGHT (container);
x_offset = cell_width - icon_width - SHADOW_MARGIN;
canvas = GNOME_CANVAS (container);
......@@ -111,8 +110,8 @@ create_selection_shadow (GnomeIconContainer *container,
for (p = list; p != NULL; p = p->next) {
DndSelectionItem *item;
gint x1, y1;
gint x2, y2;
int x1, y1;
int x2, y2;
item = p->data;
......@@ -192,7 +191,7 @@ destroy_selection_list (GList *list)
return;
for (p = list; p != NULL; p = p->next)
dnd_selection_item_destroy ((DndSelectionItem *) p->data);
dnd_selection_item_destroy (p->data);
g_list_free (list);
}
......@@ -210,16 +209,8 @@ set_gnome_icon_list_selection (GnomeIconContainer *container,
gdouble x_offset, y_offset;
details = container->details;
if (details->icons == NULL) {
/* FIXME? Actually this probably shouldn't happen. */
gtk_selection_data_set (selection_data,
selection_data->target,
8, NULL, 0);
return;
}
x_offset = container->details->dnd_info->start_x;
y_offset = container->details->dnd_info->start_y;
x_offset = details->dnd_info->start_x;
y_offset = details->dnd_info->start_y;
data = g_string_new (NULL);
for (p = details->icons; p != NULL; p = p->next) {
......@@ -232,13 +223,13 @@ set_gnome_icon_list_selection (GnomeIconContainer *container,
if (!icon->is_selected)
continue;
x = (gint) (icon->x - x_offset);
y = (gint) (icon->y - y_offset);
x = icon->x - x_offset;
y = icon->y - y_offset;
x += (GNOME_ICON_CONTAINER_ICON_X_OFFSET (container)
- GNOME_ICON_CONTAINER_ICON_WIDTH (container) / 2);
y += (GNOME_ICON_CONTAINER_ICON_Y_OFFSET (container)
- GNOME_ICON_CONTAINER_ICON_HEIGHT (container) / 2);
x += GNOME_ICON_CONTAINER_ICON_X_OFFSET (container)
- GNOME_ICON_CONTAINER_ICON_WIDTH (container) / 2;
y += GNOME_ICON_CONTAINER_ICON_Y_OFFSET (container)
- GNOME_ICON_CONTAINER_ICON_HEIGHT (container) / 2;
uri = nautilus_icons_controller_get_icon_uri (details->controller, icon->data);
s = g_strdup_printf ("%s\r%d:%d\r\n", uri, x, y);
......@@ -262,17 +253,10 @@ set_uri_list_selection (GnomeIconContainer *container,
{
GnomeIconContainerDetails *details;
GList *p;
gchar *temp_data;
char *uri;
GString *data;
details = container->details;
if (details->icons == NULL) {
/* FIXME? Actually this probably shouldn't happen. */
gtk_selection_data_set (selection_data,
selection_data->target,
8, NULL, 0);
return;
}
data = g_string_new (NULL);
......@@ -283,10 +267,11 @@ set_uri_list_selection (GnomeIconContainer *container,
if (!icon->is_selected)
continue;
temp_data = nautilus_icons_controller_get_icon_uri (details->controller, icon->data);
g_string_append (data, temp_data);
uri = nautilus_icons_controller_get_icon_uri (details->controller, icon->data);
g_string_append (data, uri);
g_free (uri);
g_string_append (data, "\r\n");
g_free (temp_data);
}
gtk_selection_data_set (selection_data,
......@@ -547,15 +532,11 @@ gnome_icon_container_receive_dropped_icons (GnomeIconContainer *container,
int x, int y)
{
GnomeIconContainerDndInfo *dnd_info;
DndSelectionItem *item;
dnd_info = container->details->dnd_info;
if (dnd_info->selection_list == NULL)
return;
item = dnd_info->selection_list->data;
/* Move files in same window.
FIXME: This won't work between windows for two reasons.
......@@ -573,8 +554,6 @@ gnome_icon_container_receive_dropped_icons (GnomeIconContainer *container,
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;
......
......@@ -48,10 +48,9 @@ static void add_icon_at_free_position (FMDirectoryViewIcons *icon_view,
NautilusFile *file);
static void add_icon_if_already_positioned (FMDirectoryViewIcons *icon_view,
NautilusFile *file);
static GtkMenu *create_background_context_menu (FMDirectoryViewIcons *directory_view_icons);
static GtkMenu *create_item_context_menu (FMDirectoryViewIcons *directory_view_icons,
const gchar *name,
gpointer entry_data);
static GtkMenu *create_background_context_menu (FMDirectoryViewIcons *icon_view);
static GtkMenu *create_item_context_menu (FMDirectoryViewIcons *icon_view,
NautilusFile *file);
static GnomeIconContainer *create_icon_container (FMDirectoryViewIcons *icon_view);
static void display_icons_not_already_positioned (FMDirectoryViewIcons *icon_view);
static void fm_directory_view_icons_icon_moved_cb (GnomeIconContainer *container,
......@@ -80,11 +79,10 @@ static void icon_container_selection_changed_cb (GnomeIconContainer *container,
FMDirectoryViewIcons *icon_view);
static void icon_container_context_click_icon_cb (GnomeIconContainer *container,
const gchar *name,
gpointer icon_data,
gpointer data);
NautilusFile *icon_data,
FMDirectoryViewIcons *icon_view);
static void icon_container_context_click_background_cb (GnomeIconContainer *container,
gpointer data);
FMDirectoryViewIcons *icon_view);
NAUTILUS_DEFINE_CLASS_BOILERPLATE (FMDirectoryViewIcons, fm_directory_view_icons, FM_TYPE_DIRECTORY_VIEW);
......@@ -122,18 +120,18 @@ fm_directory_view_icons_initialize_class (FMDirectoryViewIconsClass *klass)
}
static void
fm_directory_view_icons_initialize (FMDirectoryViewIcons *directory_view_icons)
fm_directory_view_icons_initialize (FMDirectoryViewIcons *icon_view)
{
GnomeIconContainer *icon_container;
g_return_if_fail (GTK_BIN (directory_view_icons)->child == NULL);
g_return_if_fail (GTK_BIN (icon_view)->child == NULL);
directory_view_icons->details = g_new0 (FMDirectoryViewIconsDetails, 1);
icon_view->details = g_new0 (FMDirectoryViewIconsDetails, 1);
directory_view_icons->details->background_context_menu =
create_background_context_menu (directory_view_icons);
icon_view->details->background_context_menu =
create_background_context_menu (icon_view);
icon_container = create_icon_container (directory_view_icons);
icon_container = create_icon_container (icon_view);
}
static void
......@@ -151,55 +149,53 @@ fm_directory_view_icons_destroy (GtkObject *object)
static GtkMenu *
create_background_context_menu (FMDirectoryViewIcons *directory_view_icons)
create_background_context_menu (FMDirectoryViewIcons *icon_view)
{
GtkWidget *menu;
GtkMenu *menu;
GtkWidget *menu_item;
menu = gtk_menu_new();
menu = GTK_MENU (gtk_menu_new ());
menu_item = gtk_menu_item_new_with_label ("Select all");
gtk_widget_set_sensitive (menu_item, FALSE);
gtk_widget_show (menu_item);
gtk_menu_append (GTK_MENU(menu), menu_item);
gtk_menu_append (menu, menu_item);
menu_item = gtk_menu_item_new_with_label ("Zoom in");
gtk_widget_set_sensitive (menu_item, FALSE);
gtk_widget_show (menu_item);
gtk_menu_append (GTK_MENU(menu), menu_item);
gtk_menu_append (menu, menu_item);
menu_item = gtk_menu_item_new_with_label ("Zoom out");
gtk_widget_set_sensitive (menu_item, FALSE);
gtk_widget_show (menu_item);
gtk_menu_append (GTK_MENU(menu), menu_item);
gtk_menu_append (menu, menu_item);
return GTK_MENU(menu);
return menu;
}
static GtkMenu *
create_item_context_menu (FMDirectoryViewIcons *directory_view_icons,
const gchar *name,
gpointer entry_data)
create_item_context_menu (FMDirectoryViewIcons *icon_view,
NautilusFile *file)
{
GtkWidget *menu;
GtkMenu *menu;
GtkWidget *menu_item;
menu = gtk_menu_new();
menu = GTK_MENU (gtk_menu_new ());
menu_item = gtk_menu_item_new_with_label ("Open");
gtk_widget_set_sensitive (menu_item, FALSE);
gtk_widget_show (menu_item);
gtk_menu_append (GTK_MENU(menu), menu_item);
gtk_menu_append (menu, menu_item);
menu_item = gtk_menu_item_new_with_label ("Delete");
gtk_widget_set_sensitive (menu_item, FALSE);
gtk_widget_show (menu_item);
gtk_menu_append (GTK_MENU(menu), menu_item);
gtk_menu_append (menu, menu_item);
return GTK_MENU(menu);
return menu;
}
static GnomeIconContainer *
create_icon_container (FMDirectoryViewIcons *icon_view)
{
......@@ -399,33 +395,23 @@ popup_context_menu (GtkMenu *menu)
static void
icon_container_context_click_icon_cb (GnomeIconContainer *container,
const gchar *name,
gpointer entry_data,
gpointer data)
NautilusFile *file,
FMDirectoryViewIcons *icon_view)
{
FMDirectoryViewIcons *icon_view;
GtkMenu *menu;
icon_view = FM_DIRECTORY_VIEW_ICONS(data);
menu = create_item_context_menu(icon_view, name, entry_data);
g_assert (FM_IS_DIRECTORY_VIEW_ICONS (icon_view));
popup_context_menu (menu);
popup_context_menu (create_item_context_menu (icon_view, file));
}
static void
icon_container_context_click_background_cb (GnomeIconContainer *container