diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2005-07-11 04:57:14 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2005-07-11 04:57:14 +0800 |
commit | 39e1b868fe021ab8fe04ade6774d04ed87c05a81 (patch) | |
tree | bd87552b218755815cc17acda43c3513ef316d2f /lib | |
parent | b6ccb049d514886311520d3c16c8b592dfcde3a3 (diff) | |
download | gsoc2013-epiphany-39e1b868fe021ab8fe04ade6774d04ed87c05a81.tar.gz gsoc2013-epiphany-39e1b868fe021ab8fe04ade6774d04ed87c05a81.tar.zst gsoc2013-epiphany-39e1b868fe021ab8fe04ade6774d04ed87c05a81.zip |
Implement a way to disallow dragging from resp. dropping on certain nodes.
2005-07-10 Christian Persch <chpe@cvs.gnome.org>
* lib/ephy-node-common.h:
* lib/ephy-node.c: (ephy_node_new_with_id),
(ephy_node_signal_disconnect), (ephy_node_set_is_drag_source),
(ephy_node_get_is_drag_source), (ephy_node_set_is_drag_dest),
(ephy_node_get_is_drag_dest):
* lib/ephy-node.h:
* lib/widgets/ephy-node-view.c: (drag_motion_cb),
(drag_data_received_cb):
Implement a way to disallow dragging from resp. dropping on certain
nodes.
* src/bookmarks/ephy-bookmarks-editor.c:
(ephy_bookmarks_editor_update_menu):
* src/bookmarks/ephy-bookmarks.c: (save_filter),
(save_filter_local), (ephy_bookmarks_save),
(update_bookmark_keywords), (bookmark_is_categorized),
(resolve_cb), (browse_cb), (ephy_local_bookmarks_init),
(ephy_local_bookmarks_stop), (ephy_bookmarks_init),
(ephy_bookmarks_finalize), (ephy_bookmarks_get_topic_uri),
(ephy_bookmarks_find_keyword), (ephy_bookmarks_get_favorites),
(ephy_bookmarks_get_local):
* src/bookmarks/ephy-bookmarks.h:
Implement "Local Sites" topic, filled with zeroconf-discovered
bookmarks. Patch by Bastien Nocera, fixes bug #144969.
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 |