Include a Other Software section in Help file
[geeqie.git] / src / collect-table.c
index f3b57c1..6bf85df 100644 (file)
@@ -34,6 +34,7 @@
 #include "layout_image.h"
 #include "menu.h"
 #include "metadata.h"
+#include "pixbuf_util.h"
 #include "print.h"
 #include "utilops.h"
 #include "ui_fileops.h"
@@ -733,6 +734,15 @@ static void collection_table_popup_delete_cb(GtkWidget *widget, gpointer data)
 {
        CollectTable *ct = data;
 
+       options->file_ops.safe_delete_enable = FALSE;
+       file_util_delete(NULL, collection_table_popup_file_list(ct), ct->listview);
+}
+
+static void collection_table_popup_move_to_trash_cb(GtkWidget *widget, gpointer data)
+{
+       CollectTable *ct = data;
+
+       options->file_ops.safe_delete_enable = TRUE;
        file_util_delete(NULL, collection_table_popup_file_list(ct), ct->listview);
 }
 
@@ -904,7 +914,7 @@ static void collection_table_popup_print_cb(GtkWidget *widget, gpointer data)
 
        fd = (ct->click_info) ? ct->click_info->fd : NULL;
 
-       print_window_new(fd, collection_table_selection_get_list(ct), collection_table_get_list(ct), ct->listview);
+       print_window_new(fd, collection_table_selection_get_list(ct), collection_table_get_list(ct), gtk_widget_get_toplevel(ct->listview));
 }
 
 static void collection_table_popup_show_names_cb(GtkWidget *widget, gpointer data)
@@ -994,10 +1004,18 @@ static GtkWidget *collection_table_popup_menu(CollectTable *ct, gboolean over_ic
                                G_CALLBACK(collection_table_popup_copy_path_cb), ct);
        menu_item_add_sensitive(menu, _("_Copy path unquoted"), over_icon,
                                G_CALLBACK(collection_table_popup_copy_path_unquoted_cb), ct);
-       menu_item_add_stock_sensitive(menu, _("_Delete..."), GTK_STOCK_DELETE, over_icon,
-                       G_CALLBACK(collection_table_popup_delete_cb), ct);
+
        menu_item_add_divider(menu);
+       menu_item_add_stock_sensitive(menu,
+                               options->file_ops.confirm_move_to_trash ? _("Move to Trash...") :
+                                       _("Move to Trash"), PIXBUF_INLINE_ICON_TRASH, over_icon,
+                               G_CALLBACK(collection_table_popup_move_to_trash_cb), ct);
+       menu_item_add_stock_sensitive(menu,
+                               options->file_ops.confirm_delete ? _("_Delete...") :
+                                       _("_Delete"), GTK_STOCK_DELETE, over_icon,
+                               G_CALLBACK(collection_table_popup_delete_cb), ct);
 
+       menu_item_add_divider(menu);
        submenu = submenu_add_sort(NULL, G_CALLBACK(collection_table_popup_sort_cb), ct, FALSE, TRUE, FALSE, 0);
        menu_item_add_divider(submenu);
        menu_item_add(submenu, _("Randomize"),
@@ -1461,6 +1479,11 @@ static void collection_table_insert_marker(CollectTable *ct, CollectInfo *info,
 {
        gboolean after = FALSE;
        GdkRectangle cell;
+       GdkWindow *parent;
+       gint x_parent, y_parent;
+
+       parent = gtk_widget_get_window(gtk_widget_get_toplevel(ct->listview));
+       gdk_window_get_position(parent, &x_parent, &y_parent);
 
        if (!enable)
                {
@@ -1477,7 +1500,6 @@ static void collection_table_insert_marker(CollectTable *ct, CollectInfo *info,
 
        if (!ct->marker_window)
                {
-               GdkWindow *parent = gtk_tree_view_get_bin_window(GTK_TREE_VIEW(ct->listview));
                GdkWindowAttr attributes;
                gint attributes_mask;
                GdkPixbuf *pb = gdk_pixbuf_new_from_xpm_data((const gchar **)marker_xpm);
@@ -1491,7 +1513,7 @@ static void collection_table_insert_marker(CollectTable *ct, CollectInfo *info,
                attributes.event_mask = gtk_widget_get_events(ct->listview);
                attributes_mask = 0;
 
-               ct->marker_window = gdk_window_new(parent, &attributes, attributes_mask);
+               ct->marker_window = gdk_window_new(NULL, &attributes, attributes_mask);
 
 #if GTK_CHECK_VERSION(3,0,0)
                cairo_region_t *mask;
@@ -1500,7 +1522,9 @@ static void collection_table_insert_marker(CollectTable *ct, CollectInfo *info,
                cairo_t *cr = cairo_create(img);
                gdk_cairo_set_source_pixbuf(cr, pb, 0, 0);
                cairo_paint(cr);
-               pattern = cairo_pattern_create_for_surface(img);
+               /** @FIXME this is a hack to get the background color */
+               //~ pattern = cairo_pattern_create_for_surface(img);
+               pattern = cairo_pattern_create_rgb (1.0, 0.0, 0.0);
                mask = gdk_cairo_region_create_from_surface(img);
                gdk_window_shape_combine_region(ct->marker_window, mask, 0, 0);
                gdk_window_set_background_pattern(ct->marker_window, pattern);
@@ -1541,6 +1565,9 @@ static void collection_table_insert_marker(CollectTable *ct, CollectInfo *info,
                x -= (w / 2);
                y = cell.y + (cell.height / 2) - (h / 2);
 
+               x = x + x_parent;
+               y = y + y_parent;
+
                gdk_window_move(ct->marker_window, x, y);
 #if !GTK_CHECK_VERSION(3,0,0)
                gdk_window_clear(ct->marker_window);
@@ -2019,7 +2046,7 @@ static void collection_table_move_by_info_list(CollectTable *ct, GList *info_lis
 
        if (info) insert_pos = g_list_find(ct->cd->list, info);
 
-       /* FIXME: this may get slow for large lists */
+       /** @FIXME this may get slow for large lists */
        work = info_list;
        while (insert_pos && work)
                {
@@ -2475,7 +2502,7 @@ static void collection_table_cell_data_cb(GtkTreeViewColumn *tree_column, GtkCel
        gtk_tree_model_get(tree_model, iter, CTABLE_COLUMN_POINTER, &list, -1);
 
 #if GTK_CHECK_VERSION(3,0,0)
-       /* FIXME this is a primitive hack to stop a crash.
+       /** @FIXME this is a primitive hack to stop a crash.
         * When compiled with GTK3, if a Collection window containing
         * say, 50 or so, images has its width changed, there is a segfault
         * https://github.com/BestImageViewer/geeqie/issues/531