Rename vd_drop_update() to vd_dnd_drop_update().
authorLaurent Monin <geeqie@norz.org>
Fri, 18 Apr 2008 16:53:41 +0000 (16:53 +0000)
committerLaurent Monin <geeqie@norz.org>
Fri, 18 Apr 2008 16:53:41 +0000 (16:53 +0000)
Add two function pointers to ViewDir struct to keep
vdtree_dnd_drop_expand_cancel() and vdtree_dnd_drop_expand()
static to view_dir_tree.c.

src/typedefs.h
src/view_dir.c
src/view_dir_tree.c
src/view_dir_tree.h

index f4df5f3..7103749 100644 (file)
@@ -548,6 +548,9 @@ struct _ViewDir
        void (*select_func)(ViewDir *vd, const gchar *path, gpointer data);
        gpointer select_data;
 
+       void (*dnd_drop_update_func)(ViewDir *vd);
+       void (*dnd_drop_leave_func)(ViewDir *vd);
+       
        LayoutWindow *layout;
 
        GtkWidget *popup;
index ddc78e0..9351fcf 100644 (file)
@@ -70,6 +70,9 @@ ViewDir *vd_new(DirViewType type, const gchar *path)
 
        vd->popup = NULL;
 
+       vd->dnd_drop_leave_func = NULL;
+       vd->dnd_drop_update_func = NULL;
+
        vd->widget = gtk_scrolled_window_new(NULL, NULL);
        gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(vd->widget), GTK_SHADOW_IN);
        gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(vd->widget),
@@ -727,7 +730,7 @@ static void vd_dnd_drop_receive(GtkWidget *widget,
                }
 }
 
-static void vd_drop_update(ViewDir *vd, gint x, gint y)
+static void vd_dnd_drop_update(ViewDir *vd, gint x, gint y)
 {
        GtkTreePath *tpath;
        FileData *fd = NULL;
@@ -743,7 +746,7 @@ static void vd_drop_update(ViewDir *vd, gint x, gint y)
                {
                vd_color_set(vd, vd->drop_fd, FALSE);
                vd_color_set(vd, fd, TRUE);
-               if (vd->type == DIRVIEW_TREE && fd) vdtree_dnd_drop_expand(vd);
+               if (fd && vd->dnd_drop_update_func) vd->dnd_drop_update_func(vd);
                }
 
        vd->drop_fd = fd;
@@ -770,7 +773,7 @@ static gint vd_auto_scroll_idle_cb(gpointer data)
                gdk_drawable_get_size(window, &w, &h);
                if (x >= 0 && x < w && y >= 0 && y < h)
                        {
-                       vd_drop_update(vd, x, y);
+                       vd_dnd_drop_update(vd, x, y);
                        }
                }
 
@@ -807,7 +810,7 @@ static gint vd_dnd_drop_motion(GtkWidget *widget, GdkDragContext *context,
                gdk_drag_status(context, context->suggested_action, time);
                }
 
-       vd_drop_update(vd, x, y);
+       vd_dnd_drop_update(vd, x, y);
 
        if (vd->drop_fd)
                {
@@ -826,7 +829,7 @@ static void vd_dnd_drop_leave(GtkWidget *widget, GdkDragContext *context, guint
 
        vd->drop_fd = NULL;
 
-       if (vd->type == DIRVIEW_TREE) vdtree_dnd_drop_expand_cancel(vd);
+       if (vd->dnd_drop_leave_func) vd->dnd_drop_leave_func(vd);
 }
 
 void vd_dnd_init(ViewDir *vd)
index 710f804..3d2dc33 100644 (file)
@@ -179,13 +179,13 @@ static gint vdtree_dnd_drop_expand_cb(gpointer data)
        return FALSE;
 }
 
-void vdtree_dnd_drop_expand_cancel(ViewDir *vd)
+static void vdtree_dnd_drop_expand_cancel(ViewDir *vd)
 {
        if (VDTREE_INFO(vd, drop_expand_id) != -1) g_source_remove(VDTREE_INFO(vd, drop_expand_id));
        VDTREE_INFO(vd, drop_expand_id) = -1;
 }
 
-void vdtree_dnd_drop_expand(ViewDir *vd)
+static void vdtree_dnd_drop_expand(ViewDir *vd)
 {
        vdtree_dnd_drop_expand_cancel(vd);
        VDTREE_INFO(vd, drop_expand_id) = g_timeout_add(1000, vdtree_dnd_drop_expand_cb, vd);
@@ -939,8 +939,10 @@ ViewDir *vdtree_new(ViewDir *vd, const gchar *path)
        vd->type = DIRVIEW_TREE;
 
        VDTREE_INFO(vd, drop_expand_id) = -1;
-
        VDTREE_INFO(vd, busy_ref) = 0;
+       
+       vd->dnd_drop_leave_func = vdtree_dnd_drop_expand_cancel;
+       vd->dnd_drop_update_func = vdtree_dnd_drop_expand;
 
        store = gtk_tree_store_new(4, G_TYPE_POINTER, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_INT);
        vd->view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
index d72673c..b5188cd 100644 (file)
@@ -33,9 +33,6 @@ gint vdtree_find_row(ViewDir *vd, FileData *fd, GtkTreeIter *iter, GtkTreeIter *
 FileData *vdtree_populate_path(ViewDir *vd, const gchar *path, gint expand, gint force);
 void vdtree_rename_by_data(ViewDir *vd, FileData *fd);
 
-void vdtree_dnd_drop_expand_cancel(ViewDir *vd);
-void vdtree_dnd_drop_expand(ViewDir *vd);
-
 gint vdtree_press_key_cb(GtkWidget *widget, GdkEventKey *event, gpointer data);
 gint vdtree_press_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data);