1
1

1998-12-10 Federico Mena Quintero <federico@nuclecu.unam.mx>

* gcmd.c: #include "../vfs/vfs.h"

	* gdesktop.c (setup_icon_dnd_actions): Moved the code that calls
	gtk_drag_source_set() for an icon here.
	(editing_started): Temporarily disable drags while the icon's text
	is being edited.
	(editing_stopped): Re-enable DnD from the icon once editing has
	stopped.
Этот коммит содержится в:
Miguel de Icaza 1998-12-11 03:18:41 +00:00
родитель 920858cfaf
Коммит 34a33b2a7a
3 изменённых файлов: 34 добавлений и 6 удалений

Просмотреть файл

@ -66,7 +66,6 @@ Thu Dec 10 21:38:55 1998 Owen Taylor <otaylor@redhat.com>
* gscreen.c (panel_icon_list_select_icon): Middle button opens a
new panel on a directory.
>>>>>>> 1.184
1998-12-08 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gdesktop.c: Moved the old DnD cruft to olddnd.c to keep it there

Просмотреть файл

@ -20,6 +20,7 @@
#include "gcmd.h"
#include "dialog.h"
#include "layout.h"
#include "../vfs/vfs.h"
void
gnome_listing_cmd (GtkWidget *widget, WPanel *panel)

Просмотреть файл

@ -581,6 +581,10 @@ editing_started (GnomeIconTextItem *iti, gpointer data)
dii = data;
/* Disable drags from this icon until editing is finished */
gtk_drag_source_unset (DESKTOP_ICON (dii->dicon)->canvas);
/* Unselect all icons but this one */
unselect_all (dii);
@ -600,6 +604,17 @@ editing_started (GnomeIconTextItem *iti, gpointer data)
gdk_keyboard_grab (GTK_LAYOUT (DESKTOP_ICON (dii->dicon)->canvas)->bin_window, FALSE, GDK_CURRENT_TIME);
}
/* Sets up the specified icon as a drag source, but does not connect the signals */
static void
setup_icon_dnd_actions (struct desktop_icon_info *dii)
{
gtk_drag_source_set (DESKTOP_ICON (dii->dicon)->canvas,
GDK_BUTTON1_MASK | GDK_BUTTON2_MASK,
dnd_icon_sources,
dnd_icon_nsources,
GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK | GDK_ACTION_ASK);
}
/* Callback used when the user finishes editing the icon text item in a desktop icon. It removes
* the mouse and keyboard grabs.
*/
@ -612,6 +627,10 @@ editing_stopped (GnomeIconTextItem *iti, gpointer data)
gdk_pointer_ungrab (GDK_CURRENT_TIME);
gdk_keyboard_ungrab (GDK_CURRENT_TIME);
/* Re-enable drags from this icon */
setup_icon_dnd_actions (dii);
}
/* Used to open a desktop icon when the user double-clicks on it */
@ -656,6 +675,11 @@ icon_button_press (GtkWidget *widget, GdkEventButton *event, gpointer data)
dii = data;
/* If the text is being edited, do not handle clicks by ourselves */
if (GNOME_ICON_TEXT_ITEM (DESKTOP_ICON (dii->dicon)->text)->editing)
return FALSE;
/* Save the mouse position for DnD */
dnd_press_x = event->x;
@ -865,11 +889,7 @@ drag_data_get (GtkWidget *widget, GdkDragContext *context, GtkSelectionData *sel
static void
setup_icon_dnd_source (struct desktop_icon_info *dii)
{
gtk_drag_source_set (DESKTOP_ICON (dii->dicon)->canvas,
GDK_BUTTON1_MASK | GDK_BUTTON2_MASK,
dnd_icon_sources,
dnd_icon_nsources,
GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK | GDK_ACTION_ASK);
setup_icon_dnd_actions (dii);
gtk_signal_connect (GTK_OBJECT (DESKTOP_ICON (dii->dicon)->canvas), "drag_begin",
(GtkSignalFunc) drag_begin,
@ -927,6 +947,8 @@ setup_icon_dnd_dest (struct desktop_icon_info *dii)
if (!fe)
return; /* eek */
/* See what actions are appropriate for this icon */
if (fe->f.link_to_dir)
actions = GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK | GDK_ACTION_ASK;
else if (is_exe (fe->buf.st_mode) && if_link_is_exe (fe))
@ -939,6 +961,8 @@ setup_icon_dnd_dest (struct desktop_icon_info *dii)
if (!actions)
return;
/* Connect the drop signals */
gtk_drag_dest_set (DESKTOP_ICON (dii->dicon)->canvas,
GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_DROP,
dnd_icon_targets,
@ -1383,6 +1407,10 @@ setup_desktop_clicks (void)
gtk_widget_show (click_proxy_invisible);
gdk_window_set_user_data (click_proxy_gdk_window, click_proxy_invisible); /* make it send events to us */
/* The proxy window for clicks sends us events as SubstructureNotify things */
XSelectInput (GDK_DISPLAY (), GDK_WINDOW_XWINDOW (click_proxy_gdk_window), SubstructureNotifyMask);
gtk_signal_connect (GTK_OBJECT (click_proxy_invisible), "event",
(GtkSignalFunc) click_proxy_event,
NULL);