r1004@localhost: muntyan | 2005-11-25 12:58:26 -0600

Removed dnd stuff
This commit is contained in:
Yevgen Muntyan 2005-11-26 01:00:13 +00:00
parent 91d444b277
commit c1989f2e1e
2 changed files with 3 additions and 185 deletions

View File

@ -48,11 +48,6 @@ struct _MooWindowPrivate {
MooActionGroup *actions;
char *name;
char *id;
gboolean drag_inside;
gboolean drag_highlight;
gboolean drag_drop;
GtkTargetList *targets;
};
@ -103,27 +98,6 @@ static void moo_window_remove_action (MooWindow *window,
static gboolean moo_window_delete_event (GtkWidget *widget,
GdkEventAny *event);
static void moo_window_drag_data_received (GtkWidget *widget,
GdkDragContext *drag_context,
int x,
int y,
GtkSelectionData *data,
guint info,
guint time);
static gboolean moo_window_drag_drop (GtkWidget *widget,
GdkDragContext *drag_context,
int x,
int y,
guint time);
static void moo_window_drag_leave (GtkWidget *widget,
GdkDragContext *drag_context,
guint time);
static gboolean moo_window_drag_motion (GtkWidget *widget,
GdkDragContext *drag_context,
int x,
int y,
guint time);
static gboolean moo_window_save_size (MooWindow *window);
static gboolean moo_window_create_ui (MooWindow *window);
@ -176,10 +150,6 @@ static void moo_window_class_init (MooWindowClass *klass)
gobject_class->get_property = moo_window_get_property;
widget_class->delete_event = moo_window_delete_event;
widget_class->drag_data_received = moo_window_drag_data_received;
widget_class->drag_drop = moo_window_drag_drop;
widget_class->drag_leave = moo_window_drag_leave;
widget_class->drag_motion = moo_window_drag_motion;
moo_window_class_set_id (klass, "MooWindow", "Window");
@ -374,10 +344,6 @@ GObject *moo_window_constructor (GType type,
static void moo_window_init (MooWindow *window)
{
window->priv = g_new0 (MooWindowPrivate, 1);
window->priv->targets = gtk_target_list_new (NULL, 0);
gtk_drag_dest_set (GTK_WIDGET (window), 0, NULL, 0,
GDK_ACTION_DEFAULT);
}
@ -402,24 +368,15 @@ static void moo_window_finalize (GObject *object)
g_source_remove (window->priv->save_size_id);
window->priv->save_size_id = 0;
gtk_target_list_unref (window->priv->targets);
g_free (window->priv);
G_OBJECT_CLASS (moo_window_parent_class)->finalize (object);
}
GtkTargetList*
moo_window_get_target_list (MooWindow *window)
{
g_return_val_if_fail (MOO_IS_WINDOW (window), NULL);
return window->priv->targets;
}
static gboolean moo_window_delete_event (GtkWidget *widget,
G_GNUC_UNUSED GdkEventAny *event)
static gboolean
moo_window_delete_event (GtkWidget *widget,
G_GNUC_UNUSED GdkEventAny *event)
{
gboolean result = FALSE;
g_signal_emit_by_name (widget, "close", &result);
@ -795,143 +752,6 @@ static GtkToolbarStyle get_toolbar_style (MooWindow *window)
#undef N_STYLES
static void
moo_window_drag_data_received (GtkWidget *widget,
GdkDragContext *context,
G_GNUC_UNUSED int x,
G_GNUC_UNUSED int y,
G_GNUC_UNUSED GtkSelectionData *data,
G_GNUC_UNUSED guint info,
guint time)
{
MooWindow *window = MOO_WINDOW (widget);
#if 1
char *name;
name = gdk_atom_name (data->target);
g_print ("Got data: %s\n", name);
g_free (name);
#endif
if (window->priv->drag_drop)
{
gtk_drag_finish (context, TRUE, FALSE, time);
window->priv->drag_inside = FALSE;
window->priv->drag_drop = FALSE;
}
else
{
gdk_drag_status (context, context->suggested_action, time);
}
}
static gboolean
moo_window_drag_drop (GtkWidget *widget,
GdkDragContext *context,
G_GNUC_UNUSED int x,
G_GNUC_UNUSED int y,
guint time)
{
GdkAtom target = GDK_NONE;
MooWindow *window = MOO_WINDOW (widget);
target = gtk_drag_dest_find_target (widget, context,
window->priv->targets);
if (target != GDK_NONE)
{
gtk_drag_get_data (widget, context, target, time);
window->priv->drag_drop = TRUE;
}
else
{
gtk_drag_finish (context, FALSE, FALSE, time);
}
window->priv->drag_inside = FALSE;
if (window->priv->drag_highlight)
gtk_drag_unhighlight (widget);
window->priv->drag_highlight = FALSE;
return TRUE;
}
static void
moo_window_drag_leave (GtkWidget *widget,
G_GNUC_UNUSED GdkDragContext *context,
G_GNUC_UNUSED guint time)
{
MooWindow *window = MOO_WINDOW (widget);
window->priv->drag_inside = FALSE;
if (window->priv->drag_highlight)
gtk_drag_unhighlight (widget);
window->priv->drag_highlight = FALSE;
}
static gboolean
moo_window_drag_motion (GtkWidget *widget,
GdkDragContext *context,
G_GNUC_UNUSED int x,
G_GNUC_UNUSED int y,
guint time)
{
MooWindow *window = MOO_WINDOW (widget);
GdkDragAction action = 0;
#if 0
if (!window->priv->drag_inside)
{
GList *l;
g_print ("Targets:\n");
for (l = context->targets; l != NULL; l = l->next)
{
GdkAtom atom = GDK_POINTER_TO_ATOM (l->data);
char *name = gdk_atom_name (atom);
g_print (" %s\n", name);
g_free (name);
}
g_print ("==========\n");
}
#endif
if (x < 0 || x >= widget->allocation.width ||
y < 0 || y >= widget->allocation.height)
{
window->priv->drag_inside = FALSE;
if (window->priv->drag_highlight)
gtk_drag_unhighlight (widget);
window->priv->drag_highlight = FALSE;
return FALSE;
}
if (gtk_drag_dest_find_target (widget, context, window->priv->targets) != GDK_NONE)
action = context->suggested_action;
if (action != 0)
{
window->priv->drag_inside = TRUE;
if (!window->priv->drag_highlight)
gtk_drag_highlight (widget);
window->priv->drag_highlight = TRUE;
gdk_drag_status (context, action, time);
return TRUE;
}
else
{
window->priv->drag_inside = FALSE;
if (window->priv->drag_highlight)
gtk_drag_unhighlight (widget);
window->priv->drag_highlight = FALSE;
return FALSE;
}
}
/*****************************************************************************/
/* Actions
*/

View File

@ -64,8 +64,6 @@ GType moo_window_get_type (void) G_GNUC_CONST;
gboolean moo_window_close (MooWindow *window);
GtkTargetList *moo_window_get_target_list (MooWindow *window);
/*****************************************************************************/
/* Actions