/*
* Geeqie
- * Copyright (C) 2008 - 2009 The Geeqie Team
+ * Copyright (C) 2008 - 2012 The Geeqie Team
*
* Author: Laurent Monin
*
g_signal_connect(G_OBJECT(vd->view), "button_release_event",
G_CALLBACK(vd_release_cb), vd);
- if (dir_fd) vd_set_fd(vd, dir_fd);
-
file_data_register_notify_func(vd_notify_cb, vd, NOTIFY_PRIORITY_HIGH);
+ /* vd_set_fd expects that vd_notify_cb is already registered */
+ if (dir_fd) vd_set_fd(vd, dir_fd);
+
gtk_widget_show(vd->view);
return vd;
ViewDir *vd = data;
if (success)
{
- FileData *fd = file_data_new_simple(new_path);
+ FileData *fd = file_data_new_dir(new_path);
GtkTreeIter iter;
if (vd_find_row(vd, fd, &iter))
if (vd->select_func)
{
- FileData *fd = file_data_new_simple(path);
+ FileData *fd = file_data_new_dir(path);
vd->select_func(vd, fd, vd->select_data);
file_data_unref(fd);
}
break;
case DIRVIEW_TREE:
{
- FileData *new_fd = file_data_new_simple(new_path);
+ FileData *new_fd = file_data_new_dir(new_path);
fd = vdtree_populate_path(vd, new_fd, TRUE, TRUE);
file_data_unref(new_fd);
}
GtkWidget *vd_pop_menu(ViewDir *vd, FileData *fd)
{
GtkWidget *menu;
- GtkWidget *item;
gboolean active;
gboolean rename_delete_active = FALSE;
gboolean new_folder_active = FALSE;
menu_item_add_divider(menu);
- item = menu_item_add_radio(menu, _("View as _List"), GINT_TO_POINTER(DIRVIEW_LIST), vd->type == DIRVIEW_LIST,
- G_CALLBACK(vd_pop_submenu_dir_view_as_cb), vd);
+ menu_item_add_radio(menu, _("View as _List"), GINT_TO_POINTER(DIRVIEW_LIST), vd->type == DIRVIEW_LIST,
+ G_CALLBACK(vd_pop_submenu_dir_view_as_cb), vd);
- item = menu_item_add_radio(menu, _("View as _Tree"), GINT_TO_POINTER(DIRVIEW_TREE), vd->type == DIRVIEW_TREE,
- G_CALLBACK(vd_pop_submenu_dir_view_as_cb), vd);
+ menu_item_add_radio(menu, _("View as _Tree"), GINT_TO_POINTER(DIRVIEW_TREE), vd->type == DIRVIEW_TREE,
+ G_CALLBACK(vd_pop_submenu_dir_view_as_cb), vd);
menu_item_add_divider(menu);
{
ViewDir *vd = data;
GList *list;
- gchar *uritext = NULL;
- gint length = 0;
if (!vd->click_fd) return;
case TARGET_URI_LIST:
case TARGET_TEXT_PLAIN:
list = g_list_prepend(NULL, vd->click_fd);
- uritext = uri_text_from_filelist(list, &length, (info == TARGET_TEXT_PLAIN));
+ uri_selection_data_set_uris_from_filelist(selection_data, list);
g_list_free(list);
break;
}
- if (uritext)
- {
- gtk_selection_data_set(selection_data, selection_data->target,
- 8, (guchar *)uritext, length);
- g_free(uritext);
- }
}
static void vd_dnd_begin(GtkWidget *widget, GdkDragContext *context, gpointer data)
vd_color_set(vd, vd->click_fd, FALSE);
- if (vd->type == DIRVIEW_LIST && context->action == GDK_ACTION_MOVE)
+ if (vd->type == DIRVIEW_LIST && gdk_drag_context_get_selected_action(context) == GDK_ACTION_MOVE)
{
vd_refresh(vd);
}
gint active;
gboolean done = FALSE;
- list = uri_filelist_from_text((gchar *)selection_data->data, TRUE);
+ list = uri_filelist_from_gtk_selection_data(selection_data);
if (!list) return;
active = access_file(fd->path, W_OK | X_OK);
if (active)
{
- if (context->actions == GDK_ACTION_COPY)
+ if (gdk_drag_context_get_actions(context) == GDK_ACTION_COPY)
{
file_util_copy_simple(list, fd->path, vd->widget);
done = TRUE;
list = NULL;
}
- else if (context->actions == GDK_ACTION_MOVE)
+ else if (gdk_drag_context_get_actions(context) == GDK_ACTION_MOVE)
{
file_util_move_simple(list, fd->path, vd->widget);
done = TRUE;
gint x, y;
gint w, h;
- window = vd->view->window;
+ window = gtk_widget_get_window(vd->view);
gdk_window_get_pointer(window, &x, &y, NULL);
- gdk_drawable_get_size(window, &w, &h);
+ w = gdk_window_get_width(window);
+ h = gdk_window_get_height(window);
if (x >= 0 && x < w && y >= 0 && y < h)
{
vd_dnd_drop_update(vd, x, y);
}
else
{
- gdk_drag_status(context, context->suggested_action, time);
+ gdk_drag_status(context, gdk_drag_context_get_suggested_action(context), time);
}
vd_dnd_drop_update(vd, x, y);
if (vd->type == DIRVIEW_TREE)
{
GtkTreeIter iter;
- FileData *base_fd = file_data_new_simple(base);
+ FileData *base_fd = file_data_new_dir(base);
if (vd_find_row(vd, base_fd, &iter))
{