Mercurial > geeqie
changeset 381:ff63dcb0425c
Rename vdl occurences to vd.
author | zas_ |
---|---|
date | Wed, 16 Apr 2008 14:51:39 +0000 |
parents | 5afe77bb563a |
children | eceeced4cbb9 |
files | src/view_dir_list.c |
diffstat | 1 files changed, 288 insertions(+), 288 deletions(-) [+] |
line wrap: on
line diff
--- a/src/view_dir_list.c Wed Apr 16 14:45:22 2008 +0000 +++ b/src/view_dir_list.c Wed Apr 16 14:51:39 2008 +0000 @@ -42,13 +42,13 @@ *----------------------------------------------------------------------------- */ -static gint vdlist_find_row(ViewDir *vdl, FileData *fd, GtkTreeIter *iter) +static gint vdlist_find_row(ViewDir *vd, FileData *fd, GtkTreeIter *iter) { GtkTreeModel *store; gint valid; gint row = 0; - store = gtk_tree_view_get_model(GTK_TREE_VIEW(vdl->view)); + store = gtk_tree_view_get_model(GTK_TREE_VIEW(vd->view)); valid = gtk_tree_model_get_iter_first(store, iter); while (valid) { @@ -65,7 +65,7 @@ static gint vdlist_rename_row_cb(TreeEditData *td, const gchar *old, const gchar *new, gpointer data) { - ViewDir *vdl = data; + ViewDir *vd = data; GtkTreeModel *store; GtkTreeIter iter; FileData *fd; @@ -73,7 +73,7 @@ gchar *new_path; gchar *base; - store = gtk_tree_view_get_model(GTK_TREE_VIEW(vdl->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, &fd, -1); if (!fd) return FALSE; @@ -84,15 +84,15 @@ new_path = concat_dir_and_file(base, new); g_free(base); - if (file_util_rename_dir(fd, new_path, vdl->view)) + if (file_util_rename_dir(fd, new_path, vd->view)) { - if (vdl->layout && strcmp(vdl->path, old_path) == 0) + if (vd->layout && strcmp(vd->path, old_path) == 0) { - layout_set_path(vdl->layout, new_path); + layout_set_path(vd->layout, new_path); } else { - vdlist_refresh(vdl); + vdlist_refresh(vd); } } @@ -101,22 +101,22 @@ return FALSE; } -static void vdlist_rename_by_row(ViewDir *vdl, FileData *fd) +static void vdlist_rename_by_row(ViewDir *vd, FileData *fd) { GtkTreeModel *store; GtkTreePath *tpath; GtkTreeIter iter; - if (vdlist_find_row(vdl, fd, &iter) < 0) return; - store = gtk_tree_view_get_model(GTK_TREE_VIEW(vdl->view)); + if (vdlist_find_row(vd, fd, &iter) < 0) return; + 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(vdl->view), tpath, 0, fd->name, - vdlist_rename_row_cb, vdl); + tree_edit_by_path(GTK_TREE_VIEW(vd->view), tpath, 0, fd->name, + vdlist_rename_row_cb, vd); gtk_tree_path_free(tpath); } -static FileData *vdlist_row_by_path(ViewDir *vdl, const gchar *path, gint *row) +static FileData *vdlist_row_by_path(ViewDir *vd, const gchar *path, gint *row) { GList *work; gint n; @@ -128,7 +128,7 @@ } n = 0; - work = VDLIST_INFO(vdl, list); + work = VDLIST_INFO(vd, list); while (work) { FileData *fd = work->data; @@ -145,13 +145,13 @@ return NULL; } -static void vdlist_color_set(ViewDir *vdl, FileData *fd, gint color_set) +static void vdlist_color_set(ViewDir *vd, FileData *fd, gint color_set) { GtkTreeModel *store; GtkTreeIter iter; - if (vdlist_find_row(vdl, fd, &iter) < 0) return; - store = gtk_tree_view_get_model(GTK_TREE_VIEW(vdl->view)); + if (vdlist_find_row(vd, fd, &iter) < 0) return; + store = gtk_tree_view_get_model(GTK_TREE_VIEW(vd->view)); gtk_list_store_set(GTK_LIST_STORE(store), &iter, DIR_COLUMN_COLOR, color_set, -1); } @@ -163,49 +163,49 @@ static void vdlist_drop_menu_copy_cb(GtkWidget *widget, gpointer data) { - ViewDir *vdl = data; + ViewDir *vd = data; const gchar *path; GList *list; - if (!vdl->drop_fd) return; + if (!vd->drop_fd) return; - path = vdl->drop_fd->path; - list = vdl->drop_list; - vdl->drop_list = NULL; + path = vd->drop_fd->path; + list = vd->drop_list; + vd->drop_list = NULL; file_util_copy_simple(list, path); } static void vdlist_drop_menu_move_cb(GtkWidget *widget, gpointer data) { - ViewDir *vdl = data; + ViewDir *vd = data; const gchar *path; GList *list; - if (!vdl->drop_fd) return; + if (!vd->drop_fd) return; - path = vdl->drop_fd->path; - list = vdl->drop_list; + path = vd->drop_fd->path; + list = vd->drop_list; - vdl->drop_list = NULL; + vd->drop_list = NULL; file_util_move_simple(list, path); } -static GtkWidget *vdlist_drop_menu(ViewDir *vdl, gint active) +static GtkWidget *vdlist_drop_menu(ViewDir *vd, gint active) { GtkWidget *menu; menu = popup_menu_short_lived(); g_signal_connect(G_OBJECT(menu), "destroy", - G_CALLBACK(vdlist_popup_destroy_cb), vdl); + G_CALLBACK(vdlist_popup_destroy_cb), vd); menu_item_add_stock_sensitive(menu, _("_Copy"), GTK_STOCK_COPY, active, - G_CALLBACK(vdlist_drop_menu_copy_cb), vdl); - menu_item_add_sensitive(menu, _("_Move"), active, G_CALLBACK(vdlist_drop_menu_move_cb), vdl); + G_CALLBACK(vdlist_drop_menu_copy_cb), vd); + menu_item_add_sensitive(menu, _("_Move"), active, G_CALLBACK(vdlist_drop_menu_move_cb), vd); menu_item_add_divider(menu); - menu_item_add_stock(menu, _("Cancel"), GTK_STOCK_CANCEL, NULL, vdl); + menu_item_add_stock(menu, _("Cancel"), GTK_STOCK_CANCEL, NULL, vd); return menu; } @@ -218,15 +218,15 @@ static void vdlist_pop_menu_up_cb(GtkWidget *widget, gpointer data) { - ViewDir *vdl = data; + ViewDir *vd = data; gchar *path; - if (!vdl->path || strcmp(vdl->path, "/") == 0) return; - path = remove_level_from_path(vdl->path); + if (!vd->path || strcmp(vd->path, "/") == 0) return; + path = remove_level_from_path(vd->path); - if (vdl->select_func) + if (vd->select_func) { - vdl->select_func(vdl, path, vdl->select_data); + vd->select_func(vd, path, vd->select_data); } g_free(path); @@ -234,53 +234,53 @@ static void vdlist_pop_menu_slide_cb(GtkWidget *widget, gpointer data) { - ViewDir *vdl = data; + ViewDir *vd = data; gchar *path; - if (!vdl->layout || !vdl->click_fd) return; + if (!vd->layout || !vd->click_fd) return; - path = g_strdup(vdl->click_fd->path); + path = g_strdup(vd->click_fd->path); - layout_set_path(vdl->layout, path); - layout_select_none(vdl->layout); - layout_image_slideshow_stop(vdl->layout); - layout_image_slideshow_start(vdl->layout); + layout_set_path(vd->layout, path); + layout_select_none(vd->layout); + layout_image_slideshow_stop(vd->layout); + layout_image_slideshow_start(vd->layout); g_free(path); } static void vdlist_pop_menu_slide_rec_cb(GtkWidget *widget, gpointer data) { - ViewDir *vdl = data; + ViewDir *vd = data; gchar *path; GList *list; - if (!vdl->layout || !vdl->click_fd) return; + if (!vd->layout || !vd->click_fd) return; - path = g_strdup(vdl->click_fd->path); + path = g_strdup(vd->click_fd->path); list = filelist_recursive(path); - layout_image_slideshow_stop(vdl->layout); - layout_image_slideshow_start_from_list(vdl->layout, list); + layout_image_slideshow_stop(vd->layout); + layout_image_slideshow_start_from_list(vd->layout, list); g_free(path); } -static void vdlist_pop_menu_dupe(ViewDir *vdl, gint recursive) +static void vdlist_pop_menu_dupe(ViewDir *vd, gint recursive) { DupeWindow *dw; GList *list = NULL; - if (!vdl->click_fd) return; + if (!vd->click_fd) return; if (recursive) { - list = g_list_append(list, file_data_ref(vdl->click_fd)); + list = g_list_append(list, file_data_ref(vd->click_fd)); } else { - filelist_read(vdl->click_fd->path, &list, NULL); + filelist_read(vd->click_fd->path, &list, NULL); list = filelist_filter(list, FALSE); } @@ -292,25 +292,25 @@ static void vdlist_pop_menu_dupe_cb(GtkWidget *widget, gpointer data) { - ViewDir *vdl = data; - vdlist_pop_menu_dupe(vdl, FALSE); + ViewDir *vd = data; + vdlist_pop_menu_dupe(vd, FALSE); } static void vdlist_pop_menu_dupe_rec_cb(GtkWidget *widget, gpointer data) { - ViewDir *vdl = data; - vdlist_pop_menu_dupe(vdl, TRUE); + ViewDir *vd = data; + vdlist_pop_menu_dupe(vd, TRUE); } static void vdlist_pop_menu_new_cb(GtkWidget *widget, gpointer data) { - ViewDir *vdl = data; + ViewDir *vd = data; gchar *new_path; gchar *buf; - if (!vdl->path) return; + if (!vd->path) return; - buf = concat_dir_and_file(vdl->path, _("new_folder")); + buf = concat_dir_and_file(vd->path, _("new_folder")); new_path = unique_filename(buf, NULL, NULL, FALSE); g_free(buf); if (!new_path) return; @@ -320,17 +320,17 @@ 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, vdl->view); + file_util_warning_dialog(_("Error creating folder"), text, GTK_STOCK_DIALOG_ERROR, vd->view); g_free(text); } else { FileData *fd; - vdlist_refresh(vdl); - fd = vdlist_row_by_path(vdl, new_path, NULL); + vdlist_refresh(vd); + fd = vdlist_row_by_path(vd, new_path, NULL); - vdlist_rename_by_row(vdl, fd); + vdlist_rename_by_row(vd, fd); } g_free(new_path); @@ -338,42 +338,42 @@ static void vdlist_pop_menu_rename_cb(GtkWidget *widget, gpointer data) { - ViewDir *vdl = data; + ViewDir *vd = data; - vdlist_rename_by_row(vdl, vdl->click_fd); + vdlist_rename_by_row(vd, vd->click_fd); } static void vdlist_pop_menu_delete_cb(GtkWidget *widget, gpointer data) { - ViewDir *vdl = data; + ViewDir *vd = data; - if (!vdl->click_fd) return; - file_util_delete_dir(vdl->click_fd, vdl->widget); + if (!vd->click_fd) return; + file_util_delete_dir(vd->click_fd, vd->widget); } static void vdlist_pop_menu_dir_view_as_cb(GtkWidget *widget, gpointer data) { - ViewDir *vdl = data; + ViewDir *vd = data; - if (vdl->layout) layout_views_set(vdl->layout, DIRVIEW_TREE, vdl->layout->icon_view); + if (vd->layout) layout_views_set(vd->layout, DIRVIEW_TREE, vd->layout->icon_view); } static void vdlist_pop_menu_refresh_cb(GtkWidget *widget, gpointer data) { - ViewDir *vdl = data; + ViewDir *vd = data; - if (vdl->layout) layout_refresh(vdl->layout); + if (vd->layout) layout_refresh(vd->layout); } static void vdlist_toggle_show_hidden_files_cb(GtkWidget *widget, gpointer data) { - ViewDir *vdl = data; + ViewDir *vd = data; options->file_filter.show_hidden_files = !options->file_filter.show_hidden_files; - if (vdl->layout) layout_refresh(vdl->layout); + if (vd->layout) layout_refresh(vd->layout); } -static GtkWidget *vdlist_pop_menu(ViewDir *vdl, FileData *fd) +static GtkWidget *vdlist_pop_menu(ViewDir *vd, FileData *fd) { GtkWidget *menu; gint active; @@ -382,30 +382,30 @@ menu = popup_menu_short_lived(); g_signal_connect(G_OBJECT(menu), "destroy", - G_CALLBACK(vdlist_popup_destroy_cb), vdl); + G_CALLBACK(vdlist_popup_destroy_cb), vd); menu_item_add_stock_sensitive(menu, _("_Up to parent"), GTK_STOCK_GO_UP, - (vdl->path && strcmp(vdl->path, "/") != 0), - G_CALLBACK(vdlist_pop_menu_up_cb), vdl); + (vd->path && strcmp(vd->path, "/") != 0), + G_CALLBACK(vdlist_pop_menu_up_cb), vd); menu_item_add_divider(menu); menu_item_add_sensitive(menu, _("_Slideshow"), active, - G_CALLBACK(vdlist_pop_menu_slide_cb), vdl); + G_CALLBACK(vdlist_pop_menu_slide_cb), vd); menu_item_add_sensitive(menu, _("Slideshow recursive"), active, - G_CALLBACK(vdlist_pop_menu_slide_rec_cb), vdl); + G_CALLBACK(vdlist_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(vdlist_pop_menu_dupe_cb), vdl); + G_CALLBACK(vdlist_pop_menu_dupe_cb), vd); menu_item_add_stock_sensitive(menu, _("Find duplicates recursive..."), GTK_STOCK_FIND, active, - G_CALLBACK(vdlist_pop_menu_dupe_rec_cb), vdl); + G_CALLBACK(vdlist_pop_menu_dupe_rec_cb), vd); menu_item_add_divider(menu); /* check using . (always row 0) */ - active = (vdl->path && access_file(vdl->path , W_OK | X_OK)); + active = (vd->path && access_file(vd->path , W_OK | X_OK)); menu_item_add_sensitive(menu, _("_New folder..."), active, - G_CALLBACK(vdlist_pop_menu_new_cb), vdl); + G_CALLBACK(vdlist_pop_menu_new_cb), vd); /* ignore .. and . */ active = (active && fd && @@ -413,34 +413,34 @@ strcmp(fd->name, "..") != 0 && access_file(fd->path, W_OK | X_OK)); menu_item_add_sensitive(menu, _("_Rename..."), active, - G_CALLBACK(vdlist_pop_menu_rename_cb), vdl); + G_CALLBACK(vdlist_pop_menu_rename_cb), vd); menu_item_add_stock_sensitive(menu, _("_Delete..."), GTK_STOCK_DELETE, active, - G_CALLBACK(vdlist_pop_menu_delete_cb), vdl); + G_CALLBACK(vdlist_pop_menu_delete_cb), vd); menu_item_add_divider(menu); menu_item_add_check(menu, _("View as _tree"), FALSE, - G_CALLBACK(vdlist_pop_menu_dir_view_as_cb), vdl); + G_CALLBACK(vdlist_pop_menu_dir_view_as_cb), vd); menu_item_add_check(menu, _("Show _hidden files"), options->file_filter.show_hidden_files, - G_CALLBACK(vdlist_toggle_show_hidden_files_cb), vdl); + G_CALLBACK(vdlist_toggle_show_hidden_files_cb), vd); menu_item_add_stock(menu, _("Re_fresh"), GTK_STOCK_REFRESH, - G_CALLBACK(vdlist_pop_menu_refresh_cb), vdl); + G_CALLBACK(vdlist_pop_menu_refresh_cb), vd); return menu; } static void vdlist_popup_destroy_cb(GtkWidget *widget, gpointer data) { - ViewDir *vdl = data; + ViewDir *vd = data; - vdlist_color_set(vdl, vdl->click_fd, FALSE); - vdl->click_fd = NULL; - vdl->popup = NULL; + vdlist_color_set(vd, vd->click_fd, FALSE); + vd->click_fd = NULL; + vd->popup = NULL; - vdlist_color_set(vdl, vdl->drop_fd, FALSE); - filelist_free(vdl->drop_list); - vdl->drop_list = NULL; - vdl->drop_fd = NULL; + vdlist_color_set(vd, vd->drop_fd, FALSE); + filelist_free(vd->drop_list); + vd->drop_list = NULL; + vd->drop_fd = NULL; } /* @@ -454,18 +454,18 @@ }; static gint vdlist_dnd_drop_types_count = 1; -static void vdlist_dest_set(ViewDir *vdl, gint enable) +static void vdlist_dest_set(ViewDir *vd, gint enable) { if (enable) { - gtk_drag_dest_set(vdl->view, + gtk_drag_dest_set(vd->view, GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_DROP, vdlist_dnd_drop_types, vdlist_dnd_drop_types_count, GDK_ACTION_MOVE | GDK_ACTION_COPY); } else { - gtk_drag_dest_unset(vdl->view); + gtk_drag_dest_unset(vd->view); } } @@ -473,18 +473,18 @@ GtkSelectionData *selection_data, guint info, guint time, gpointer data) { - ViewDir *vdl = data; + ViewDir *vd = data; GList *list; gchar *text = NULL; gint length = 0; - if (!vdl->click_fd) return; + if (!vd->click_fd) return; switch (info) { case TARGET_URI_LIST: case TARGET_TEXT_PLAIN: - list = g_list_prepend(NULL, vdl->click_fd); + list = g_list_prepend(NULL, vd->click_fd); text = uri_text_from_filelist(list, &length, (info == TARGET_TEXT_PLAIN)); g_list_free(list); break; @@ -499,23 +499,23 @@ static void vdlist_dnd_begin(GtkWidget *widget, GdkDragContext *context, gpointer data) { - ViewDir *vdl = data; + ViewDir *vd = data; - vdlist_color_set(vdl, vdl->click_fd, TRUE); - vdlist_dest_set(vdl, FALSE); + vdlist_color_set(vd, vd->click_fd, TRUE); + vdlist_dest_set(vd, FALSE); } static void vdlist_dnd_end(GtkWidget *widget, GdkDragContext *context, gpointer data) { - ViewDir *vdl = data; + ViewDir *vd = data; - vdlist_color_set(vdl, vdl->click_fd, FALSE); + vdlist_color_set(vd, vd->click_fd, FALSE); if (context->action == GDK_ACTION_MOVE) { - vdlist_refresh(vdl); + vdlist_refresh(vd); } - vdlist_dest_set(vdl, TRUE); + vdlist_dest_set(vd, TRUE); } static void vdlist_dnd_drop_receive(GtkWidget *widget, @@ -523,12 +523,12 @@ GtkSelectionData *selection_data, guint info, guint time, gpointer data) { - ViewDir *vdl = data; + ViewDir *vd = data; GtkTreePath *tpath; GtkTreeIter iter; FileData *fd = NULL; - vdl->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)) @@ -553,17 +553,17 @@ active = access_file(fd->path, W_OK | X_OK); - vdlist_color_set(vdl, fd, TRUE); - vdl->popup = vdlist_drop_menu(vdl, active); - gtk_menu_popup(GTK_MENU(vdl->popup), NULL, NULL, NULL, NULL, 0, time); + vdlist_color_set(vd, fd, TRUE); + vd->popup = vdlist_drop_menu(vd, active); + gtk_menu_popup(GTK_MENU(vd->popup), NULL, NULL, NULL, NULL, 0, time); - vdl->drop_fd = fd; - vdl->drop_list = list; + vd->drop_fd = fd; + vd->drop_list = list; } } #if 0 -static gint vdlist_get_row_visibility(ViewDir *vdl, FileData *fd) +static gint vdlist_get_row_visibility(ViewDir *vd, FileData *fd) { GtkTreeModel *store; GtkTreeViewColumn *column; @@ -573,14 +573,14 @@ GdkRectangle vrect; GdkRectangle crect; - if (!fd || vdlist_find_row(vdl, fd, &iter) < 0) return 0; + if (!fd || vdlist_find_row(vd, fd, &iter) < 0) return 0; - column = gtk_tree_view_get_column(GTK_TREE_VIEW(vdl->view), 0); - store = gtk_tree_view_get_model(GTK_TREE_VIEW(vdl->view)); + column = gtk_tree_view_get_column(GTK_TREE_VIEW(vd->view), 0); + store = gtk_tree_view_get_model(GTK_TREE_VIEW(vd->view)); tpath = gtk_tree_model_get_path(store, &iter); - gtk_tree_view_get_visible_rect(GTK_TREE_VIEW(vdl->view), &vrect); - gtk_tree_view_get_cell_area(GTK_TREE_VIEW(vdl->view), tpath, column, &crect); + gtk_tree_view_get_visible_rect(GTK_TREE_VIEW(vd->view), &vrect); + gtk_tree_view_get_cell_area(GTK_TREE_VIEW(vd->view), tpath, column, &crect); printf("window: %d + %d; cell: %d + %d\n", vrect.y, vrect.height, crect.y, crect.height); gtk_tree_path_free(tpath); @@ -590,88 +590,88 @@ } #endif -static void vdlist_scroll_to_row(ViewDir *vdl, FileData *fd, gfloat y_align) +static void vdlist_scroll_to_row(ViewDir *vd, FileData *fd, gfloat y_align) { GtkTreeIter iter; - if (GTK_WIDGET_REALIZED(vdl->view) && - vdlist_find_row(vdl, fd, &iter) >= 0) + if (GTK_WIDGET_REALIZED(vd->view) && + vdlist_find_row(vd, fd, &iter) >= 0) { GtkTreeModel *store; GtkTreePath *tpath; - store = gtk_tree_view_get_model(GTK_TREE_VIEW(vdl->view)); + store = gtk_tree_view_get_model(GTK_TREE_VIEW(vd->view)); tpath = gtk_tree_model_get_path(store, &iter); - gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(vdl->view), tpath, NULL, TRUE, y_align, 0.0); - gtk_tree_view_set_cursor(GTK_TREE_VIEW(vdl->view), tpath, NULL, FALSE); + gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(vd->view), tpath, NULL, TRUE, y_align, 0.0); + gtk_tree_view_set_cursor(GTK_TREE_VIEW(vd->view), tpath, NULL, FALSE); gtk_tree_path_free(tpath); - if (!GTK_WIDGET_HAS_FOCUS(vdl->view)) gtk_widget_grab_focus(vdl->view); + if (!GTK_WIDGET_HAS_FOCUS(vd->view)) gtk_widget_grab_focus(vd->view); } } -static void vdlist_drop_update(ViewDir *vdl, gint x, gint y) +static void vdlist_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(vdl->view), x, y, + if (gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(vd->view), x, y, &tpath, NULL, NULL, NULL)) { GtkTreeModel *store; - store = gtk_tree_view_get_model(GTK_TREE_VIEW(vdl->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, &fd, -1); gtk_tree_path_free(tpath); } - if (fd != vdl->drop_fd) + if (fd != vd->drop_fd) { - vdlist_color_set(vdl, vdl->drop_fd, FALSE); - vdlist_color_set(vdl, fd, TRUE); + vdlist_color_set(vd, vd->drop_fd, FALSE); + vdlist_color_set(vd, fd, TRUE); } - vdl->drop_fd = fd; + vd->drop_fd = fd; } -static void vdlist_dnd_drop_scroll_cancel(ViewDir *vdl) +static void vdlist_dnd_drop_scroll_cancel(ViewDir *vd) { - if (vdl->drop_scroll_id != -1) g_source_remove(vdl->drop_scroll_id); - vdl->drop_scroll_id = -1; + if (vd->drop_scroll_id != -1) g_source_remove(vd->drop_scroll_id); + vd->drop_scroll_id = -1; } static gint vdlist_auto_scroll_idle_cb(gpointer data) { - ViewDir *vdl = data; + ViewDir *vd = data; - if (vdl->drop_fd) + if (vd->drop_fd) { GdkWindow *window; gint x, y; gint w, h; - window = vdl->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) { - vdlist_drop_update(vdl, x, y); + vdlist_drop_update(vd, x, y); } } - vdl->drop_scroll_id = -1; + vd->drop_scroll_id = -1; return FALSE; } static gint vdlist_auto_scroll_notify_cb(GtkWidget *widget, gint x, gint y, gpointer data) { - ViewDir *vdl = data; + ViewDir *vd = data; - if (!vdl->drop_fd || vdl->drop_list) return FALSE; + if (!vd->drop_fd || vd->drop_list) return FALSE; - if (vdl->drop_scroll_id == -1) vdl->drop_scroll_id = g_idle_add(vdlist_auto_scroll_idle_cb, vdl); + if (vd->drop_scroll_id == -1) vd->drop_scroll_id = g_idle_add(vdlist_auto_scroll_idle_cb, vd); return TRUE; } @@ -679,11 +679,11 @@ static gint vdlist_dnd_drop_motion(GtkWidget *widget, GdkDragContext *context, gint x, gint y, guint time, gpointer data) { - ViewDir *vdl = data; + ViewDir *vd = data; - vdl->click_fd = NULL; + vd->click_fd = NULL; - if (gtk_drag_get_source_widget(context) == vdl->view) + if (gtk_drag_get_source_widget(context) == vd->view) { /* from same window */ gdk_drag_status(context, 0, time); @@ -694,12 +694,12 @@ gdk_drag_status(context, context->suggested_action, time); } - vdlist_drop_update(vdl, x, y); + vdlist_drop_update(vd, x, y); - if (vdl->drop_fd) + if (vd->drop_fd) { - GtkAdjustment *adj = gtk_tree_view_get_vadjustment(GTK_TREE_VIEW(vdl->view)); - widget_auto_scroll_start(vdl->view, adj, -1, -1, vdlist_auto_scroll_notify_cb, vdl); + GtkAdjustment *adj = gtk_tree_view_get_vadjustment(GTK_TREE_VIEW(vd->view)); + widget_auto_scroll_start(vd->view, adj, -1, -1, vdlist_auto_scroll_notify_cb, vd); } return FALSE; @@ -707,32 +707,32 @@ static void vdlist_dnd_drop_leave(GtkWidget *widget, GdkDragContext *context, guint time, gpointer data) { - ViewDir *vdl = data; + ViewDir *vd = data; - if (vdl->drop_fd != vdl->click_fd) vdlist_color_set(vdl, vdl->drop_fd, FALSE); + if (vd->drop_fd != vd->click_fd) vdlist_color_set(vd, vd->drop_fd, FALSE); - vdl->drop_fd = NULL; + vd->drop_fd = NULL; } -static void vdlist_dnd_init(ViewDir *vdl) +static void vdlist_dnd_init(ViewDir *vd) { - gtk_drag_source_set(vdl->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_LINK); - g_signal_connect(G_OBJECT(vdl->view), "drag_data_get", - G_CALLBACK(vdlist_dnd_get), vdl); - g_signal_connect(G_OBJECT(vdl->view), "drag_begin", - G_CALLBACK(vdlist_dnd_begin), vdl); - g_signal_connect(G_OBJECT(vdl->view), "drag_end", - G_CALLBACK(vdlist_dnd_end), vdl); + g_signal_connect(G_OBJECT(vd->view), "drag_data_get", + G_CALLBACK(vdlist_dnd_get), vd); + g_signal_connect(G_OBJECT(vd->view), "drag_begin", + G_CALLBACK(vdlist_dnd_begin), vd); + g_signal_connect(G_OBJECT(vd->view), "drag_end", + G_CALLBACK(vdlist_dnd_end), vd); - vdlist_dest_set(vdl, TRUE); - g_signal_connect(G_OBJECT(vdl->view), "drag_data_received", - G_CALLBACK(vdlist_dnd_drop_receive), vdl); - g_signal_connect(G_OBJECT(vdl->view), "drag_motion", - G_CALLBACK(vdlist_dnd_drop_motion), vdl); - g_signal_connect(G_OBJECT(vdl->view), "drag_leave", - G_CALLBACK(vdlist_dnd_drop_leave), vdl); + vdlist_dest_set(vd, TRUE); + g_signal_connect(G_OBJECT(vd->view), "drag_data_received", + G_CALLBACK(vdlist_dnd_drop_receive), vd); + g_signal_connect(G_OBJECT(vd->view), "drag_motion", + G_CALLBACK(vdlist_dnd_drop_motion), vd); + g_signal_connect(G_OBJECT(vd->view), "drag_leave", + G_CALLBACK(vdlist_dnd_drop_leave), vd); } /* @@ -741,38 +741,38 @@ *----------------------------------------------------------------------------- */ -static void vdlist_select_row(ViewDir *vdl, FileData *fd) +static void vdlist_select_row(ViewDir *vd, FileData *fd) { - if (fd && vdl->select_func) + if (fd && vd->select_func) { gchar *path; path = g_strdup(fd->path); - vdl->select_func(vdl, path, vdl->select_data); + vd->select_func(vd, path, vd->select_data); g_free(path); } } -const gchar *vdlist_row_get_path(ViewDir *vdl, gint row) +const gchar *vdlist_row_get_path(ViewDir *vd, gint row) { FileData *fd; - fd = g_list_nth_data(VDLIST_INFO(vdl, list), row); + fd = g_list_nth_data(VDLIST_INFO(vd, list), row); if (fd) return fd->path; return NULL; } -static void vdlist_populate(ViewDir *vdl) +static void vdlist_populate(ViewDir *vd) { GtkListStore *store; GList *work; - store = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(vdl->view))); + store = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(vd->view))); gtk_list_store_clear(store); - work = VDLIST_INFO(vdl, list); + work = VDLIST_INFO(vd, list); while (work) { FileData *fd; @@ -785,20 +785,20 @@ { if (fd->name[0] == '.' && fd->name[1] == '\0') { - pixbuf = vdl->pf->open; + pixbuf = vd->pf->open; } else if (fd->name[0] == '.' && fd->name[1] == '.' && fd->name[2] == '\0') { - pixbuf = vdl->pf->parent; + pixbuf = vd->pf->parent; } else { - pixbuf = vdl->pf->close; + pixbuf = vd->pf->close; } } else { - pixbuf = vdl->pf->deny; + pixbuf = vd->pf->deny; } gtk_list_store_append(store, &iter); @@ -810,11 +810,11 @@ work = work->next; } - vdl->click_fd = NULL; - vdl->drop_fd = NULL; + vd->click_fd = NULL; + vd->drop_fd = NULL; } -gint vdlist_set_path(ViewDir *vdl, const gchar *path) +gint vdlist_set_path(ViewDir *vd, const gchar *path) { gint ret; FileData *fd; @@ -822,49 +822,49 @@ gchar *filepath; if (!path) return FALSE; - if (vdl->path && strcmp(path, vdl->path) == 0) return TRUE; + if (vd->path && strcmp(path, vd->path) == 0) return TRUE; - if (vdl->path) + if (vd->path) { gchar *base; - base = remove_level_from_path(vdl->path); + base = remove_level_from_path(vd->path); if (strcmp(base, path) == 0) { - old_path = g_strdup(filename_from_path(vdl->path)); + old_path = g_strdup(filename_from_path(vd->path)); } g_free(base); } - g_free(vdl->path); - vdl->path = g_strdup(path); + g_free(vd->path); + vd->path = g_strdup(path); - filelist_free(VDLIST_INFO(vdl, list)); - VDLIST_INFO(vdl, list) = NULL; + filelist_free(VDLIST_INFO(vd, list)); + VDLIST_INFO(vd, list) = NULL; - ret = filelist_read(vdl->path, NULL, &VDLIST_INFO(vdl, list)); + ret = filelist_read(vd->path, NULL, &VDLIST_INFO(vd, list)); - VDLIST_INFO(vdl, list) = filelist_sort(VDLIST_INFO(vdl, list), SORT_NAME, TRUE); + VDLIST_INFO(vd, list) = filelist_sort(VDLIST_INFO(vd, list), SORT_NAME, TRUE); /* add . and .. */ - if (strcmp(vdl->path, "/") != 0) + if (strcmp(vd->path, "/") != 0) { - filepath = g_strconcat(vdl->path, "/", "..", NULL); + filepath = g_strconcat(vd->path, "/", "..", NULL); fd = file_data_new_simple(filepath); - VDLIST_INFO(vdl, list) = g_list_prepend(VDLIST_INFO(vdl, list), fd); + VDLIST_INFO(vd, list) = g_list_prepend(VDLIST_INFO(vd, list), fd); g_free(filepath); } if (options->file_filter.show_dot_directory) { - filepath = g_strconcat(vdl->path, "/", ".", NULL); + filepath = g_strconcat(vd->path, "/", ".", NULL); fd = file_data_new_simple(filepath); - VDLIST_INFO(vdl, list) = g_list_prepend(VDLIST_INFO(vdl, list), fd); + VDLIST_INFO(vd, list) = g_list_prepend(VDLIST_INFO(vd, list), fd); g_free(filepath); } - vdlist_populate(vdl); + vdlist_populate(vd); if (old_path) { @@ -872,7 +872,7 @@ FileData *found = NULL; GList *work; - work = VDLIST_INFO(vdl, list); + work = VDLIST_INFO(vd, list); while (work && !found) { FileData *fd = work->data; @@ -880,42 +880,42 @@ work = work->next; } - if (found) vdlist_scroll_to_row(vdl, found, 0.5); + if (found) vdlist_scroll_to_row(vd, found, 0.5); g_free(old_path); return ret; } - if (GTK_WIDGET_REALIZED(vdl->view)) + if (GTK_WIDGET_REALIZED(vd->view)) { - gtk_tree_view_scroll_to_point(GTK_TREE_VIEW(vdl->view), 0, 0); + gtk_tree_view_scroll_to_point(GTK_TREE_VIEW(vd->view), 0, 0); } return ret; } -void vdlist_refresh(ViewDir *vdl) +void vdlist_refresh(ViewDir *vd) { gchar *path; - path = g_strdup(vdl->path); - vdl->path = NULL; - vdlist_set_path(vdl, path); + path = g_strdup(vd->path); + vd->path = NULL; + vdlist_set_path(vd, path); g_free(path); } static void vdlist_menu_position_cb(GtkMenu *menu, gint *x, gint *y, gboolean *push_in, gpointer data) { - ViewDir *vdl = data; + ViewDir *vd = data; GtkTreeModel *store; GtkTreeIter iter; GtkTreePath *tpath; gint cw, ch; - if (vdlist_find_row(vdl, vdl->click_fd, &iter) < 0) return; - store = gtk_tree_view_get_model(GTK_TREE_VIEW(vdl->view)); + if (vdlist_find_row(vd, vd->click_fd, &iter) < 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(vdl->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); @@ -923,12 +923,12 @@ static gint vdlist_press_key_cb(GtkWidget *widget, GdkEventKey *event, gpointer data) { - ViewDir *vdl = data; + ViewDir *vd = data; GtkTreePath *tpath; if (event->keyval != GDK_Menu) return FALSE; - gtk_tree_view_get_cursor(GTK_TREE_VIEW(vdl->view), &tpath, NULL); + gtk_tree_view_get_cursor(GTK_TREE_VIEW(vd->view), &tpath, NULL); if (tpath) { GtkTreeModel *store; @@ -936,27 +936,27 @@ store = gtk_tree_view_get_model(GTK_TREE_VIEW(widget)); gtk_tree_model_get_iter(store, &iter, tpath); - gtk_tree_model_get(store, &iter, DIR_COLUMN_POINTER, &vdl->click_fd, -1); + gtk_tree_model_get(store, &iter, DIR_COLUMN_POINTER, &vd->click_fd, -1); gtk_tree_path_free(tpath); } else { - vdl->click_fd = NULL; + vd->click_fd = NULL; } - vdlist_color_set(vdl, vdl->click_fd, TRUE); + vdlist_color_set(vd, vd->click_fd, TRUE); - vdl->popup = vdlist_pop_menu(vdl, vdl->click_fd); + vd->popup = vdlist_pop_menu(vd, vd->click_fd); - gtk_menu_popup(GTK_MENU(vdl->popup), NULL, NULL, vdlist_menu_position_cb, vdl, 0, GDK_CURRENT_TIME); + gtk_menu_popup(GTK_MENU(vd->popup), NULL, NULL, vdlist_menu_position_cb, vd, 0, GDK_CURRENT_TIME); return TRUE; } static gint vdlist_press_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data) { - ViewDir *vdl = data; + ViewDir *vd = data; GtkTreePath *tpath; GtkTreeIter iter; FileData *fd = NULL; @@ -973,13 +973,13 @@ gtk_tree_path_free(tpath); } - vdl->click_fd = fd; - vdlist_color_set(vdl, vdl->click_fd, TRUE); + vd->click_fd = fd; + vdlist_color_set(vd, vd->click_fd, TRUE); if (bevent->button == 3) { - vdl->popup = vdlist_pop_menu(vdl, vdl->click_fd); - gtk_menu_popup(GTK_MENU(vdl->popup), NULL, NULL, NULL, NULL, + vd->popup = vdlist_pop_menu(vd, vd->click_fd); + gtk_menu_popup(GTK_MENU(vd->popup), NULL, NULL, NULL, NULL, bevent->button, bevent->time); } @@ -988,12 +988,12 @@ static gint vdlist_release_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data) { - ViewDir *vdl = data; + ViewDir *vd = data; GtkTreePath *tpath; GtkTreeIter iter; FileData *fd = NULL; - vdlist_color_set(vdl, vdl->click_fd, FALSE); + vdlist_color_set(vd, vd->click_fd, FALSE); if (bevent->button != 1) return TRUE; @@ -1009,9 +1009,9 @@ gtk_tree_path_free(tpath); } - if (fd && vdl->click_fd == fd) + if (fd && vd->click_fd == fd) { - vdlist_select_row(vdl, vdl->click_fd); + vdlist_select_row(vd, vd->click_fd); } return TRUE; @@ -1019,7 +1019,7 @@ static void vdlist_select_cb(GtkTreeView *tview, GtkTreePath *tpath, GtkTreeViewColumn *column, gpointer data) { - ViewDir *vdl = data; + ViewDir *vd = data; GtkTreeModel *store; GtkTreeIter iter; FileData *fd; @@ -1028,7 +1028,7 @@ gtk_tree_model_get_iter(store, &iter, tpath); gtk_tree_model_get(store, &iter, DIR_COLUMN_POINTER, &fd, -1); - vdlist_select_row(vdl, fd); + vdlist_select_row(vd, fd); } static GdkColor *vdlist_color_shifted(GtkWidget *widget) @@ -1052,80 +1052,80 @@ static void vdlist_color_cb(GtkTreeViewColumn *tree_column, GtkCellRenderer *cell, GtkTreeModel *tree_model, GtkTreeIter *iter, gpointer data) { - ViewDir *vdl = 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", vdlist_color_shifted(vdl->view), + "cell-background-gdk", vdlist_color_shifted(vd->view), "cell-background-set", set, NULL); } static void vdlist_destroy_cb(GtkWidget *widget, gpointer data) { - ViewDir *vdl = data; + ViewDir *vd = data; - if (vdl->popup) + if (vd->popup) { - g_signal_handlers_disconnect_matched(G_OBJECT(vdl->popup), G_SIGNAL_MATCH_DATA, - 0, 0, 0, NULL, vdl); - gtk_widget_destroy(vdl->popup); + g_signal_handlers_disconnect_matched(G_OBJECT(vd->popup), G_SIGNAL_MATCH_DATA, + 0, 0, 0, NULL, vd); + gtk_widget_destroy(vd->popup); } - vdlist_dnd_drop_scroll_cancel(vdl); - widget_auto_scroll_stop(vdl->view); + vdlist_dnd_drop_scroll_cancel(vd); + widget_auto_scroll_stop(vd->view); - filelist_free(vdl->drop_list); + filelist_free(vd->drop_list); - folder_icons_free(vdl->pf); + folder_icons_free(vd->pf); - g_free(vdl->path); - filelist_free(VDLIST_INFO(vdl, list)); - g_free(vdl->info); - g_free(vdl); + g_free(vd->path); + filelist_free(VDLIST_INFO(vd, list)); + g_free(vd->info); + g_free(vd); } ViewDir *vdlist_new(const gchar *path) { - ViewDir *vdl; + ViewDir *vd; GtkListStore *store; GtkTreeSelection *selection; GtkTreeViewColumn *column; GtkCellRenderer *renderer; - vdl = g_new0(ViewDir, 1); - vdl->info = g_new0(ViewDirInfoList, 1); - vdl->type = DIRVIEW_LIST; + vd = g_new0(ViewDir, 1); + vd->info = g_new0(ViewDirInfoList, 1); + vd->type = DIRVIEW_LIST; - vdl->path = NULL; - VDLIST_INFO(vdl, list) = NULL; - vdl->click_fd = NULL; + vd->path = NULL; + VDLIST_INFO(vd, list) = NULL; + vd->click_fd = NULL; - vdl->drop_fd = NULL; - vdl->drop_list = NULL; + vd->drop_fd = NULL; + vd->drop_list = NULL; - vdl->drop_scroll_id = -1; + vd->drop_scroll_id = -1; - vdl->popup = NULL; + vd->popup = NULL; - vdl->widget = gtk_scrolled_window_new(NULL, NULL); - gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(vdl->widget), GTK_SHADOW_IN); - gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(vdl->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(vdl->widget), "destroy", - G_CALLBACK(vdlist_destroy_cb), vdl); + g_signal_connect(G_OBJECT(vd->widget), "destroy", + G_CALLBACK(vdlist_destroy_cb), vd); store = gtk_list_store_new(4, G_TYPE_POINTER, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_BOOLEAN); - vdl->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(vdl->view), FALSE); - gtk_tree_view_set_enable_search(GTK_TREE_VIEW(vdl->view), FALSE); - g_signal_connect(G_OBJECT(vdl->view), "row_activated", + gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(vd->view), FALSE); + gtk_tree_view_set_enable_search(GTK_TREE_VIEW(vd->view), FALSE); + g_signal_connect(G_OBJECT(vd->view), "row_activated", - G_CALLBACK(vdlist_select_cb), vdl); + G_CALLBACK(vdlist_select_cb), vd); - selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(vdl->view)); + selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(vd->view)); gtk_tree_selection_set_mode(selection, GTK_SELECTION_NONE); column = gtk_tree_view_column_new(); @@ -1134,30 +1134,30 @@ 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, vdlist_color_cb, vdl, NULL); + gtk_tree_view_column_set_cell_data_func(column, renderer, vdlist_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, vdlist_color_cb, vdl, NULL); + gtk_tree_view_column_set_cell_data_func(column, renderer, vdlist_color_cb, vd, NULL); - gtk_tree_view_append_column(GTK_TREE_VIEW(vdl->view), column); + gtk_tree_view_append_column(GTK_TREE_VIEW(vd->view), column); - g_signal_connect(G_OBJECT(vdl->view), "key_press_event", - G_CALLBACK(vdlist_press_key_cb), vdl); - gtk_container_add(GTK_CONTAINER(vdl->widget), vdl->view); - gtk_widget_show(vdl->view); + g_signal_connect(G_OBJECT(vd->view), "key_press_event", + G_CALLBACK(vdlist_press_key_cb), vd); + gtk_container_add(GTK_CONTAINER(vd->widget), vd->view); + gtk_widget_show(vd->view); - vdl->pf = folder_icons_new(); + vd->pf = folder_icons_new(); - vdlist_dnd_init(vdl); + vdlist_dnd_init(vd); - g_signal_connect(G_OBJECT(vdl->view), "button_press_event", - G_CALLBACK(vdlist_press_cb), vdl); - g_signal_connect(G_OBJECT(vdl->view), "button_release_event", - G_CALLBACK(vdlist_release_cb), vdl); + g_signal_connect(G_OBJECT(vd->view), "button_press_event", + G_CALLBACK(vdlist_press_cb), vd); + g_signal_connect(G_OBJECT(vd->view), "button_release_event", + G_CALLBACK(vdlist_release_cb), vd); - if (path) vdlist_set_path(vdl, path); + if (path) vdlist_set_path(vd, path); - return vdl; + return vd; }