Mercurial > geeqie
changeset 382:eceeced4cbb9
Rename vdt occurences to vd.
author | zas_ |
---|---|
date | Wed, 16 Apr 2008 14:56:31 +0000 |
parents | ff63dcb0425c |
children | 499d7ba62261 |
files | src/view_dir_tree.c |
diffstat | 1 files changed, 358 insertions(+), 358 deletions(-) [+] |
line wrap: on
line diff
--- a/src/view_dir_tree.c Wed Apr 16 14:51:39 2008 +0000 +++ b/src/view_dir_tree.c Wed Apr 16 14:56:31 2008 +0000 @@ -51,8 +51,8 @@ }; -static gint vdtree_populate_path_by_iter(ViewDir *vdt, GtkTreeIter *iter, gint force, const gchar *target_path); -static FileData *vdtree_populate_path(ViewDir *vdt, const gchar *path, gint expand, gint force); +static gint vdtree_populate_path_by_iter(ViewDir *vd, GtkTreeIter *iter, gint force, const gchar *target_path); +static FileData *vdtree_populate_path(ViewDir *vd, const gchar *path, gint expand, gint force); /* @@ -73,24 +73,24 @@ gdk_flush(); } -static void vdtree_busy_push(ViewDir *vdt) +static void vdtree_busy_push(ViewDir *vd) { - if (VDTREE_INFO(vdt, busy_ref) == 0) set_cursor(vdt->view, GDK_WATCH); - VDTREE_INFO(vdt, busy_ref)++; + if (VDTREE_INFO(vd, busy_ref) == 0) set_cursor(vd->view, GDK_WATCH); + VDTREE_INFO(vd, busy_ref)++; } -static void vdtree_busy_pop(ViewDir *vdt) +static void vdtree_busy_pop(ViewDir *vd) { - if (VDTREE_INFO(vdt, busy_ref) == 1) set_cursor(vdt->view, -1); - if (VDTREE_INFO(vdt, busy_ref) > 0) VDTREE_INFO(vdt, busy_ref)--; + if (VDTREE_INFO(vd, busy_ref) == 1) set_cursor(vd->view, -1); + if (VDTREE_INFO(vd, busy_ref) > 0) VDTREE_INFO(vd, busy_ref)--; } -static gint vdtree_find_row(ViewDir *vdt, FileData *fd, GtkTreeIter *iter, GtkTreeIter *parent) +static gint vdtree_find_row(ViewDir *vd, FileData *fd, GtkTreeIter *iter, GtkTreeIter *parent) { GtkTreeModel *store; gint valid; - store = gtk_tree_view_get_model(GTK_TREE_VIEW(vdt->view)); + store = gtk_tree_view_get_model(GTK_TREE_VIEW(vd->view)); if (parent) { valid = gtk_tree_model_iter_children(store, iter, parent); @@ -107,7 +107,7 @@ gtk_tree_model_get(GTK_TREE_MODEL(store), iter, DIR_COLUMN_POINTER, &nd, -1); if (nd->fd == fd) return TRUE; - if (vdtree_find_row(vdt, fd, &found, iter)) + if (vdtree_find_row(vd, fd, &found, iter)) { memcpy(iter, &found, sizeof(found)); return TRUE; @@ -119,61 +119,61 @@ return FALSE; } -static void vdtree_icon_set_by_iter(ViewDir *vdt, GtkTreeIter *iter, GdkPixbuf *pixbuf) +static void vdtree_icon_set_by_iter(ViewDir *vd, GtkTreeIter *iter, GdkPixbuf *pixbuf) { GtkTreeModel *store; GdkPixbuf *old; - store = gtk_tree_view_get_model(GTK_TREE_VIEW(vdt->view)); + store = gtk_tree_view_get_model(GTK_TREE_VIEW(vd->view)); gtk_tree_model_get(store, iter, DIR_COLUMN_ICON, &old, -1); - if (old != vdt->pf->deny) + if (old != vd->pf->deny) { gtk_tree_store_set(GTK_TREE_STORE(store), iter, DIR_COLUMN_ICON, pixbuf, -1); } } -static void vdtree_expand_by_iter(ViewDir *vdt, GtkTreeIter *iter, gint expand) +static void vdtree_expand_by_iter(ViewDir *vd, GtkTreeIter *iter, gint expand) { GtkTreeModel *store; GtkTreePath *tpath; - store = gtk_tree_view_get_model(GTK_TREE_VIEW(vdt->view)); + store = gtk_tree_view_get_model(GTK_TREE_VIEW(vd->view)); tpath = gtk_tree_model_get_path(store, iter); if (expand) { - gtk_tree_view_expand_row(GTK_TREE_VIEW(vdt->view), tpath, FALSE); - vdtree_icon_set_by_iter(vdt, iter, vdt->pf->open); + gtk_tree_view_expand_row(GTK_TREE_VIEW(vd->view), tpath, FALSE); + vdtree_icon_set_by_iter(vd, iter, vd->pf->open); } else { - gtk_tree_view_collapse_row(GTK_TREE_VIEW(vdt->view), tpath); + gtk_tree_view_collapse_row(GTK_TREE_VIEW(vd->view), tpath); } gtk_tree_path_free(tpath); } -static void vdtree_expand_by_data(ViewDir *vdt, FileData *fd, gint expand) +static void vdtree_expand_by_data(ViewDir *vd, FileData *fd, gint expand) { GtkTreeIter iter; - if (vdtree_find_row(vdt, fd, &iter, NULL)) + if (vdtree_find_row(vd, fd, &iter, NULL)) { - vdtree_expand_by_iter(vdt, &iter, expand); + vdtree_expand_by_iter(vd, &iter, expand); } } -static void vdtree_color_set(ViewDir *vdt, FileData *fd, gint color_set) +static void vdtree_color_set(ViewDir *vd, FileData *fd, gint color_set) { GtkTreeModel *store; GtkTreeIter iter; - if (!vdtree_find_row(vdt, fd, &iter, NULL)) return; - store = gtk_tree_view_get_model(GTK_TREE_VIEW(vdt->view)); + if (!vdtree_find_row(vd, fd, &iter, NULL)) return; + store = gtk_tree_view_get_model(GTK_TREE_VIEW(vd->view)); gtk_tree_store_set(GTK_TREE_STORE(store), &iter, DIR_COLUMN_COLOR, color_set, -1); } static gint vdtree_rename_row_cb(TreeEditData *td, const gchar *old, const gchar *new, gpointer data) { - ViewDir *vdt = data; + ViewDir *vd = data; GtkTreeModel *store; GtkTreeIter iter; NodeData *nd; @@ -181,7 +181,7 @@ gchar *new_path; gchar *base; - store = gtk_tree_view_get_model(GTK_TREE_VIEW(vdt->view)); + store = gtk_tree_view_get_model(GTK_TREE_VIEW(vd->view)); if (!gtk_tree_model_get_iter(store, &iter, td->path)) return FALSE; gtk_tree_model_get(store, &iter, DIR_COLUMN_POINTER, &nd, -1); if (!nd) return FALSE; @@ -192,13 +192,13 @@ new_path = concat_dir_and_file(base, new); g_free(base); - if (file_util_rename_dir(nd->fd, new_path, vdt->view)) + if (file_util_rename_dir(nd->fd, new_path, vd->view)) { - vdtree_populate_path(vdt, new_path, TRUE, TRUE); + vdtree_populate_path(vd, new_path, TRUE, TRUE); - if (vdt->layout && strcmp(vdt->path, old_path) == 0) + if (vd->layout && strcmp(vd->path, old_path) == 0) { - layout_set_path(vdt->layout, new_path); + layout_set_path(vd->layout, new_path); } } @@ -208,20 +208,20 @@ return FALSE; } -static void vdtree_rename_by_data(ViewDir *vdt, FileData *fd) +static void vdtree_rename_by_data(ViewDir *vd, FileData *fd) { GtkTreeModel *store; GtkTreePath *tpath; GtkTreeIter iter; if (!fd || - !vdtree_find_row(vdt, fd, &iter, NULL)) return; + !vdtree_find_row(vd, fd, &iter, NULL)) return; - store = gtk_tree_view_get_model(GTK_TREE_VIEW(vdt->view)); + store = gtk_tree_view_get_model(GTK_TREE_VIEW(vd->view)); tpath = gtk_tree_model_get_path(store, &iter); - tree_edit_by_path(GTK_TREE_VIEW(vdt->view), tpath, 0, fd->name, - vdtree_rename_row_cb, vdt); + tree_edit_by_path(GTK_TREE_VIEW(vd->view), tpath, 0, fd->name, + vdtree_rename_row_cb, vd); gtk_tree_path_free(tpath); } @@ -235,16 +235,16 @@ static void vdtree_popup_destroy_cb(GtkWidget *widget, gpointer data) { - ViewDir *vdt = data; + ViewDir *vd = data; - vdtree_color_set(vdt, vdt->click_fd, FALSE); - vdt->click_fd = NULL; - vdt->popup = NULL; + vdtree_color_set(vd, vd->click_fd, FALSE); + vd->click_fd = NULL; + vd->popup = NULL; - vdtree_color_set(vdt, vdt->drop_fd, FALSE); - filelist_free(vdt->drop_list); - vdt->drop_list = NULL; - vdt->drop_fd = NULL; + vdtree_color_set(vd, vd->drop_fd, FALSE); + filelist_free(vd->drop_list); + vd->drop_list = NULL; + vd->drop_fd = NULL; } /* @@ -255,50 +255,50 @@ static void vdtree_drop_menu_copy_cb(GtkWidget *widget, gpointer data) { - ViewDir *vdt = data; + ViewDir *vd = data; const gchar *path; GList *list; - if (!vdt->drop_fd) return; + if (!vd->drop_fd) return; - path = vdt->drop_fd->path; - list = vdt->drop_list; + path = vd->drop_fd->path; + list = vd->drop_list; - vdt->drop_list = NULL; + vd->drop_list = NULL; file_util_copy_simple(list, path); } static void vdtree_drop_menu_move_cb(GtkWidget *widget, gpointer data) { - ViewDir *vdt = data; + ViewDir *vd = data; const gchar *path; GList *list; - if (!vdt->drop_fd) return; + if (!vd->drop_fd) return; - path = vdt->drop_fd->path; - list = vdt->drop_list; + path = vd->drop_fd->path; + list = vd->drop_list; - vdt->drop_list = NULL; + vd->drop_list = NULL; file_util_move_simple(list, path); } -static GtkWidget *vdtree_drop_menu(ViewDir *vdt, gint active) +static GtkWidget *vdtree_drop_menu(ViewDir *vd, gint active) { GtkWidget *menu; menu = popup_menu_short_lived(); g_signal_connect(G_OBJECT(menu), "destroy", - G_CALLBACK(vdtree_popup_destroy_cb), vdt); + G_CALLBACK(vdtree_popup_destroy_cb), vd); menu_item_add_stock_sensitive(menu, _("_Copy"), GTK_STOCK_COPY, active, - G_CALLBACK(vdtree_drop_menu_copy_cb), vdt); - menu_item_add_sensitive(menu, _("_Move"), active, G_CALLBACK(vdtree_drop_menu_move_cb), vdt); + G_CALLBACK(vdtree_drop_menu_copy_cb), vd); + menu_item_add_sensitive(menu, _("_Move"), active, G_CALLBACK(vdtree_drop_menu_move_cb), vd); menu_item_add_divider(menu); - menu_item_add_stock(menu, _("Cancel"), GTK_STOCK_CANCEL, NULL, vdt); + menu_item_add_stock(menu, _("Cancel"), GTK_STOCK_CANCEL, NULL, vd); return menu; } @@ -311,15 +311,15 @@ static void vdtree_pop_menu_up_cb(GtkWidget *widget, gpointer data) { - ViewDir *vdt = data; + ViewDir *vd = data; gchar *path; - if (!vdt->path || strcmp(vdt->path, "/") == 0) return; - path = remove_level_from_path(vdt->path); + if (!vd->path || strcmp(vd->path, "/") == 0) return; + path = remove_level_from_path(vd->path); - if (vdt->select_func) + if (vd->select_func) { - vdt->select_func(vdt, path, vdt->select_data); + vd->select_func(vd, path, vd->select_data); } g_free(path); @@ -327,51 +327,51 @@ static void vdtree_pop_menu_slide_cb(GtkWidget *widget, gpointer data) { - ViewDir *vdt = data; + ViewDir *vd = data; gchar *path; - if (!vdt->layout) return; + if (!vd->layout) return; - if (!vdt->click_fd) return; - path = vdt->click_fd->path; + if (!vd->click_fd) return; + path = vd->click_fd->path; - layout_set_path(vdt->layout, path); - layout_select_none(vdt->layout); - layout_image_slideshow_stop(vdt->layout); - layout_image_slideshow_start(vdt->layout); + layout_set_path(vd->layout, path); + layout_select_none(vd->layout); + layout_image_slideshow_stop(vd->layout); + layout_image_slideshow_start(vd->layout); } static void vdtree_pop_menu_slide_rec_cb(GtkWidget *widget, gpointer data) { - ViewDir *vdt = data; + ViewDir *vd = data; gchar *path; GList *list; - if (!vdt->layout) return; + if (!vd->layout) return; - if (!vdt->click_fd) return; - path = vdt->click_fd->path; + if (!vd->click_fd) return; + path = vd->click_fd->path; list = filelist_recursive(path); - layout_image_slideshow_stop(vdt->layout); - layout_image_slideshow_start_from_list(vdt->layout, list); + layout_image_slideshow_stop(vd->layout); + layout_image_slideshow_start_from_list(vd->layout, list); } -static void vdtree_pop_menu_dupe(ViewDir *vdt, gint recursive) +static void vdtree_pop_menu_dupe(ViewDir *vd, gint recursive) { DupeWindow *dw; GList *list = NULL; - if (!vdt->click_fd) return; + if (!vd->click_fd) return; if (recursive) { - list = g_list_append(list, file_data_ref(vdt->click_fd)); + list = g_list_append(list, file_data_ref(vd->click_fd)); } else { - filelist_read(vdt->click_fd->path, &list, NULL); + filelist_read(vd->click_fd->path, &list, NULL); list = filelist_filter(list, FALSE); } @@ -383,25 +383,25 @@ static void vdtree_pop_menu_dupe_cb(GtkWidget *widget, gpointer data) { - ViewDir *vdt = data; - vdtree_pop_menu_dupe(vdt, FALSE); + ViewDir *vd = data; + vdtree_pop_menu_dupe(vd, FALSE); } static void vdtree_pop_menu_dupe_rec_cb(GtkWidget *widget, gpointer data) { - ViewDir *vdt = data; - vdtree_pop_menu_dupe(vdt, TRUE); + ViewDir *vd = data; + vdtree_pop_menu_dupe(vd, TRUE); } static void vdtree_pop_menu_new_cb(GtkWidget *widget, gpointer data) { - ViewDir *vdt = data; + ViewDir *vd = data; const gchar *path; gchar *new_path; gchar *buf; - if (!vdt->click_fd) return; - path = vdt->click_fd->path; + if (!vd->click_fd) return; + path = vd->click_fd->path; buf = concat_dir_and_file(path, _("new_folder")); new_path = unique_filename(buf, NULL, NULL, FALSE); @@ -413,16 +413,16 @@ gchar *text; text = g_strdup_printf(_("Unable to create folder:\n%s"), new_path); - file_util_warning_dialog(_("Error creating folder"), text, GTK_STOCK_DIALOG_ERROR, vdt->view); + file_util_warning_dialog(_("Error creating folder"), text, GTK_STOCK_DIALOG_ERROR, vd->view); g_free(text); } else { FileData *fd; - fd = vdtree_populate_path(vdt, new_path, TRUE, TRUE); + fd = vdtree_populate_path(vd, new_path, TRUE, TRUE); - vdtree_rename_by_data(vdt, fd); + vdtree_rename_by_data(vd, fd); } g_free(new_path); @@ -430,42 +430,42 @@ static void vdtree_pop_menu_rename_cb(GtkWidget *widget, gpointer data) { - ViewDir *vdt = data; + ViewDir *vd = data; - vdtree_rename_by_data(vdt, vdt->click_fd); + vdtree_rename_by_data(vd, vd->click_fd); } static void vdtree_pop_menu_delete_cb(GtkWidget *widget, gpointer data) { - ViewDir *vdt = data; + ViewDir *vd = data; - if (!vdt->click_fd) return; - file_util_delete_dir(vdt->click_fd, vdt->widget); + if (!vd->click_fd) return; + file_util_delete_dir(vd->click_fd, vd->widget); } static void vdtree_pop_menu_dir_view_as_cb(GtkWidget *widget, gpointer data) { - ViewDir *vdt = data; + ViewDir *vd = data; - if (vdt->layout) layout_views_set(vdt->layout, DIRVIEW_LIST, vdt->layout->icon_view); + if (vd->layout) layout_views_set(vd->layout, DIRVIEW_LIST, vd->layout->icon_view); } static void vdtree_pop_menu_refresh_cb(GtkWidget *widget, gpointer data) { - ViewDir *vdt = data; + ViewDir *vd = data; - if (vdt->layout) layout_refresh(vdt->layout); + if (vd->layout) layout_refresh(vd->layout); } static void vdtree_toggle_show_hidden_files_cb(GtkWidget *widget, gpointer data) { - ViewDir *vdt = data; + ViewDir *vd = data; options->file_filter.show_hidden_files = !options->file_filter.show_hidden_files; - if (vdt->layout) layout_refresh(vdt->layout); + if (vd->layout) layout_refresh(vd->layout); } -static GtkWidget *vdtree_pop_menu(ViewDir *vdt, FileData *fd) +static GtkWidget *vdtree_pop_menu(ViewDir *vd, FileData *fd) { GtkWidget *menu; gint active; @@ -483,44 +483,44 @@ menu = popup_menu_short_lived(); g_signal_connect(G_OBJECT(menu), "destroy", - G_CALLBACK(vdtree_popup_destroy_cb), vdt); + G_CALLBACK(vdtree_popup_destroy_cb), vd); menu_item_add_stock_sensitive(menu, _("_Up to parent"), GTK_STOCK_GO_UP, - (vdt->path && strcmp(vdt->path, "/") != 0), - G_CALLBACK(vdtree_pop_menu_up_cb), vdt); + (vd->path && strcmp(vd->path, "/") != 0), + G_CALLBACK(vdtree_pop_menu_up_cb), vd); menu_item_add_divider(menu); menu_item_add_sensitive(menu, _("_Slideshow"), active, - G_CALLBACK(vdtree_pop_menu_slide_cb), vdt); + G_CALLBACK(vdtree_pop_menu_slide_cb), vd); menu_item_add_sensitive(menu, _("Slideshow recursive"), active, - G_CALLBACK(vdtree_pop_menu_slide_rec_cb), vdt); + G_CALLBACK(vdtree_pop_menu_slide_rec_cb), vd); menu_item_add_divider(menu); menu_item_add_stock_sensitive(menu, _("Find _duplicates..."), GTK_STOCK_FIND, active, - G_CALLBACK(vdtree_pop_menu_dupe_cb), vdt); + G_CALLBACK(vdtree_pop_menu_dupe_cb), vd); menu_item_add_stock_sensitive(menu, _("Find duplicates recursive..."), GTK_STOCK_FIND, active, - G_CALLBACK(vdtree_pop_menu_dupe_rec_cb), vdt); + G_CALLBACK(vdtree_pop_menu_dupe_rec_cb), vd); menu_item_add_divider(menu); active = (fd && access_file(fd->path, W_OK | X_OK)); menu_item_add_sensitive(menu, _("_New folder..."), active, - G_CALLBACK(vdtree_pop_menu_new_cb), vdt); + G_CALLBACK(vdtree_pop_menu_new_cb), vd); menu_item_add_sensitive(menu, _("_Rename..."), parent_active, - G_CALLBACK(vdtree_pop_menu_rename_cb), vdt); + G_CALLBACK(vdtree_pop_menu_rename_cb), vd); menu_item_add_stock_sensitive(menu, _("_Delete..."), GTK_STOCK_DELETE, parent_active, - G_CALLBACK(vdtree_pop_menu_delete_cb), vdt); + G_CALLBACK(vdtree_pop_menu_delete_cb), vd); menu_item_add_divider(menu); menu_item_add_check(menu, _("View as _tree"), TRUE, - G_CALLBACK(vdtree_pop_menu_dir_view_as_cb), vdt); + G_CALLBACK(vdtree_pop_menu_dir_view_as_cb), vd); menu_item_add_check(menu, _("Show _hidden files"), options->file_filter.show_hidden_files, - G_CALLBACK(vdtree_toggle_show_hidden_files_cb), vdt); + G_CALLBACK(vdtree_toggle_show_hidden_files_cb), vd); menu_item_add_stock(menu, _("Re_fresh"), GTK_STOCK_REFRESH, - G_CALLBACK(vdtree_pop_menu_refresh_cb), vdt); + G_CALLBACK(vdtree_pop_menu_refresh_cb), vd); return menu; } @@ -537,18 +537,18 @@ static gint vdtree_dnd_drop_types_count = 1; -static void vdtree_dest_set(ViewDir *vdt, gint enable) +static void vdtree_dest_set(ViewDir *vd, gint enable) { if (enable) { - gtk_drag_dest_set(vdt->view, + gtk_drag_dest_set(vd->view, GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_DROP, vdtree_dnd_drop_types, vdtree_dnd_drop_types_count, GDK_ACTION_MOVE | GDK_ACTION_COPY); } else { - gtk_drag_dest_unset(vdt->view); + gtk_drag_dest_unset(vd->view); } } @@ -556,18 +556,18 @@ GtkSelectionData *selection_data, guint info, guint time, gpointer data) { - ViewDir *vdt = data; + ViewDir *vd = data; GList *list; gchar *uri_text = NULL; gint length = 0; - if (!vdt->click_fd) return; + if (!vd->click_fd) return; switch (info) { case TARGET_URI_LIST: case TARGET_TEXT_PLAIN: - list = g_list_prepend(NULL, vdt->click_fd); + list = g_list_prepend(NULL, vd->click_fd); uri_text = uri_text_from_filelist(list, &length, (info == TARGET_TEXT_PLAIN)); g_list_free(list); break; @@ -583,18 +583,18 @@ static void vdtree_dnd_begin(GtkWidget *widget, GdkDragContext *context, gpointer data) { - ViewDir *vdt = data; + ViewDir *vd = data; - vdtree_color_set(vdt, vdt->click_fd, TRUE); - vdtree_dest_set(vdt, FALSE); + vdtree_color_set(vd, vd->click_fd, TRUE); + vdtree_dest_set(vd, FALSE); } static void vdtree_dnd_end(GtkWidget *widget, GdkDragContext *context, gpointer data) { - ViewDir *vdt = data; + ViewDir *vd = data; - vdtree_color_set(vdt, vdt->click_fd, FALSE); - vdtree_dest_set(vdt, TRUE); + vdtree_color_set(vd, vd->click_fd, FALSE); + vdtree_dest_set(vd, TRUE); } static void vdtree_dnd_drop_receive(GtkWidget *widget, @@ -602,12 +602,12 @@ GtkSelectionData *selection_data, guint info, guint time, gpointer data) { - ViewDir *vdt = data; + ViewDir *vd = data; GtkTreePath *tpath; GtkTreeIter iter; FileData *fd = NULL; - vdt->click_fd = NULL; + vd->click_fd = NULL; if (gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(widget), x, y, &tpath, NULL, NULL, NULL)) @@ -635,56 +635,56 @@ active = access_file(fd->path, W_OK | X_OK); - vdtree_color_set(vdt, fd, TRUE); - vdt->popup = vdtree_drop_menu(vdt, active); - gtk_menu_popup(GTK_MENU(vdt->popup), NULL, NULL, NULL, NULL, 0, time); + vdtree_color_set(vd, fd, TRUE); + vd->popup = vdtree_drop_menu(vd, active); + gtk_menu_popup(GTK_MENU(vd->popup), NULL, NULL, NULL, NULL, 0, time); - vdt->drop_fd = fd; - vdt->drop_list = list; + vd->drop_fd = fd; + vd->drop_list = list; } } static gint vdtree_dnd_drop_expand_cb(gpointer data) { - ViewDir *vdt = data; + ViewDir *vd = data; GtkTreeIter iter; - if (vdt->drop_fd && - vdtree_find_row(vdt, vdt->drop_fd, &iter, NULL)) + if (vd->drop_fd && + vdtree_find_row(vd, vd->drop_fd, &iter, NULL)) { - vdtree_populate_path_by_iter(vdt, &iter, FALSE, vdt->path); - vdtree_expand_by_data(vdt, vdt->drop_fd, TRUE); + vdtree_populate_path_by_iter(vd, &iter, FALSE, vd->path); + vdtree_expand_by_data(vd, vd->drop_fd, TRUE); } - VDTREE_INFO(vdt, drop_expand_id) = -1; + VDTREE_INFO(vd, drop_expand_id) = -1; return FALSE; } -static void vdtree_dnd_drop_expand_cancel(ViewDir *vdt) +static void vdtree_dnd_drop_expand_cancel(ViewDir *vd) { - if (VDTREE_INFO(vdt, drop_expand_id) != -1) g_source_remove(VDTREE_INFO(vdt, drop_expand_id)); - VDTREE_INFO(vdt, drop_expand_id) = -1; + if (VDTREE_INFO(vd, drop_expand_id) != -1) g_source_remove(VDTREE_INFO(vd, drop_expand_id)); + VDTREE_INFO(vd, drop_expand_id) = -1; } -static void vdtree_dnd_drop_expand(ViewDir *vdt) +static void vdtree_dnd_drop_expand(ViewDir *vd) { - vdtree_dnd_drop_expand_cancel(vdt); - VDTREE_INFO(vdt, drop_expand_id) = g_timeout_add(1000, vdtree_dnd_drop_expand_cb, vdt); + vdtree_dnd_drop_expand_cancel(vd); + VDTREE_INFO(vd, drop_expand_id) = g_timeout_add(1000, vdtree_dnd_drop_expand_cb, vd); } -static void vdtree_drop_update(ViewDir *vdt, gint x, gint y) +static void vdtree_drop_update(ViewDir *vd, gint x, gint y) { GtkTreePath *tpath; GtkTreeIter iter; FileData *fd = NULL; - if (gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(vdt->view), x, y, + if (gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(vd->view), x, y, &tpath, NULL, NULL, NULL)) { GtkTreeModel *store; NodeData *nd; - store = gtk_tree_view_get_model(GTK_TREE_VIEW(vdt->view)); + store = gtk_tree_view_get_model(GTK_TREE_VIEW(vd->view)); gtk_tree_model_get_iter(store, &iter, tpath); gtk_tree_model_get(store, &iter, DIR_COLUMN_POINTER, &nd, -1); gtk_tree_path_free(tpath); @@ -692,52 +692,52 @@ fd = (nd) ? nd->fd : NULL; } - if (fd != vdt->drop_fd) + if (fd != vd->drop_fd) { - vdtree_color_set(vdt, vdt->drop_fd, FALSE); - vdtree_color_set(vdt, fd, TRUE); - if (fd) vdtree_dnd_drop_expand(vdt); + vdtree_color_set(vd, vd->drop_fd, FALSE); + vdtree_color_set(vd, fd, TRUE); + if (fd) vdtree_dnd_drop_expand(vd); } - vdt->drop_fd = fd; + vd->drop_fd = fd; } -static void vdtree_dnd_drop_scroll_cancel(ViewDir *vdt) +static void vdtree_dnd_drop_scroll_cancel(ViewDir *vd) { - if (vdt->drop_scroll_id != -1) g_source_remove(vdt->drop_scroll_id); - vdt->drop_scroll_id = -1; + if (vd->drop_scroll_id != -1) g_source_remove(vd->drop_scroll_id); + vd->drop_scroll_id = -1; } static gint vdtree_auto_scroll_idle_cb(gpointer data) { - ViewDir *vdt = data; + ViewDir *vd = data; - if (vdt->drop_fd) + if (vd->drop_fd) { GdkWindow *window; gint x, y; gint w, h; - window = vdt->view->window; + window = vd->view->window; gdk_window_get_pointer(window, &x, &y, NULL); gdk_drawable_get_size(window, &w, &h); if (x >= 0 && x < w && y >= 0 && y < h) { - vdtree_drop_update(vdt, x, y); + vdtree_drop_update(vd, x, y); } } - vdt->drop_scroll_id = -1; + vd->drop_scroll_id = -1; return FALSE; } static gint vdtree_auto_scroll_notify_cb(GtkWidget *widget, gint x, gint y, gpointer data) { - ViewDir *vdt = data; + ViewDir *vd = data; - if (!vdt->drop_fd || vdt->drop_list) return FALSE; + if (!vd->drop_fd || vd->drop_list) return FALSE; - if (vdt->drop_scroll_id == -1) vdt->drop_scroll_id = g_idle_add(vdtree_auto_scroll_idle_cb, vdt); + if (vd->drop_scroll_id == -1) vd->drop_scroll_id = g_idle_add(vdtree_auto_scroll_idle_cb, vd); return TRUE; } @@ -745,11 +745,11 @@ static gint vdtree_dnd_drop_motion(GtkWidget *widget, GdkDragContext *context, gint x, gint y, guint time, gpointer data) { - ViewDir *vdt = data; + ViewDir *vd = data; - vdt->click_fd = NULL; + vd->click_fd = NULL; - if (gtk_drag_get_source_widget(context) == vdt->view) + if (gtk_drag_get_source_widget(context) == vd->view) { gdk_drag_status(context, 0, time); return TRUE; @@ -759,12 +759,12 @@ gdk_drag_status(context, context->suggested_action, time); } - vdtree_drop_update(vdt, x, y); + vdtree_drop_update(vd, x, y); - if (vdt->drop_fd) + if (vd->drop_fd) { - GtkAdjustment *adj = gtk_tree_view_get_vadjustment(GTK_TREE_VIEW(vdt->view)); - widget_auto_scroll_start(vdt->view, adj, -1, -1, vdtree_auto_scroll_notify_cb, vdt); + GtkAdjustment *adj = gtk_tree_view_get_vadjustment(GTK_TREE_VIEW(vd->view)); + widget_auto_scroll_start(vd->view, adj, -1, -1, vdtree_auto_scroll_notify_cb, vd); } return FALSE; @@ -772,34 +772,34 @@ static void vdtree_dnd_drop_leave(GtkWidget *widget, GdkDragContext *context, guint time, gpointer data) { - ViewDir *vdt = data; + ViewDir *vd = data; - if (vdt->drop_fd != vdt->click_fd) vdtree_color_set(vdt, vdt->drop_fd, FALSE); + if (vd->drop_fd != vd->click_fd) vdtree_color_set(vd, vd->drop_fd, FALSE); - vdt->drop_fd = NULL; + vd->drop_fd = NULL; - vdtree_dnd_drop_expand_cancel(vdt); + vdtree_dnd_drop_expand_cancel(vd); } -static void vdtree_dnd_init(ViewDir *vdt) +static void vdtree_dnd_init(ViewDir *vd) { - gtk_drag_source_set(vdt->view, GDK_BUTTON1_MASK | GDK_BUTTON2_MASK, + gtk_drag_source_set(vd->view, GDK_BUTTON1_MASK | GDK_BUTTON2_MASK, dnd_file_drag_types, dnd_file_drag_types_count, GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_ASK); - g_signal_connect(G_OBJECT(vdt->view), "drag_data_get", - G_CALLBACK(vdtree_dnd_get), vdt); - g_signal_connect(G_OBJECT(vdt->view), "drag_begin", - G_CALLBACK(vdtree_dnd_begin), vdt); - g_signal_connect(G_OBJECT(vdt->view), "drag_end", - G_CALLBACK(vdtree_dnd_end), vdt); + g_signal_connect(G_OBJECT(vd->view), "drag_data_get", + G_CALLBACK(vdtree_dnd_get), vd); + g_signal_connect(G_OBJECT(vd->view), "drag_begin", + G_CALLBACK(vdtree_dnd_begin), vd); + g_signal_connect(G_OBJECT(vd->view), "drag_end", + G_CALLBACK(vdtree_dnd_end), vd); - vdtree_dest_set(vdt, TRUE); - g_signal_connect(G_OBJECT(vdt->view), "drag_data_received", - G_CALLBACK(vdtree_dnd_drop_receive), vdt); - g_signal_connect(G_OBJECT(vdt->view), "drag_motion", - G_CALLBACK(vdtree_dnd_drop_motion), vdt); - g_signal_connect(G_OBJECT(vdt->view), "drag_leave", - G_CALLBACK(vdtree_dnd_drop_leave), vdt); + vdtree_dest_set(vd, TRUE); + g_signal_connect(G_OBJECT(vd->view), "drag_data_received", + G_CALLBACK(vdtree_dnd_drop_receive), vd); + g_signal_connect(G_OBJECT(vd->view), "drag_motion", + G_CALLBACK(vdtree_dnd_drop_motion), vd); + g_signal_connect(G_OBJECT(vd->view), "drag_leave", + G_CALLBACK(vdtree_dnd_drop_leave), vd); } /* @@ -860,14 +860,14 @@ g_list_free(list); } -static GList *parts_list_add_node_points(ViewDir *vdt, GList *list) +static GList *parts_list_add_node_points(ViewDir *vd, GList *list) { GList *work; GtkTreeModel *store; GtkTreeIter iter; gint valid; - store = gtk_tree_view_get_model(GTK_TREE_VIEW(vdt->view)); + store = gtk_tree_view_get_model(GTK_TREE_VIEW(vd->view)); valid = gtk_tree_model_get_iter_first(store, &iter); work = list; @@ -938,11 +938,11 @@ *---------------------------------------------------------------------------- */ -static gint vdtree_find_iter_by_data(ViewDir *vdt, GtkTreeIter *parent, NodeData *nd, GtkTreeIter *iter) +static gint vdtree_find_iter_by_data(ViewDir *vd, GtkTreeIter *parent, NodeData *nd, GtkTreeIter *iter) { GtkTreeModel *store; - store = gtk_tree_view_get_model(GTK_TREE_VIEW(vdt->view)); + store = gtk_tree_view_get_model(GTK_TREE_VIEW(vd->view)); if (!nd || !gtk_tree_model_iter_children(store, iter, parent)) return -1; do { NodeData *cnd; @@ -954,11 +954,11 @@ return FALSE; } -static NodeData *vdtree_find_iter_by_name(ViewDir *vdt, GtkTreeIter *parent, const gchar *name, GtkTreeIter *iter) +static NodeData *vdtree_find_iter_by_name(ViewDir *vd, GtkTreeIter *parent, const gchar *name, GtkTreeIter *iter) { GtkTreeModel *store; - store = gtk_tree_view_get_model(GTK_TREE_VIEW(vdt->view)); + store = gtk_tree_view_get_model(GTK_TREE_VIEW(vd->view)); if (!name || !gtk_tree_model_iter_children(store, iter, parent)) return NULL; do { NodeData *nd; @@ -970,7 +970,7 @@ return NULL; } -static void vdtree_add_by_data(ViewDir *vdt, FileData *fd, GtkTreeIter *parent) +static void vdtree_add_by_data(ViewDir *vd, FileData *fd, GtkTreeIter *parent) { GtkTreeStore *store; GtkTreeIter child; @@ -983,11 +983,11 @@ if (access_file(fd->path, R_OK | X_OK)) { - pixbuf = vdt->pf->close; + pixbuf = vd->pf->close; } else { - pixbuf = vdt->pf->deny; + pixbuf = vd->pf->deny; } nd = g_new0(NodeData, 1); @@ -995,7 +995,7 @@ nd->expanded = FALSE; nd->last_update = time(NULL); - store = GTK_TREE_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(vdt->view))); + store = GTK_TREE_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(vd->view))); gtk_tree_store_append(store, &child, parent); gtk_tree_store_set(store, &child, DIR_COLUMN_POINTER, nd, DIR_COLUMN_ICON, pixbuf, @@ -1020,16 +1020,16 @@ gtk_tree_model_get(GTK_TREE_MODEL(store), parent, DIR_COLUMN_POINTER, &pnd, -1); tpath = gtk_tree_model_get_path(GTK_TREE_MODEL(store), parent); if (options->tree_descend_subdirs && - gtk_tree_view_row_expanded(GTK_TREE_VIEW(vdt->view), tpath) && + gtk_tree_view_row_expanded(GTK_TREE_VIEW(vd->view), tpath) && !nd->expanded) { - vdtree_populate_path_by_iter(vdt, &child, FALSE, vdt->path); + vdtree_populate_path_by_iter(vd, &child, FALSE, vd->path); } gtk_tree_path_free(tpath); } } -static gint vdtree_populate_path_by_iter(ViewDir *vdt, GtkTreeIter *iter, gint force, const gchar *target_path) +static gint vdtree_populate_path_by_iter(ViewDir *vd, GtkTreeIter *iter, gint force, const gchar *target_path) { GtkTreeModel *store; GList *list; @@ -1039,7 +1039,7 @@ GtkTreeIter child; NodeData *nd; - store = gtk_tree_view_get_model(GTK_TREE_VIEW(vdt->view)); + store = gtk_tree_view_get_model(GTK_TREE_VIEW(vd->view)); gtk_tree_model_get(store, iter, DIR_COLUMN_POINTER, &nd, -1); if (!nd) return FALSE; @@ -1051,8 +1051,8 @@ if (!force && current_time - nd->last_update < 10) return TRUE; if (!isdir(nd->fd->path)) { - if (vdt->click_fd == nd->fd) vdt->click_fd = NULL; - if (vdt->drop_fd == nd->fd) vdt->drop_fd = NULL; + if (vd->click_fd == nd->fd) vd->click_fd = NULL; + if (vd->drop_fd == nd->fd) vd->drop_fd = NULL; gtk_tree_store_remove(GTK_TREE_STORE(store), iter); vdtree_node_free(nd); return FALSE; @@ -1060,7 +1060,7 @@ if (!force && filetime(nd->fd->path) == nd->fd->date) return TRUE; } - vdtree_busy_push(vdt); + vdtree_busy_push(vd); list = NULL; filelist_read(nd->fd->path, NULL, &list); @@ -1121,12 +1121,12 @@ { NodeData *cnd; - cnd = vdtree_find_iter_by_name(vdt, iter, fd->name, &child); + cnd = vdtree_find_iter_by_name(vd, iter, fd->name, &child); if (cnd) { old = g_list_remove(old, cnd); if (cnd->expanded && cnd->fd->date != fd->date && - vdtree_populate_path_by_iter(vdt, &child, FALSE, target_path)) + vdtree_populate_path_by_iter(vd, &child, FALSE, target_path)) { cnd->fd->size = fd->size; cnd->fd->date = fd->date; @@ -1136,7 +1136,7 @@ } else { - vdtree_add_by_data(vdt, fd, iter); + vdtree_add_by_data(vd, fd, iter); } } } @@ -1147,10 +1147,10 @@ NodeData *cnd = work->data; work = work->next; - if (vdt->click_fd == cnd->fd) vdt->click_fd = NULL; - if (vdt->drop_fd == cnd->fd) vdt->drop_fd = NULL; + if (vd->click_fd == cnd->fd) vd->click_fd = NULL; + if (vd->drop_fd == cnd->fd) vd->drop_fd = NULL; - if (vdtree_find_iter_by_data(vdt, iter, cnd, &child)) + if (vdtree_find_iter_by_data(vd, iter, cnd, &child)) { gtk_tree_store_remove(GTK_TREE_STORE(store), &child); vdtree_node_free(cnd); @@ -1160,7 +1160,7 @@ g_list_free(old); g_list_free(list); - vdtree_busy_pop(vdt); + vdtree_busy_pop(vd); nd->expanded = TRUE; nd->last_update = current_time; @@ -1168,7 +1168,7 @@ return TRUE; } -static FileData *vdtree_populate_path(ViewDir *vdt, const gchar *path, gint expand, gint force) +static FileData *vdtree_populate_path(ViewDir *vd, const gchar *path, gint expand, gint force) { GList *list; GList *work; @@ -1176,10 +1176,10 @@ if (!path) return NULL; - vdtree_busy_push(vdt); + vdtree_busy_push(vd); list = parts_list(path); - list = parts_list_add_node_points(vdt, list); + list = parts_list_add_node_points(vd, list); work = list; while (work) @@ -1197,19 +1197,19 @@ /* should not happen */ printf("vdtree warning, root node not found\n"); parts_list_free(list); - vdtree_busy_pop(vdt); + vdtree_busy_pop(vd); return NULL; } parent_pd = work->prev->data; - if (!vdtree_find_row(vdt, parent_pd->node, &parent_iter, NULL) || - !vdtree_populate_path_by_iter(vdt, &parent_iter, force, path) || - (nd = vdtree_find_iter_by_name(vdt, &parent_iter, pd->name, &iter)) == NULL) + if (!vdtree_find_row(vd, parent_pd->node, &parent_iter, NULL) || + !vdtree_populate_path_by_iter(vd, &parent_iter, force, path) || + (nd = vdtree_find_iter_by_name(vd, &parent_iter, pd->name, &iter)) == NULL) { printf("vdtree warning, aborted at %s\n", parent_pd->name); parts_list_free(list); - vdtree_busy_pop(vdt); + vdtree_busy_pop(vd); return NULL; } @@ -1219,20 +1219,20 @@ { if (expand) { - vdtree_expand_by_iter(vdt, &parent_iter, TRUE); - vdtree_expand_by_iter(vdt, &iter, TRUE); + vdtree_expand_by_iter(vd, &parent_iter, TRUE); + vdtree_expand_by_iter(vd, &iter, TRUE); } - vdtree_populate_path_by_iter(vdt, &iter, force, path); + vdtree_populate_path_by_iter(vd, &iter, force, path); } } else { GtkTreeIter iter; - if (vdtree_find_row(vdt, pd->node, &iter, NULL)) + if (vdtree_find_row(vd, pd->node, &iter, NULL)) { - if (expand) vdtree_expand_by_iter(vdt, &iter, TRUE); - vdtree_populate_path_by_iter(vdt, &iter, force, path); + if (expand) vdtree_expand_by_iter(vd, &iter, TRUE); + vdtree_populate_path_by_iter(vd, &iter, force, path); } } @@ -1247,7 +1247,7 @@ } parts_list_free(list); - vdtree_busy_pop(vdt); + vdtree_busy_pop(vd); return fd; } @@ -1266,75 +1266,75 @@ return selection_is_ok; } -static void vdtree_select_row(ViewDir *vdt, FileData *fd) +static void vdtree_select_row(ViewDir *vd, FileData *fd) { GtkTreeSelection *selection; GtkTreeIter iter; - if (!vdtree_find_row(vdt, fd, &iter, NULL)) return; - selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(vdt->view)); + if (!vdtree_find_row(vd, fd, &iter, NULL)) return; + selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(vd->view)); /* hack, such that selection is only allowed to be changed from here */ selection_is_ok = TRUE; gtk_tree_selection_select_iter(selection, &iter); selection_is_ok = FALSE; - if (!vdtree_populate_path_by_iter(vdt, &iter, FALSE, vdt->path)) return; + if (!vdtree_populate_path_by_iter(vd, &iter, FALSE, vd->path)) return; - vdtree_expand_by_iter(vdt, &iter, TRUE); + vdtree_expand_by_iter(vd, &iter, TRUE); - if (fd && vdt->select_func) + if (fd && vd->select_func) { - vdt->select_func(vdt, fd->path, vdt->select_data); + vd->select_func(vd, fd->path, vd->select_data); } } -gint vdtree_set_path(ViewDir *vdt, const gchar *path) +gint vdtree_set_path(ViewDir *vd, const gchar *path) { FileData *fd; GtkTreeIter iter; if (!path) return FALSE; - if (vdt->path && strcmp(path, vdt->path) == 0) return TRUE; + if (vd->path && strcmp(path, vd->path) == 0) return TRUE; - g_free(vdt->path); - vdt->path = g_strdup(path); + g_free(vd->path); + vd->path = g_strdup(path); - fd = vdtree_populate_path(vdt, vdt->path, TRUE, FALSE); + fd = vdtree_populate_path(vd, vd->path, TRUE, FALSE); if (!fd) return FALSE; - if (vdtree_find_row(vdt, fd, &iter, NULL)) + if (vdtree_find_row(vd, fd, &iter, NULL)) { GtkTreeModel *store; GtkTreePath *tpath; - tree_view_row_make_visible(GTK_TREE_VIEW(vdt->view), &iter, TRUE); + tree_view_row_make_visible(GTK_TREE_VIEW(vd->view), &iter, TRUE); - store = gtk_tree_view_get_model(GTK_TREE_VIEW(vdt->view)); + store = gtk_tree_view_get_model(GTK_TREE_VIEW(vd->view)); tpath = gtk_tree_model_get_path(store, &iter); - gtk_tree_view_set_cursor(GTK_TREE_VIEW(vdt->view), tpath, NULL, FALSE); + gtk_tree_view_set_cursor(GTK_TREE_VIEW(vd->view), tpath, NULL, FALSE); gtk_tree_path_free(tpath); - vdtree_select_row(vdt, fd); + vdtree_select_row(vd, fd); } return TRUE; } #if 0 -const gchar *vdtree_get_path(ViewDir *vdt) +const gchar *vdtree_get_path(ViewDir *vd) { - return vdt->path; + return vd->path; } #endif -void vdtree_refresh(ViewDir *vdt) +void vdtree_refresh(ViewDir *vd) { - vdtree_populate_path(vdt, vdt->path, FALSE, TRUE); + vdtree_populate_path(vd, vd->path, FALSE, TRUE); } -const gchar *vdtree_row_get_path(ViewDir *vdt, gint row) +const gchar *vdtree_row_get_path(ViewDir *vd, gint row) { printf("FIXME: no get row path\n"); return NULL; @@ -1348,16 +1348,16 @@ static void vdtree_menu_position_cb(GtkMenu *menu, gint *x, gint *y, gboolean *push_in, gpointer data) { - ViewDir *vdt = data; + ViewDir *vd = data; GtkTreeModel *store; GtkTreeIter iter; GtkTreePath *tpath; gint cw, ch; - if (vdtree_find_row(vdt, vdt->click_fd, &iter, NULL) < 0) return; - store = gtk_tree_view_get_model(GTK_TREE_VIEW(vdt->view)); + if (vdtree_find_row(vd, vd->click_fd, &iter, NULL) < 0) return; + store = gtk_tree_view_get_model(GTK_TREE_VIEW(vd->view)); tpath = gtk_tree_model_get_path(store, &iter); - tree_view_get_cell_clamped(GTK_TREE_VIEW(vdt->view), tpath, 0, TRUE, x, y, &cw, &ch); + tree_view_get_cell_clamped(GTK_TREE_VIEW(vd->view), tpath, 0, TRUE, x, y, &cw, &ch); gtk_tree_path_free(tpath); *y += ch; popup_menu_position_clamp(menu, x, y, 0); @@ -1365,12 +1365,12 @@ static gint vdtree_press_key_cb(GtkWidget *widget, GdkEventKey *event, gpointer data) { - ViewDir *vdt = data; + ViewDir *vd = data; GtkTreePath *tpath; GtkTreeIter iter; FileData *fd = NULL; - gtk_tree_view_get_cursor(GTK_TREE_VIEW(vdt->view), &tpath, NULL); + gtk_tree_view_get_cursor(GTK_TREE_VIEW(vd->view), &tpath, NULL); if (tpath) { GtkTreeModel *store; @@ -1388,11 +1388,11 @@ switch (event->keyval) { case GDK_Menu: - vdt->click_fd = fd; - vdtree_color_set(vdt, vdt->click_fd, TRUE); + vd->click_fd = fd; + vdtree_color_set(vd, vd->click_fd, TRUE); - vdt->popup = vdtree_pop_menu(vdt, vdt->click_fd); - gtk_menu_popup(GTK_MENU(vdt->popup), NULL, NULL, vdtree_menu_position_cb, vdt, 0, GDK_CURRENT_TIME); + vd->popup = vdtree_pop_menu(vd, vd->click_fd); + gtk_menu_popup(GTK_MENU(vd->popup), NULL, NULL, vdtree_menu_position_cb, vd, 0, GDK_CURRENT_TIME); return TRUE; break; @@ -1401,8 +1401,8 @@ case GDK_KP_Add: if (fd) { - vdtree_populate_path_by_iter(vdt, &iter, FALSE, vdt->path); - vdtree_icon_set_by_iter(vdt, &iter, vdt->pf->open); + vdtree_populate_path_by_iter(vd, &iter, FALSE, vd->path); + vdtree_icon_set_by_iter(vd, &iter, vd->pf->open); } break; } @@ -1436,7 +1436,7 @@ static gint vdtree_press_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data) { - ViewDir *vdt = data; + ViewDir *vd = data; GtkTreePath *tpath; GtkTreeViewColumn *column; GtkTreeIter iter; @@ -1455,17 +1455,17 @@ if (vdtree_clicked_on_expander(GTK_TREE_VIEW(widget), tpath, column, bevent->x, bevent->y, &left_of_expander)) { - vdt->click_fd = NULL; + vd->click_fd = NULL; /* clicking this region should automatically reveal an expander, if necessary * treeview bug: the expander will not expand until a button_motion_event highlights it. */ if (bevent->button == 1 && !left_of_expander && - !gtk_tree_view_row_expanded(GTK_TREE_VIEW(vdt->view), tpath)) + !gtk_tree_view_row_expanded(GTK_TREE_VIEW(vd->view), tpath)) { - vdtree_populate_path_by_iter(vdt, &iter, FALSE, vdt->path); - vdtree_icon_set_by_iter(vdt, &iter, vdt->pf->open); + vdtree_populate_path_by_iter(vd, &iter, FALSE, vd->path); + vdtree_icon_set_by_iter(vd, &iter, vd->pf->open); } gtk_tree_path_free(tpath); @@ -1475,13 +1475,13 @@ gtk_tree_path_free(tpath); } - vdt->click_fd = (nd) ? nd->fd : NULL; - vdtree_color_set(vdt, vdt->click_fd, TRUE); + vd->click_fd = (nd) ? nd->fd : NULL; + vdtree_color_set(vd, vd->click_fd, TRUE); if (bevent->button == 3) { - vdt->popup = vdtree_pop_menu(vdt, vdt->click_fd); - gtk_menu_popup(GTK_MENU(vdt->popup), NULL, NULL, NULL, NULL, + vd->popup = vdtree_pop_menu(vd, vd->click_fd); + gtk_menu_popup(GTK_MENU(vd->popup), NULL, NULL, NULL, NULL, bevent->button, bevent->time); } @@ -1490,13 +1490,13 @@ static gint vdtree_release_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data) { - ViewDir *vdt = data; + ViewDir *vd = data; GtkTreePath *tpath; GtkTreeIter iter; NodeData *nd = NULL; - if (!vdt->click_fd) return FALSE; - vdtree_color_set(vdt, vdt->click_fd, FALSE); + if (!vd->click_fd) return FALSE; + vdtree_color_set(vd, vd->click_fd, FALSE); if (bevent->button != 1) return TRUE; @@ -1512,9 +1512,9 @@ gtk_tree_path_free(tpath); } - if (nd && vdt->click_fd == nd->fd) + if (nd && vd->click_fd == nd->fd) { - vdtree_select_row(vdt, vdt->click_fd); + vdtree_select_row(vd, vd->click_fd); } return FALSE; @@ -1522,17 +1522,17 @@ static void vdtree_row_expanded(GtkTreeView *treeview, GtkTreeIter *iter, GtkTreePath *tpath, gpointer data) { - ViewDir *vdt = data; + ViewDir *vd = data; - vdtree_populate_path_by_iter(vdt, iter, FALSE, NULL); - vdtree_icon_set_by_iter(vdt, iter, vdt->pf->open); + vdtree_populate_path_by_iter(vd, iter, FALSE, NULL); + vdtree_icon_set_by_iter(vd, iter, vd->pf->open); } static void vdtree_row_collapsed(GtkTreeView *treeview, GtkTreeIter *iter, GtkTreePath *tpath, gpointer data) { - ViewDir *vdt = data; + ViewDir *vd = data; - vdtree_icon_set_by_iter(vdt, iter, vdt->pf->close); + vdtree_icon_set_by_iter(vd, iter, vd->pf->close); } static gint vdtree_sort_cb(GtkTreeModel *store, GtkTreeIter *a, GtkTreeIter *b, gpointer data) @@ -1552,22 +1552,22 @@ *---------------------------------------------------------------------------- */ -static void vdtree_setup_root(ViewDir *vdt) +static void vdtree_setup_root(ViewDir *vd) { const gchar *path = "/"; FileData *fd; fd = file_data_new_simple(path); - vdtree_add_by_data(vdt, fd, NULL); + vdtree_add_by_data(vd, fd, NULL); - vdtree_expand_by_data(vdt, fd, TRUE); - vdtree_populate_path(vdt, path, FALSE, FALSE); + vdtree_expand_by_data(vd, fd, TRUE); + vdtree_populate_path(vd, path, FALSE, FALSE); } static void vdtree_activate_cb(GtkTreeView *tview, GtkTreePath *tpath, GtkTreeViewColumn *column, gpointer data) { - ViewDir *vdt = data; + ViewDir *vd = data; GtkTreeModel *store; GtkTreeIter iter; NodeData *nd; @@ -1576,7 +1576,7 @@ gtk_tree_model_get_iter(store, &iter, tpath); gtk_tree_model_get(store, &iter, DIR_COLUMN_POINTER, &nd, -1); - vdtree_select_row(vdt, nd->fd); + vdtree_select_row(vd, nd->fd); } static GdkColor *vdtree_color_shifted(GtkWidget *widget) @@ -1600,12 +1600,12 @@ static void vdtree_color_cb(GtkTreeViewColumn *tree_column, GtkCellRenderer *cell, GtkTreeModel *tree_model, GtkTreeIter *iter, gpointer data) { - ViewDir *vdt = data; + ViewDir *vd = data; gboolean set; gtk_tree_model_get(tree_model, iter, DIR_COLUMN_COLOR, &set, -1); g_object_set(G_OBJECT(cell), - "cell-background-gdk", vdtree_color_shifted(vdt->view), + "cell-background-gdk", vdtree_color_shifted(vd->view), "cell-background-set", set, NULL); } @@ -1621,87 +1621,87 @@ static void vdtree_destroy_cb(GtkWidget *widget, gpointer data) { - ViewDir *vdt = data; + ViewDir *vd = data; GtkTreeModel *store; - if (vdt->popup) + if (vd->popup) { - g_signal_handlers_disconnect_matched(G_OBJECT(vdt->popup), G_SIGNAL_MATCH_DATA, - 0, 0, 0, NULL, vdt); - gtk_widget_destroy(vdt->popup); + g_signal_handlers_disconnect_matched(G_OBJECT(vd->popup), G_SIGNAL_MATCH_DATA, + 0, 0, 0, NULL, vd); + gtk_widget_destroy(vd->popup); } - vdtree_dnd_drop_expand_cancel(vdt); - vdtree_dnd_drop_scroll_cancel(vdt); - widget_auto_scroll_stop(vdt->view); + vdtree_dnd_drop_expand_cancel(vd); + vdtree_dnd_drop_scroll_cancel(vd); + widget_auto_scroll_stop(vd->view); - store = gtk_tree_view_get_model(GTK_TREE_VIEW(vdt->view)); - gtk_tree_model_foreach(store, vdtree_destroy_node_cb, vdt); + store = gtk_tree_view_get_model(GTK_TREE_VIEW(vd->view)); + gtk_tree_model_foreach(store, vdtree_destroy_node_cb, vd); - filelist_free(vdt->drop_list); + filelist_free(vd->drop_list); - folder_icons_free(vdt->pf); + folder_icons_free(vd->pf); - g_free(vdt->path); - g_free(vdt->info); - g_free(vdt); + g_free(vd->path); + g_free(vd->info); + g_free(vd); } ViewDir *vdtree_new(const gchar *path) { - ViewDir *vdt; + ViewDir *vd; GtkTreeStore *store; GtkTreeSelection *selection; GtkTreeViewColumn *column; GtkCellRenderer *renderer; - vdt = g_new0(ViewDir, 1); - vdt->info = g_new0(ViewDirInfoTree, 1); - vdt->type = DIRVIEW_TREE; + vd = g_new0(ViewDir, 1); + vd->info = g_new0(ViewDirInfoTree, 1); + vd->type = DIRVIEW_TREE; - vdt->path = NULL; - vdt->click_fd = NULL; + vd->path = NULL; + vd->click_fd = NULL; - vdt->drop_fd = NULL; - vdt->drop_list = NULL; - vdt->drop_scroll_id = -1; - VDTREE_INFO(vdt, drop_expand_id) = -1; + vd->drop_fd = NULL; + vd->drop_list = NULL; + vd->drop_scroll_id = -1; + VDTREE_INFO(vd, drop_expand_id) = -1; - vdt->popup = NULL; + vd->popup = NULL; - VDTREE_INFO(vdt, busy_ref) = 0; + VDTREE_INFO(vd, busy_ref) = 0; - vdt->widget = gtk_scrolled_window_new(NULL, NULL); - gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(vdt->widget), GTK_SHADOW_IN); - gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(vdt->widget), + 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), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); - g_signal_connect(G_OBJECT(vdt->widget), "destroy", - G_CALLBACK(vdtree_destroy_cb), vdt); + g_signal_connect(G_OBJECT(vd->widget), "destroy", + G_CALLBACK(vdtree_destroy_cb), vd); store = gtk_tree_store_new(4, G_TYPE_POINTER, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_INT); - vdt->view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store)); + vd->view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store)); g_object_unref(store); - gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(vdt->view), FALSE); - gtk_tree_view_set_enable_search(GTK_TREE_VIEW(vdt->view), FALSE); - gtk_tree_sortable_set_default_sort_func(GTK_TREE_SORTABLE(store), vdtree_sort_cb, vdt, NULL); + gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(vd->view), FALSE); + gtk_tree_view_set_enable_search(GTK_TREE_VIEW(vd->view), FALSE); + gtk_tree_sortable_set_default_sort_func(GTK_TREE_SORTABLE(store), vdtree_sort_cb, vd, NULL); gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(store), GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, GTK_SORT_ASCENDING); - g_signal_connect(G_OBJECT(vdt->view), "row_activated", - G_CALLBACK(vdtree_activate_cb), vdt); - g_signal_connect(G_OBJECT(vdt->view), "row_expanded", - G_CALLBACK(vdtree_row_expanded), vdt); - g_signal_connect(G_OBJECT(vdt->view), "row_collapsed", - G_CALLBACK(vdtree_row_collapsed), vdt); + g_signal_connect(G_OBJECT(vd->view), "row_activated", + G_CALLBACK(vdtree_activate_cb), vd); + g_signal_connect(G_OBJECT(vd->view), "row_expanded", + G_CALLBACK(vdtree_row_expanded), vd); + g_signal_connect(G_OBJECT(vd->view), "row_collapsed", + G_CALLBACK(vdtree_row_collapsed), vd); #if 0 g_signal_connect(G_OBJECT(store), "row_deleted", - G_CALLBACK(vdtree_row_deleted_cb), vdt); + G_CALLBACK(vdtree_row_deleted_cb), vd); #endif - selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(vdt->view)); + selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(vd->view)); gtk_tree_selection_set_mode(selection, GTK_SELECTION_SINGLE); - gtk_tree_selection_set_select_function(selection, vdtree_select_cb, vdt, NULL); + gtk_tree_selection_set_select_function(selection, vdtree_select_cb, vd, NULL); column = gtk_tree_view_column_new(); gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_GROW_ONLY); @@ -1709,44 +1709,44 @@ renderer = gtk_cell_renderer_pixbuf_new(); gtk_tree_view_column_pack_start(column, renderer, FALSE); gtk_tree_view_column_add_attribute(column, renderer, "pixbuf", DIR_COLUMN_ICON); - gtk_tree_view_column_set_cell_data_func(column, renderer, vdtree_color_cb, vdt, NULL); + gtk_tree_view_column_set_cell_data_func(column, renderer, vdtree_color_cb, vd, NULL); renderer = gtk_cell_renderer_text_new(); gtk_tree_view_column_pack_start(column, renderer, TRUE); gtk_tree_view_column_add_attribute(column, renderer, "text", DIR_COLUMN_NAME); - gtk_tree_view_column_set_cell_data_func(column, renderer, vdtree_color_cb, vdt, NULL); + gtk_tree_view_column_set_cell_data_func(column, renderer, vdtree_color_cb, vd, NULL); - gtk_tree_view_append_column(GTK_TREE_VIEW(vdt->view), column); + gtk_tree_view_append_column(GTK_TREE_VIEW(vd->view), column); - g_signal_connect(G_OBJECT(vdt->view), "key_press_event", - G_CALLBACK(vdtree_press_key_cb), vdt); + g_signal_connect(G_OBJECT(vd->view), "key_press_event", + G_CALLBACK(vdtree_press_key_cb), vd); - gtk_container_add(GTK_CONTAINER(vdt->widget), vdt->view); - gtk_widget_show(vdt->view); + gtk_container_add(GTK_CONTAINER(vd->widget), vd->view); + gtk_widget_show(vd->view); - vdt->pf = folder_icons_new(); + vd->pf = folder_icons_new(); - vdtree_setup_root(vdt); + vdtree_setup_root(vd); - vdtree_dnd_init(vdt); + vdtree_dnd_init(vd); - g_signal_connect(G_OBJECT(vdt->view), "button_press_event", - G_CALLBACK(vdtree_press_cb), vdt); - g_signal_connect(G_OBJECT(vdt->view), "button_release_event", - G_CALLBACK(vdtree_release_cb), vdt); + g_signal_connect(G_OBJECT(vd->view), "button_press_event", + G_CALLBACK(vdtree_press_cb), vd); + g_signal_connect(G_OBJECT(vd->view), "button_release_event", + G_CALLBACK(vdtree_release_cb), vd); - vdtree_set_path(vdt, path); + vdtree_set_path(vd, path); - return vdt; + return vd; } #if 0 -void vdtree_set_click_func(ViewDir *vdt, - void (*func)(ViewDir *vdt, GdkEventButton *event, FileData *fd, gpointer), gpointer data) +void vdtree_set_click_func(ViewDir *vd, + void (*func)(ViewDir *vd, GdkEventButton *event, FileData *fd, gpointer), gpointer data) { if (!td) return; - vdt->click_func = func; - vdt->click_data = data; + vd->click_func = func; + vd->click_data = data; } #endif