# HG changeset patch # User nadvornik # Date 1254131826 0 # Node ID 5276dabe836f7b9107ecc803fabab8187dbafc83 # Parent 25471efb11ba4d62ccd369074e4a48f83eadb6fc consider sidecars in layout_image popup menu diff -r 25471efb11ba -r 5276dabe836f src/layout_image.c --- a/src/layout_image.c Sat Sep 26 08:47:28 2009 +0000 +++ b/src/layout_image.c Mon Sep 28 09:57:06 2009 +0000 @@ -33,6 +33,7 @@ #include "ui_menu.h" #include "uri_utils.h" #include "utilops.h" +#include "view_file.h" #include /* for keyboard values */ @@ -461,7 +462,13 @@ FileData *fd = layout_image_get_fd(lw); if (fd) - list = g_list_append(NULL, file_data_ref(fd)); + { + if (lw->vf) + /* optionally include sidecars if the filelist entry is not expanded */ + list = vf_selection_get_one(lw->vf, fd); + else + list = g_list_append(NULL, file_data_ref(fd)); + } return list; } diff -r 25471efb11ba -r 5276dabe836f src/view_file.c --- a/src/view_file.c Sat Sep 26 08:47:28 2009 +0000 +++ b/src/view_file.c Mon Sep 28 09:57:06 2009 +0000 @@ -310,6 +310,19 @@ return ret; } +GList *vf_selection_get_one(ViewFile *vf, FileData *fd) +{ + GList *ret = NULL; + + switch (vf->type) + { + case FILEVIEW_LIST: ret = vflist_selection_get_one(vf, fd); break; + case FILEVIEW_ICON: ret = vficon_selection_get_one(vf, fd); break; + } + + return ret; +} + static void vf_pop_menu_edit_cb(GtkWidget *widget, gpointer data) { ViewFile *vf; diff -r 25471efb11ba -r 5276dabe836f src/view_file.h --- a/src/view_file.h Sat Sep 26 08:47:28 2009 +0000 +++ b/src/view_file.h Mon Sep 28 09:57:06 2009 +0000 @@ -37,6 +37,7 @@ guint vf_marks_get_filter(ViewFile *vf); void vf_mark_filter_toggle(ViewFile *vf, gint mark); +GList *vf_selection_get_one(ViewFile *vf, FileData *fd); GList *vf_pop_menu_file_list(ViewFile *vf); GtkWidget *vf_pop_menu(ViewFile *vf); diff -r 25471efb11ba -r 5276dabe836f src/view_file_icon.c --- a/src/view_file_icon.c Sat Sep 26 08:47:28 2009 +0000 +++ b/src/view_file_icon.c Mon Sep 28 09:57:06 2009 +0000 @@ -161,6 +161,11 @@ *----------------------------------------------------------------------------- */ +GList *vficon_selection_get_one(ViewFile *vf, FileData *fd) +{ + return g_list_prepend(filelist_copy(fd->sidecar_files), file_data_ref(fd)); +} + GList *vficon_pop_menu_file_list(ViewFile *vf) { if (!VFICON(vf)->click_id) return NULL; @@ -170,8 +175,7 @@ return vf_selection_get_list(vf); } - - return g_list_prepend(filelist_copy(VFICON(vf)->click_id->fd->sidecar_files), file_data_ref(VFICON(vf)->click_id->fd)); + return vficon_selection_get_one(vf, VFICON(vf)->click_id->fd); } void vficon_pop_menu_view_cb(GtkWidget *widget, gpointer data) diff -r 25471efb11ba -r 5276dabe836f src/view_file_icon.h --- a/src/view_file_icon.h Sat Sep 26 08:47:28 2009 +0000 +++ b/src/view_file_icon.h Mon Sep 28 09:57:06 2009 +0000 @@ -29,6 +29,7 @@ void vficon_marks_set(ViewFile *vf, gboolean enable); +GList *vficon_selection_get_one(ViewFile *vf, FileData *fd); GList *vficon_pop_menu_file_list(ViewFile *vf); void vficon_pop_menu_view_cb(GtkWidget *widget, gpointer data); void vficon_pop_menu_rename_cb(GtkWidget *widget, gpointer data); diff -r 25471efb11ba -r 5276dabe836f src/view_file_list.c --- a/src/view_file_list.c Sat Sep 26 08:47:28 2009 +0000 +++ b/src/view_file_list.c Mon Sep 28 09:57:06 2009 +0000 @@ -363,26 +363,18 @@ *----------------------------------------------------------------------------- */ -GList *vflist_pop_menu_file_list(ViewFile *vf) +GList *vflist_selection_get_one(ViewFile *vf, FileData *fd) { - GList *list; - if (!VFLIST(vf)->click_fd) return NULL; + GList *list = g_list_append(NULL, file_data_ref(fd)); - if (vflist_row_is_selected(vf, VFLIST(vf)->click_fd)) - { - return vf_selection_get_list(vf); - } - - list = g_list_append(NULL, file_data_ref(VFLIST(vf)->click_fd)); - - if (VFLIST(vf)->click_fd->sidecar_files) + if (fd->sidecar_files) { /* check if the row is expanded */ GtkTreeModel *store; GtkTreeIter iter; store = gtk_tree_view_get_model(GTK_TREE_VIEW(vf->listview)); - if (vflist_find_row(vf, VFLIST(vf)->click_fd, &iter) >= 0) + if (vflist_find_row(vf, fd, &iter) >= 0) { GtkTreePath *tpath; @@ -390,7 +382,7 @@ if (!gtk_tree_view_row_expanded(GTK_TREE_VIEW(vf->listview), tpath)) { /* unexpanded - add whole group */ - GList *work = VFLIST(vf)->click_fd->sidecar_files; + GList *work = fd->sidecar_files; while (work) { FileData *sfd = work->data; @@ -406,6 +398,18 @@ return list; } +GList *vflist_pop_menu_file_list(ViewFile *vf) +{ + if (!VFLIST(vf)->click_fd) return NULL; + + if (vflist_row_is_selected(vf, VFLIST(vf)->click_fd)) + { + return vf_selection_get_list(vf); + } + return vflist_selection_get_one(vf, VFLIST(vf)->click_fd); +} + + void vflist_pop_menu_view_cb(GtkWidget *widget, gpointer data) { ViewFile *vf = data; diff -r 25471efb11ba -r 5276dabe836f src/view_file_list.h --- a/src/view_file_list.h Sat Sep 26 08:47:28 2009 +0000 +++ b/src/view_file_list.h Mon Sep 28 09:57:06 2009 +0000 @@ -32,6 +32,7 @@ void vflist_marks_set(ViewFile *vf, gboolean enable); void vflist_sort_set(ViewFile *vf, SortType type, gboolean ascend); +GList *vflist_selection_get_one(ViewFile *vf, FileData *fd); GList *vflist_pop_menu_file_list(ViewFile *vf); void vflist_pop_menu_view_cb(GtkWidget *widget, gpointer data); void vflist_pop_menu_rename_cb(GtkWidget *widget, gpointer data);