--- /dev/null
+/* Copyright (c) 2006, Nokia Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the Nokia Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __MODEST_DND_H__
+#define __MODEST_DND_H__
+
+G_BEGIN_DECLS
+
+#define ROW_REF_DATA_NAME "row-ref"
+
+enum {
+ FOLDER_ROW,
+ HEADER_ROW
+};
+
+G_END_DECLS
+
+#endif /* __MODEST_DND_H__ */
#include <modest-text-utils.h>
#include <modest-runtime.h>
#include "modest-folder-view.h"
+#include <modest-dnd.h>
/* 'private'/'protected' functions */
static void modest_folder_view_class_init (ModestFolderViewClass *klass);
static void setup_drag_and_drop (GtkTreeView *self);
enum {
- TARGET_TREE_ROW,
-};
-
-static const GtkTargetEntry drag_types[] =
-{
- { "GTK_TREE_MODEL_ROW", GTK_TARGET_SAME_WIDGET, TARGET_TREE_ROW },
-};
-
-#define ROW_REF_DATA_NAME "row-ref"
-
-enum {
FOLDER_SELECTION_CHANGED_SIGNAL,
FOLDER_XFER_SIGNAL,
LAST_SIGNAL
dest_row);
/* Drags from the header view */
- if ((target_type == TARGET_TREE_ROW) && (source_widget != widget)) {
+ if ((target_type == FOLDER_ROW) && (source_widget != widget)) {
TnyHeader *header;
TnyFolder *folder;
ModestMailOperationQueue *queue;
return TRUE;
}
+
+/* Folder view drag types */
+const GtkTargetEntry folder_view_drag_types[] =
+{
+ { "GTK_TREE_MODEL_ROW", GTK_TARGET_SAME_WIDGET, FOLDER_ROW },
+};
+
/*
* This function sets the treeview as a source and a target for dnd
* events. It also connects all the requirede signals.
behaviour */
gtk_drag_dest_set (GTK_WIDGET (self),
GTK_DEST_DEFAULT_HIGHLIGHT,
- drag_types,
- G_N_ELEMENTS (drag_types),
+ folder_view_drag_types,
+ G_N_ELEMENTS (folder_view_drag_types),
GDK_ACTION_MOVE | GDK_ACTION_COPY);
gtk_signal_connect(GTK_OBJECT (self),
/* Set up the treeview as a dnd source */
gtk_drag_source_set (GTK_WIDGET (self),
GDK_BUTTON1_MASK,
- drag_types,
- G_N_ELEMENTS (drag_types),
+ folder_view_drag_types,
+ G_N_ELEMENTS (folder_view_drag_types),
GDK_ACTION_MOVE | GDK_ACTION_COPY);
gtk_signal_connect(GTK_OBJECT (self),
#include <modest-header-view.h>
#include <modest-header-view-priv.h>
+#include <modest-dnd.h>
#include <modest-marshal.h>
#include <modest-text-utils.h>
}
}
-static const GtkTargetEntry drag_types[] =
-{
- { "GTK_TREE_MODEL_ROW", GTK_TARGET_SAME_APP, 0 }
-};
-
static void
drag_data_get_cb (GtkWidget *widget,
GdkDragContext *context,
model_sort = gtk_tree_view_get_model (GTK_TREE_VIEW (widget));
model = gtk_tree_model_sort_get_model (GTK_TREE_MODEL_SORT (model_sort));
-/* source_row = g_object_steal_data (G_OBJECT (widget), ROW_REF_DATA_NAME); */
- source_row = g_object_steal_data (G_OBJECT (widget), "row-ref");
+ source_row = g_object_steal_data (G_OBJECT (widget), ROW_REF_DATA_NAME);
/* Delete the source row */
gtk_tree_model_get_iter (model, &iter, source_row);
gtk_tree_path_free (source_row);
}
+/* Header view drag types */
+const GtkTargetEntry header_view_drag_types[] =
+{
+ { "GTK_TREE_MODEL_ROW", GTK_TARGET_SAME_APP, HEADER_ROW }
+};
+
static void
setup_drag_and_drop (GtkTreeView *self)
{
gtk_drag_source_set (GTK_WIDGET (self),
GDK_BUTTON1_MASK,
- drag_types,
- G_N_ELEMENTS (drag_types),
+ header_view_drag_types,
+ G_N_ELEMENTS (header_view_drag_types),
GDK_ACTION_MOVE | GDK_ACTION_COPY);
gtk_signal_connect(GTK_OBJECT (self),