[Goodies-commits] r7431 - xfburn/trunk/xfburn

David Mohr squisher at xfce.org
Thu May 28 07:15:47 CEST 2009


Author: squisher
Date: 2009-05-28 05:15:46 +0000 (Thu, 28 May 2009)
New Revision: 7431

Modified:
   xfburn/trunk/xfburn/xfburn-data-composition.c
Log:
Bugfix: only allow dropping into folders, not files. Copied from moving rows inside the composition

Modified: xfburn/trunk/xfburn/xfburn-data-composition.c
===================================================================
--- xfburn/trunk/xfburn/xfburn-data-composition.c	2009-05-28 05:14:42 UTC (rev 7430)
+++ xfburn/trunk/xfburn/xfburn-data-composition.c	2009-05-28 05:15:46 UTC (rev 7431)
@@ -203,10 +203,10 @@
 /***************************/
 /* XfburnDataComposition class */
 /***************************/
-GtkType
+GType
 xfburn_data_composition_get_type (void)
 {
-  static GtkType data_composition_type = 0;
+  static GType data_composition_type = 0;
 
   if (!data_composition_type) {
     static const GTypeInfo data_composition_info = {
@@ -1013,27 +1013,30 @@
   struct stat s;
 
   if ((g_lstat (path, &s) == 0)) {
-    //gchar *basename = NULL;
     gchar *humansize = NULL;
     GtkTreeIter *parent = NULL;
     GtkTreePath *tree_path = NULL;
+    int parent_type = 0;
 
     if (!(S_ISDIR (s.st_mode) ||S_ISREG (s.st_mode) || S_ISCHR(s.st_mode) || S_ISBLK(s.st_mode) || S_ISLNK (s.st_mode))) {
       return FALSE;
     }
     
-    /* allow hidden files
-    basename = g_path_get_basename (path);
-    if ( (strlen (basename) > 1) && (basename[0] == '.') ) {
+    xfburn_adding_progress_pulse (XFBURN_ADDING_PROGRESS (priv->progress));
+    
+    /* ensure that we can only drop on top of folders, not files */
+    if (insertion) {
+      gtk_tree_model_get (model, insertion, DATA_COMPOSITION_COLUMN_TYPE, &parent_type, -1);
 
-      g_free (basename);  
-      return FALSE;
+      if (parent_type == DATA_COMPOSITION_TYPE_FILE) {
+        DBG ("Parent is file, and we're dropping into %d", position);
+        if (position == GTK_TREE_VIEW_DROP_INTO_OR_AFTER)
+          position = GTK_TREE_VIEW_DROP_AFTER;
+        else if (position == GTK_TREE_VIEW_DROP_INTO_OR_BEFORE)
+          position = GTK_TREE_VIEW_DROP_BEFORE;
+      }      
     }
-    g_free (basename);
-    */
-    
-    xfburn_adding_progress_pulse (XFBURN_ADDING_PROGRESS (priv->progress));
-    
+
     /* find parent */
     switch (position){
       case GTK_TREE_VIEW_DROP_BEFORE:




More information about the Goodies-commits mailing list