[gtk+/places-sidebar: 211/212] Don't allow drops in unmounted volumes



commit 6d94f8a56c3385f1237e3be8ef20a4fb9b472636
Author: Federico Mena Quintero <federico gnome org>
Date:   Wed Feb 27 12:16:28 2013 -0600

    Don't allow drops in unmounted volumes
    
    Unmounted volumes don't have a URI yet, so we can use that to distinguish them
    from within the DnD code.
    
    Signed-off-by: Federico Mena Quintero <federico gnome org>

 gtk/gtkplacessidebar.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/gtk/gtkplacessidebar.c b/gtk/gtkplacessidebar.c
index 517729a..63f9834 100644
--- a/gtk/gtkplacessidebar.c
+++ b/gtk/gtkplacessidebar.c
@@ -1444,20 +1444,20 @@ drag_motion_callback (GtkTreeView *tree_view,
 
                        if (!drop_as_bookmarks) {
                                char *uri;
-                               GFile *dest_file;
 
                                gtk_tree_model_get (GTK_TREE_MODEL (sidebar->store),
                                                    &iter,
                                                    PLACES_SIDEBAR_COLUMN_URI, &uri,
                                                    -1);
 
-                               g_assert (uri != NULL);
-                               dest_file = g_file_new_for_uri (uri);
+                               if (uri != NULL) {
+                                       GFile *dest_file = g_file_new_for_uri (uri);
 
-                               emit_drag_action_requested (sidebar, context, dest_file, sidebar->drag_list, 
&action);
+                                       emit_drag_action_requested (sidebar, context, dest_file, 
sidebar->drag_list, &action);
 
-                               g_object_unref (dest_file);
-                               g_free (uri);
+                                       g_object_unref (dest_file);
+                                       g_free (uri);
+                               } /* uri may be NULL for unmounted volumes, for example, so we don't allow 
drops there */
                        }
                }
        }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]