New API to set whether URI drops are accepted
The file chooser will not accept dropping URIs in a shortcut item. However, Nautilus will, to perform normal DnD for files. Signed-off-by: Federico Mena Quintero <federico@gnome.org>
This commit is contained in:
@ -135,6 +135,7 @@ struct _GtkPlacesSidebar {
|
||||
guint show_trash : 1;
|
||||
guint trash_is_full : 1;
|
||||
guint show_cwd : 1;
|
||||
guint accept_uri_drops : 1;
|
||||
};
|
||||
|
||||
struct _GtkPlacesSidebarClass {
|
||||
@ -1461,15 +1462,17 @@ drag_motion_callback (GtkTreeView *tree_view,
|
||||
}
|
||||
} else {
|
||||
action = 0;
|
||||
if (sidebar->drag_list != NULL) {
|
||||
gtk_tree_model_get_iter (GTK_TREE_MODEL (sidebar->store),
|
||||
&iter, path);
|
||||
gtk_tree_model_get (GTK_TREE_MODEL (sidebar->store),
|
||||
&iter,
|
||||
PLACES_SIDEBAR_COLUMN_URI, &uri,
|
||||
-1);
|
||||
emit_drag_action_requested (sidebar, context, uri, sidebar->drag_list, &action);
|
||||
g_free (uri);
|
||||
if (sidebar->accept_uri_drops) {
|
||||
if (sidebar->drag_list != NULL) {
|
||||
gtk_tree_model_get_iter (GTK_TREE_MODEL (sidebar->store),
|
||||
&iter, path);
|
||||
gtk_tree_model_get (GTK_TREE_MODEL (sidebar->store),
|
||||
&iter,
|
||||
PLACES_SIDEBAR_COLUMN_URI, &uri,
|
||||
-1);
|
||||
emit_drag_action_requested (sidebar, context, uri, sidebar->drag_list, &action);
|
||||
g_free (uri);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -4047,3 +4050,11 @@ gtk_places_sidebar_set_show_cwd (GtkPlacesSidebar *sidebar, gboolean show_cwd)
|
||||
sidebar->show_cwd = !!show_cwd;
|
||||
update_places (sidebar);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_places_sidebar_set_accept_uri_drops (GtkPlacesSidebar *sidebar, gboolean accept_uri_drops)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_PLACES_SIDEBAR (sidebar));
|
||||
|
||||
sidebar->accept_uri_drops = !!accept_uri_drops;
|
||||
}
|
||||
|
||||
@ -70,6 +70,8 @@ void gtk_places_sidebar_set_trash_is_full (GtkPlacesSidebar *sidebar, gboolean i
|
||||
|
||||
void gtk_places_sidebar_set_show_cwd (GtkPlacesSidebar *sidebar, gboolean show_cwd);
|
||||
|
||||
void gtk_places_sidebar_set_file_dnd_enabled (GtkPlacesSidebar *sidebar, gboolean file_dnd_enabled);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_PLACES_SIDEBAR_H__ */
|
||||
|
||||
Reference in New Issue
Block a user