[gtk+/places-sidebar] New API to set whether URI drops are accepted
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/places-sidebar] New API to set whether URI drops are accepted
- Date: Tue, 4 Dec 2012 19:09:49 +0000 (UTC)
commit 10b22e0ee226dd2fc65b28aed0d15810902fbc15
Author: Federico Mena Quintero <federico gnome org>
Date: Tue Dec 4 12:57:48 2012 -0600
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>
gtk/gtkplacessidebar.c | 29 ++++++++++++++++++++---------
gtk/gtkplacessidebar.h | 2 ++
2 files changed, 22 insertions(+), 9 deletions(-)
---
diff --git a/gtk/gtkplacessidebar.c b/gtk/gtkplacessidebar.c
index c5ba9d2..754114b 100644
--- a/gtk/gtkplacessidebar.c
+++ b/gtk/gtkplacessidebar.c
@@ -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;
+}
diff --git a/gtk/gtkplacessidebar.h b/gtk/gtkplacessidebar.h
index 093357c..9180372 100644
--- a/gtk/gtkplacessidebar.h
+++ b/gtk/gtkplacessidebar.h
@@ -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__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]