forked from AuroraMiddleware/gtk
Properly indicate when new bookmarks are being dropped between other bookmarks
We weren't handling the drag-URIs-as-bookmarks case in drag_motion_callback(). Signed-off-by: Federico Mena Quintero <federico@gnome.org>
This commit is contained in:
parent
a46976fb79
commit
dbf98bcfeb
@ -1394,7 +1394,6 @@ drag_motion_callback (GtkTreeView *tree_view,
|
|||||||
GtkTreeViewDropPosition pos;
|
GtkTreeViewDropPosition pos;
|
||||||
int action;
|
int action;
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
char *uri;
|
|
||||||
gboolean res;
|
gboolean res;
|
||||||
|
|
||||||
action = 0;
|
action = 0;
|
||||||
@ -1412,8 +1411,6 @@ drag_motion_callback (GtkTreeView *tree_view,
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf ("compute_drop_position(): path %d, pos %s\n", gtk_tree_path_get_indices (path)[0], pos_to_string (pos));
|
|
||||||
|
|
||||||
if (sidebar->drag_data_received &&
|
if (sidebar->drag_data_received &&
|
||||||
sidebar->drag_data_info == GTK_TREE_MODEL_ROW) {
|
sidebar->drag_data_info == GTK_TREE_MODEL_ROW) {
|
||||||
/* Dragging bookmarks always moves them to another position in the bookmarks list */
|
/* Dragging bookmarks always moves them to another position in the bookmarks list */
|
||||||
@ -1424,23 +1421,44 @@ drag_motion_callback (GtkTreeView *tree_view,
|
|||||||
* create bookmarks out of the dragged URIs.
|
* create bookmarks out of the dragged URIs.
|
||||||
*/
|
*/
|
||||||
if (sidebar->drag_list != NULL) {
|
if (sidebar->drag_list != NULL) {
|
||||||
GFile *dest_file;
|
SectionType section_type;
|
||||||
|
PlaceType place_type;
|
||||||
|
gboolean drop_as_bookmarks;
|
||||||
|
|
||||||
gtk_tree_model_get_iter (GTK_TREE_MODEL (sidebar->store),
|
gtk_tree_model_get_iter (GTK_TREE_MODEL (sidebar->store),
|
||||||
&iter, path);
|
&iter, path);
|
||||||
gtk_tree_model_get (GTK_TREE_MODEL (sidebar->store),
|
gtk_tree_model_get (GTK_TREE_MODEL (sidebar->store),
|
||||||
&iter,
|
&iter,
|
||||||
PLACES_SIDEBAR_COLUMN_URI, &uri,
|
PLACES_SIDEBAR_COLUMN_SECTION_TYPE, §ion_type,
|
||||||
|
PLACES_SIDEBAR_COLUMN_ROW_TYPE, &place_type,
|
||||||
-1);
|
-1);
|
||||||
|
|
||||||
dest_file = g_file_new_for_uri (uri);
|
drop_as_bookmarks = FALSE;
|
||||||
|
|
||||||
emit_drag_action_requested (sidebar, context, dest_file, sidebar->drag_list, &action);
|
if (section_type == SECTION_BOOKMARKS) {
|
||||||
|
if (pos == GTK_TREE_VIEW_DROP_BEFORE || pos == GTK_TREE_VIEW_DROP_AFTER) {
|
||||||
|
action = GDK_ACTION_COPY;
|
||||||
|
drop_as_bookmarks = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
printf ("dragging URIs, dest_file = %s, action_requested = %d\n", uri, action);
|
if (!drop_as_bookmarks) {
|
||||||
|
char *uri;
|
||||||
|
GFile *dest_file;
|
||||||
|
|
||||||
g_object_unref (dest_file);
|
gtk_tree_model_get (GTK_TREE_MODEL (sidebar->store),
|
||||||
g_free (uri);
|
&iter,
|
||||||
|
PLACES_SIDEBAR_COLUMN_URI, &uri,
|
||||||
|
-1);
|
||||||
|
|
||||||
|
g_assert (uri != NULL);
|
||||||
|
dest_file = g_file_new_for_uri (uri);
|
||||||
|
|
||||||
|
emit_drag_action_requested (sidebar, context, dest_file, sidebar->drag_list, &action);
|
||||||
|
|
||||||
|
g_object_unref (dest_file);
|
||||||
|
g_free (uri);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1623,7 +1641,7 @@ drag_data_received_callback (GtkWidget *widget,
|
|||||||
if (real_action > 0) {
|
if (real_action > 0) {
|
||||||
char *uri;
|
char *uri;
|
||||||
GFile *dest_file;
|
GFile *dest_file;
|
||||||
gboolean dropped;
|
gboolean drop_as_bookmarks;
|
||||||
|
|
||||||
model = gtk_tree_view_get_model (tree_view);
|
model = gtk_tree_view_get_model (tree_view);
|
||||||
|
|
||||||
@ -1634,7 +1652,7 @@ drag_data_received_callback (GtkWidget *widget,
|
|||||||
PLACES_SIDEBAR_COLUMN_INDEX, &position,
|
PLACES_SIDEBAR_COLUMN_INDEX, &position,
|
||||||
-1);
|
-1);
|
||||||
|
|
||||||
dropped = FALSE;
|
drop_as_bookmarks = FALSE;
|
||||||
|
|
||||||
uris = gtk_selection_data_get_uris (selection_data);
|
uris = gtk_selection_data_get_uris (selection_data);
|
||||||
source_file_list = build_file_list_from_uris ((const char **) uris);
|
source_file_list = build_file_list_from_uris ((const char **) uris);
|
||||||
@ -1652,11 +1670,11 @@ drag_data_received_callback (GtkWidget *widget,
|
|||||||
|| tree_pos == GTK_TREE_VIEW_DROP_AFTER) {
|
|| tree_pos == GTK_TREE_VIEW_DROP_AFTER) {
|
||||||
drop_files_as_bookmarks (sidebar, source_file_list, position);
|
drop_files_as_bookmarks (sidebar, source_file_list, position);
|
||||||
success = TRUE;
|
success = TRUE;
|
||||||
dropped = TRUE;
|
drop_as_bookmarks = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dropped) {
|
if (!drop_as_bookmarks) {
|
||||||
gtk_tree_model_get_iter (model, &iter, tree_path);
|
gtk_tree_model_get_iter (model, &iter, tree_path);
|
||||||
gtk_tree_model_get (model, &iter,
|
gtk_tree_model_get (model, &iter,
|
||||||
PLACES_SIDEBAR_COLUMN_URI, &uri,
|
PLACES_SIDEBAR_COLUMN_URI, &uri,
|
||||||
|
Loading…
Reference in New Issue
Block a user