Commit d0ad9778 authored by Jiri (George) Lebl's avatar Jiri (George) Lebl Committed by George Lebl

Darin <darin@eazel.com> said that while this patch causes fungal growth

Tue Mar 06 12:24:24 2001  George Lebl <jirka@5z.com>

	Darin <darin@eazel.com> said that while this patch causes fungal
	growth between the toes, it is ok to apply.

	* components/tree/nautilus-tree-view-dnd.c (do_get_data)
	  (nautilus_tree_view_drag_drop)
	  (nautilus_tree_view_ensure_drag_data)
	  libnautilus-extensions/nautilus-icon-dnd.c (do_get_data)
	  (nautilus_icon_container_ensure_drag_data)
	  (drag_drop_callback)
	  libnautilus-extensions/nautilus-list.c (do_get_data)
	  (nautilus_list_ensure_drag_data)
	  (nautilus_list_drag_drop):
	  When doing gtk_drag_get_data, first find a target we support rather
	  then just grabbing the first one.  We need to make a target list
	  and do some gtk voodoo.  At some later date, this should be more
	  generalized and stuffed somewhere in libnautilus-extentions.
	  Fixes #7312

	* libnautilus-extensions/nautilus-file-operations.c
	  (parse_previous_duplicate_name):  s/strdup/g_strdup/ as the
	  string will be later g_free'd
	  Fixes #7440
