diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ephy-node-common.h | 3 | ||||
-rw-r--r-- | lib/ephy-node.c | 30 | ||||
-rw-r--r-- | lib/ephy-node.h | 6 | ||||
-rw-r--r-- | lib/widgets/ephy-node-view.c | 25 |
4 files changed, 51 insertions, 13 deletions
diff --git a/lib/ephy-node-common.h b/lib/ephy-node-common.h index a81fafb20..8376a028c 100644 --- a/lib/ephy-node-common.h +++ b/lib/ephy-node-common.h @@ -38,7 +38,8 @@ enum HOSTS_NODE_ID = 5, PAGES_NODE_ID = 6, ICONS_NODE_ID = 9, - SMARTBOOKMARKS_NODE_ID = 10 + SMARTBOOKMARKS_NODE_ID = 10, + BMKS_LOCAL_NODE_ID = 11, }; typedef enum diff --git a/lib/ephy-node.c b/lib/ephy-node.c index 9e98ccd8c..67889893b 100644 --- a/lib/ephy-node.c +++ b/lib/ephy-node.c @@ -69,6 +69,8 @@ struct _EphyNode int signal_id; guint emissions; guint invalidated_signals; + guint is_drag_source : 1; + guint is_drag_dest : 1; EphyNodeDb *db; }; @@ -365,6 +367,8 @@ ephy_node_new_with_id (EphyNodeDb *db, guint reserved_id) node->signal_id = 0; node->emissions = 0; node->invalidated_signals = 0; + node->is_drag_source = TRUE; + node->is_drag_dest = TRUE; _ephy_node_db_add_id (db, reserved_id, node); @@ -1273,6 +1277,32 @@ ephy_node_signal_disconnect (EphyNode *node, } } +void +ephy_node_set_is_drag_source (EphyNode *node, + gboolean allow) +{ + node->is_drag_source = allow != FALSE; +} + +gboolean +ephy_node_get_is_drag_source (EphyNode *node) +{ + return node->is_drag_source; +} + +void +ephy_node_set_is_drag_dest (EphyNode *node, + gboolean allow) +{ + node->is_drag_dest = allow != FALSE; +} + +gboolean +ephy_node_get_is_drag_dest (EphyNode *node) +{ + return node->is_drag_dest; +} + GType ephy_node_get_type (void) { diff --git a/lib/ephy-node.h b/lib/ephy-node.h index ecdb32588..f4e0b0411 100644 --- a/lib/ephy-node.h +++ b/lib/ephy-node.h @@ -129,6 +129,12 @@ EphyNode *ephy_node_get_next_child (EphyNode *node, EphyNode *child); EphyNode *ephy_node_get_previous_child (EphyNode *node, EphyNode *child); +void ephy_node_set_is_drag_source (EphyNode *node, + gboolean allow); +gboolean ephy_node_get_is_drag_source (EphyNode *node); +void ephy_node_set_is_drag_dest (EphyNode *node, + gboolean allow); +gboolean ephy_node_get_is_drag_dest (EphyNode *node); G_END_DECLS diff --git a/lib/widgets/ephy-node-view.c b/lib/widgets/ephy-node-view.c index 668ac4ba6..23cc2fc60 100644 --- a/lib/widgets/ephy-node-view.c +++ b/lib/widgets/ephy-node-view.c @@ -309,7 +309,8 @@ drag_motion_cb (GtkWidget *widget, (node, view->priv->priority_prop_id); if (priority != EPHY_NODE_VIEW_ALL_PRIORITY && - priority != EPHY_NODE_VIEW_SPECIAL_PRIORITY) + priority != EPHY_NODE_VIEW_SPECIAL_PRIORITY && + ephy_node_get_is_drag_source (node)) { action = context->suggested_action; } @@ -374,6 +375,10 @@ drag_data_received_cb (GtkWidget *widget, return; } + /* appease GtkTreeView by preventing its drag_data_receive + * from being called */ + g_signal_stop_emission_by_name (view, "drag_data_received"); + if (!view->priv->have_drag_data) { view->priv->have_drag_data = TRUE; @@ -388,16 +393,18 @@ drag_data_received_cb (GtkWidget *widget, gboolean success = FALSE; GtkTreePath *path; - gtk_tree_view_get_dest_row_at_pos - (GTK_TREE_VIEW (widget), x, y, &path, &pos); - - g_return_if_fail (path != NULL); + if (gtk_tree_view_get_dest_row_at_pos + (GTK_TREE_VIEW (widget), x, y, &path, &pos) == FALSE) + { + return; + } node = get_node_from_path (view, path); + if (node == NULL) return; uris = gtk_selection_data_get_uris (selection_data); - if (uris != NULL) + if (uris != NULL && ephy_node_get_is_drag_dest (node)) { /* FIXME fill success */ g_signal_emit (G_OBJECT (view), @@ -416,12 +423,6 @@ drag_data_received_cb (GtkWidget *widget, gtk_tree_path_free (path); } } - - - /* appease GtkTreeView by preventing its drag_data_receive - * from being called */ - g_signal_stop_emission_by_name (GTK_TREE_VIEW (view), - "drag_data_received"); } static gboolean |