parent f590eb52
Tue Mar 06 12:24:24 2001 George Lebl <jirka@5z.com>
Darin <darin@eazel.com> said that while this patch causes fungal
growth between the toes, it is ok to apply.
* components/tree/nautilus-tree-view-dnd.c (do_get_data)
(nautilus_tree_view_drag_drop)
(nautilus_tree_view_ensure_drag_data)
libnautilus-extensions/nautilus-icon-dnd.c (do_get_data)
(nautilus_icon_container_ensure_drag_data)
(drag_drop_callback)
libnautilus-extensions/nautilus-list.c (do_get_data)
(nautilus_list_ensure_drag_data)
(nautilus_list_drag_drop):
When doing gtk_drag_get_data, first find a target we support rather
then just grabbing the first one. We need to make a target list
and do some gtk voodoo. At some later date, this should be more
generalized and stuffed somewhere in libnautilus-extentions.
Fixes #7312
* libnautilus-extensions/nautilus-file-operations.c
(parse_previous_duplicate_name): s/strdup/g_strdup/ as the
string will be later g_free'd
Fixes #7440
2001-03-06 Eric Fischer <eric@eazel.com>
reviewed by: Christian Meyer <chrisime@gnome.org>
......
......@@ -153,6 +153,8 @@ static GtkTargetEntry nautilus_tree_view_dnd_target_table[] = {
{ NAUTILUS_ICON_DND_URI_LIST_TYPE, 0, NAUTILUS_ICON_DND_URI_LIST }
};
static GtkTargetList *nautilus_tree_view_dnd_target_list = NULL;
static void
tree_view_realize_callback (GtkWidget *widget, gpointer user_data)
......@@ -394,6 +396,30 @@ nautilus_tree_view_drag_motion (GtkWidget *widget, GdkDragContext *context,
return TRUE;
}
/* FIXME bugzilla.eazel.com 7445: Needs to become a shared function */
static void
get_data_on_first_target_we_support (GtkWidget *widget, GdkDragContext *context, guint32 time)
{
GList *target;
if (nautilus_tree_view_dnd_target_list == NULL)
nautilus_tree_view_dnd_target_list = gtk_target_list_new (nautilus_tree_view_dnd_target_table,
NAUTILUS_N_ELEMENTS (nautilus_tree_view_dnd_target_table));
for (target = context->targets; target != NULL; target = target->next) {
guint dummy_info;
GdkAtom target_atom = GPOINTER_TO_UINT (target->data);
if (gtk_target_list_find (nautilus_tree_view_dnd_target_list,
target_atom,
&dummy_info)) {
gtk_drag_get_data (GTK_WIDGET (widget), context,
target_atom,
time);
break;
}
}
}
static gboolean
nautilus_tree_view_drag_drop (GtkWidget *widget,
......@@ -413,9 +439,7 @@ nautilus_tree_view_drag_drop (GtkWidget *widget,
* drop occured.
*/
dnd->drag_info->drop_occured = TRUE;
gtk_drag_get_data (GTK_WIDGET (widget), context,
GPOINTER_TO_INT (context->targets->data),
time);
get_data_on_first_target_we_support (widget, context, time);
gtk_signal_emit_stop_by_name (GTK_OBJECT (widget),
"drag_drop");
......@@ -1045,9 +1069,9 @@ nautilus_tree_view_ensure_drag_data (NautilusTreeView *tree_view,
drag_info = tree_view->details->dnd->drag_info;
if (!drag_info->got_drop_data_type) {
gtk_drag_get_data (GTK_WIDGET (tree_view->details->tree), context,
GPOINTER_TO_INT (context->targets->data),
time);
get_data_on_first_target_we_support (GTK_WIDGET (tree_view->details->tree),
context,
time);
}
}
......
......@@ -1344,7 +1344,7 @@ parse_previous_duplicate_name (const char *name,
if (**suffix != '\0') {
*name_base = extract_string_until (name, *suffix);
} else {
*name_base = strdup (name);
*name_base = g_strdup (name);
}
}
......
......@@ -107,6 +107,8 @@ static GtkTargetEntry drop_types [] = {
{ NAUTILUS_ICON_DND_KEYWORD_TYPE, 0, NAUTILUS_ICON_DND_KEYWORD }
};
static GtkTargetList *drop_types_list = NULL;
static GnomeCanvasItem *
create_selection_shadow (NautilusIconContainer *container,
......@@ -461,6 +463,31 @@ drag_data_received_callback (GtkWidget *widget,
}
/* FIXME bugzilla.eazel.com 7445: Needs to become a shared function */
static void
get_data_on_first_target_we_support (GtkWidget *widget, GdkDragContext *context, guint32 time)
{
GList *target;
if (drop_types_list == NULL)
drop_types_list = gtk_target_list_new (drop_types,
NAUTILUS_N_ELEMENTS (drop_types));
for (target = context->targets; target != NULL; target = target->next) {
guint dummy_info;
GdkAtom target_atom = GPOINTER_TO_UINT (target->data);
if (gtk_target_list_find (drop_types_list,
target_atom,
&dummy_info)) {
gtk_drag_get_data (GTK_WIDGET (widget), context,
target_atom,
time);
break;
}
}
}
static void
nautilus_icon_container_ensure_drag_data (NautilusIconContainer *container,
GdkDragContext *context,
......@@ -471,9 +498,7 @@ nautilus_icon_container_ensure_drag_data (NautilusIconContainer *container,
dnd_info = container->details->dnd_info;
if (!dnd_info->drag_info.got_drop_data_type) {
gtk_drag_get_data (GTK_WIDGET (container), context,
GPOINTER_TO_INT (context->targets->data),
time);
get_data_on_first_target_we_support (GTK_WIDGET (container), context, time);
}
}
......@@ -1339,9 +1364,8 @@ drag_drop_callback (GtkWidget *widget,
make sure it is going to be called at least once.
*/
dnd_info->drag_info.drop_occured = TRUE;
gtk_drag_get_data (GTK_WIDGET (widget), context,
GPOINTER_TO_INT (context->targets->data),
time);
get_data_on_first_target_we_support (widget, context, time);
return FALSE;
}
......
......@@ -207,6 +207,8 @@ static GtkTargetEntry nautilus_list_dnd_target_table[] = {
{ NAUTILUS_ICON_DND_KEYWORD_TYPE, 0, NAUTILUS_ICON_DND_KEYWORD }
};
static GtkTargetList *nautilus_list_dnd_target_list = NULL;
static void activate_row (NautilusList *list,
int row);
static int get_cell_horizontal_start_position (NautilusCList *clist,
......@@ -3170,6 +3172,31 @@ nautilus_list_column_resize_track_end (GtkWidget *widget, int column_index)
clist->drag_pos = -1;
}
/* FIXME bugzilla.eazel.com 7445: Needs to become a shared function */
static void
get_data_on_first_target_we_support (GtkWidget *widget, GdkDragContext *context, guint32 time)
{
GList *target;
if (nautilus_list_dnd_target_list == NULL)
nautilus_list_dnd_target_list = gtk_target_list_new (nautilus_list_dnd_target_table,
NAUTILUS_N_ELEMENTS (nautilus_list_dnd_target_table));
for (target = context->targets; target != NULL; target = target->next) {
guint dummy_info;
GdkAtom target_atom = GPOINTER_TO_UINT (target->data);
if (gtk_target_list_find (nautilus_list_dnd_target_list,
target_atom,
&dummy_info)) {
gtk_drag_get_data (GTK_WIDGET (widget), context,
target_atom,
time);
break;
}
}
}
static void
nautilus_list_ensure_drag_data (NautilusList *list,
......@@ -3177,9 +3204,7 @@ nautilus_list_ensure_drag_data (NautilusList *list,
guint32 time)
{
if (!list->details->drag_info->got_drop_data_type) {
gtk_drag_get_data (GTK_WIDGET (list), context,
GPOINTER_TO_INT (context->targets->data),
time);
get_data_on_first_target_we_support (GTK_WIDGET (list), context, time);
}
}
......@@ -3377,9 +3402,7 @@ nautilus_list_drag_drop (GtkWidget *widget, GdkDragContext *context,
/* make sure that drag_data_received is going to be called
after this event and will do the actual actions */
list->details->drag_info->drop_occured = TRUE;
gtk_drag_get_data (GTK_WIDGET (widget), context,
GPOINTER_TO_INT (context->targets->data),
time);
get_data_on_first_target_we_support (widget, context, time);
return FALSE;
}
......
......@@ -1344,7 +1344,7 @@ parse_previous_duplicate_name (const char *name,
if (**suffix != '\0') {
*name_base = extract_string_until (name, *suffix);
} else {
*name_base = strdup (name);
*name_base = g_strdup (name);
}
}
......
......@@ -107,6 +107,8 @@ static GtkTargetEntry drop_types [] = {
{ NAUTILUS_ICON_DND_KEYWORD_TYPE, 0, NAUTILUS_ICON_DND_KEYWORD }
};
static GtkTargetList *drop_types_list = NULL;
static GnomeCanvasItem *
create_selection_shadow (NautilusIconContainer *container,
......@@ -461,6 +463,31 @@ drag_data_received_callback (GtkWidget *widget,
}
/* FIXME bugzilla.eazel.com 7445: Needs to become a shared function */
static void
get_data_on_first_target_we_support (GtkWidget *widget, GdkDragContext *context, guint32 time)
{
GList *target;
if (drop_types_list == NULL)
drop_types_list = gtk_target_list_new (drop_types,
NAUTILUS_N_ELEMENTS (drop_types));
for (target = context->targets; target != NULL; target = target->next) {
guint dummy_info;
GdkAtom target_atom = GPOINTER_TO_UINT (target->data);
if (gtk_target_list_find (drop_types_list,
target_atom,
&dummy_info)) {
gtk_drag_get_data (GTK_WIDGET (widget), context,
target_atom,
time);
break;
}
}
}
static void
nautilus_icon_container_ensure_drag_data (NautilusIconContainer *container,
GdkDragContext *context,
......@@ -471,9 +498,7 @@ nautilus_icon_container_ensure_drag_data (NautilusIconContainer *container,
dnd_info = container->details->dnd_info;
if (!dnd_info->drag_info.got_drop_data_type) {
gtk_drag_get_data (GTK_WIDGET (container), context,
GPOINTER_TO_INT (context->targets->data),
time);
get_data_on_first_target_we_support (GTK_WIDGET (container), context, time);
}
}
......@@ -1339,9 +1364,8 @@ drag_drop_callback (GtkWidget *widget,
make sure it is going to be called at least once.
*/
dnd_info->drag_info.drop_occured = TRUE;
gtk_drag_get_data (GTK_WIDGET (widget), context,
GPOINTER_TO_INT (context->targets->data),
time);
get_data_on_first_target_we_support (widget, context, time);
return FALSE;
}
......
......@@ -207,6 +207,8 @@ static GtkTargetEntry nautilus_list_dnd_target_table[] = {
{ NAUTILUS_ICON_DND_KEYWORD_TYPE, 0, NAUTILUS_ICON_DND_KEYWORD }
};
static GtkTargetList *nautilus_list_dnd_target_list = NULL;
static void activate_row (NautilusList *list,
int row);
static int get_cell_horizontal_start_position (NautilusCList *clist,
......@@ -3170,6 +3172,31 @@ nautilus_list_column_resize_track_end (GtkWidget *widget, int column_index)
clist->drag_pos = -1;
}
/* FIXME bugzilla.eazel.com 7445: Needs to become a shared function */
static void
get_data_on_first_target_we_support (GtkWidget *widget, GdkDragContext *context, guint32 time)
{
GList *target;
if (nautilus_list_dnd_target_list == NULL)
nautilus_list_dnd_target_list = gtk_target_list_new (nautilus_list_dnd_target_table,
NAUTILUS_N_ELEMENTS (nautilus_list_dnd_target_table));
for (target = context->targets; target != NULL; target = target->next) {
guint dummy_info;
GdkAtom target_atom = GPOINTER_TO_UINT (target->data);
if (gtk_target_list_find (nautilus_list_dnd_target_list,
target_atom,
&dummy_info)) {
gtk_drag_get_data (GTK_WIDGET (widget), context,
target_atom,
time);
break;
}
}
}
static void
nautilus_list_ensure_drag_data (NautilusList *list,
......@@ -3177,9 +3204,7 @@ nautilus_list_ensure_drag_data (NautilusList *list,
guint32 time)
{
if (!list->details->drag_info->got_drop_data_type) {
gtk_drag_get_data (GTK_WIDGET (list), context,
GPOINTER_TO_INT (context->targets->data),
time);
get_data_on_first_target_we_support (GTK_WIDGET (list), context, time);
}
}
......@@ -3377,9 +3402,7 @@ nautilus_list_drag_drop (GtkWidget *widget, GdkDragContext *context,
/* make sure that drag_data_received is going to be called
after this event and will do the actual actions */
list->details->drag_info->drop_occured = TRUE;
gtk_drag_get_data (GTK_WIDGET (widget), context,
GPOINTER_TO_INT (context->targets->data),
time);
get_data_on_first_target_we_support (widget, context, time);
return FALSE;
}
......
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