summaryrefslogtreecommitdiff
path: root/0001-Crash-when-chaning-views-pressing-select-all.patch
diff options
context:
space:
mode:
Diffstat (limited to '0001-Crash-when-chaning-views-pressing-select-all.patch')
-rw-r--r--0001-Crash-when-chaning-views-pressing-select-all.patch276
1 files changed, 276 insertions, 0 deletions
diff --git a/0001-Crash-when-chaning-views-pressing-select-all.patch b/0001-Crash-when-chaning-views-pressing-select-all.patch
new file mode 100644
index 00000000..0dd3ed0d
--- /dev/null
+++ b/0001-Crash-when-chaning-views-pressing-select-all.patch
@@ -0,0 +1,276 @@
+From dbaf5a7c49d78cbb092355fa4923e167d8c3e491 Mon Sep 17 00:00:00 2001
+From: Alexander Schwinn <alexxcons@xfce.org>
+Date: Mon, 4 May 2020 22:26:38 +0200
+Subject: [PATCH] Crash when chaning views + pressing "select all"
+
+---
+ thunar/thunar-standard-view.c | 60 ++++-------------------------------
+ thunar/thunar-standard-view.h | 15 ++-------
+ thunar/thunar-window.c | 50 +++++++++++++++++++++++------
+ thunar/thunar-window.h | 3 ++
+ 4 files changed, 53 insertions(+), 75 deletions(-)
+
+diff --git a/thunar/thunar-standard-view.c b/thunar/thunar-standard-view.c
+index 4d9238cc..3fbc2fe6 100644
+--- a/thunar/thunar-standard-view.c
++++ b/thunar/thunar-standard-view.c
+@@ -160,9 +160,6 @@ static void thunar_standard_view_current_directory_changed (Thu
+ static GList *thunar_standard_view_get_selected_files_view (ThunarView *view);
+ static void thunar_standard_view_set_selected_files_view (ThunarView *view,
+ GList *selected_files);
+-static void thunar_standard_view_select_all_files (ThunarView *view);
+-static void thunar_standard_view_select_by_pattern (ThunarView *view);
+-static void thunar_standard_view_selection_invert (ThunarView *view);
+ static GClosure *thunar_standard_view_new_files_closure (ThunarStandardView *standard_view,
+ GtkWidget *source_view);
+ static void thunar_standard_view_new_files (ThunarStandardView *standard_view,
+@@ -333,15 +330,6 @@ struct _ThunarStandardViewPrivate
+ GtkTreePath *selection_before_delete;
+ };
+
+-static XfceGtkActionEntry thunar_standard_view_action_entries[] =
+-{
+- { THUNAR_STANDARD_VIEW_ACTION_SELECT_ALL_FILES, "<Actions>/ThunarStandardView/select-all-files", "<Primary>a", XFCE_GTK_MENU_ITEM, N_ ("Select _all Files"), N_ ("Select all files in this window"), NULL, G_CALLBACK (thunar_standard_view_select_all_files), },
+- { THUNAR_STANDARD_VIEW_ACTION_SELECT_BY_PATTERN, "<Actions>/ThunarStandardView/select-by-pattern", "<Primary>s", XFCE_GTK_MENU_ITEM, N_ ("Select _by Pattern..."), N_ ("Select all files that match a certain pattern"), NULL, G_CALLBACK (thunar_standard_view_select_by_pattern), },
+- { THUNAR_STANDARD_VIEW_ACTION_INVERT_SELECTION, "<Actions>/ThunarStandardView/invert-selection", "", XFCE_GTK_MENU_ITEM, N_ ("_Invert Selection"), N_ ("Select all files but not those currently selected"), NULL, G_CALLBACK (thunar_standard_view_selection_invert), },
+-};
+-
+-#define get_action_entry(id) xfce_gtk_get_action_entry_by_id(thunar_standard_view_action_entries,G_N_ELEMENTS(thunar_standard_view_action_entries),id)
+-
+ /* Target types for dragging from the view */
+ static const GtkTargetEntry drag_targets[] =
+ {
+@@ -391,8 +379,6 @@ thunar_standard_view_class_init (ThunarStandardViewClass *klass)
+ gtkwidget_class->grab_focus = thunar_standard_view_grab_focus;
+ gtkwidget_class->draw = thunar_standard_view_draw;
+
+- xfce_gtk_translate_action_entries (thunar_standard_view_action_entries, G_N_ELEMENTS (thunar_standard_view_action_entries));
+-
+ /**
+ * ThunarStandardView:loading:
+ *
+@@ -1903,11 +1889,9 @@ thunar_standard_view_current_directory_changed (ThunarFile *current_dire
+
+
+
+-static void
+-thunar_standard_view_select_all_files (ThunarView *view)
++void
++thunar_standard_view_select_all_files (ThunarStandardView *standard_view)
+ {
+- ThunarStandardView *standard_view = THUNAR_STANDARD_VIEW (view);
+-
+ _thunar_return_if_fail (THUNAR_IS_STANDARD_VIEW (standard_view));
+
+ /* grab the focus to the view */
+@@ -1919,10 +1903,9 @@ thunar_standard_view_select_all_files (ThunarView *view)
+
+
+
+-static void
+-thunar_standard_view_select_by_pattern (ThunarView *view)
++void
++thunar_standard_view_select_by_pattern (ThunarStandardView *standard_view)
+ {
+- ThunarStandardView *standard_view = THUNAR_STANDARD_VIEW (view);
+ GtkWidget *window;
+ GtkWidget *dialog;
+ GtkWidget *vbox;
+@@ -2016,11 +1999,9 @@ thunar_standard_view_select_by_pattern (ThunarView *view)
+
+
+
+-static void
+-thunar_standard_view_selection_invert (ThunarView *view)
++void
++thunar_standard_view_selection_invert (ThunarStandardView *standard_view)
+ {
+- ThunarStandardView *standard_view = THUNAR_STANDARD_VIEW (view);
+-
+ _thunar_return_if_fail (THUNAR_IS_STANDARD_VIEW (standard_view));
+
+ /* grab the focus to the view */
+@@ -3431,7 +3412,6 @@ thunar_standard_view_context_menu (ThunarStandardView *standard_view)
+ thunar_menu_add_sections (context_menu, THUNAR_MENU_SECTION_ZOOM
+ | THUNAR_MENU_SECTION_PROPERTIES);
+ }
+- thunar_menu_hide_accel_labels (context_menu);
+ gtk_widget_show_all (GTK_WIDGET (context_menu));
+ thunar_window_redirect_menu_tooltips_to_statusbar (THUNAR_WINDOW (window), GTK_MENU (context_menu));
+
+@@ -3644,28 +3624,6 @@ thunar_standard_view_append_menu_items (ThunarStandardView *standard_view,
+
+
+
+-/**
+- * thunar_standard_view_append_menu_item:
+- * @standard_view : Instance of a #ThunarStandardView
+- * @menu : #GtkMenuShell to which the item should be added
+- * @action : #ThunarStandardViewAction to select which item should be added
+- *
+- * Adds the selected, widget specific #GtkMenuItem to the passed #GtkMenuShell
+- *
+- * Return value: (transfer none): The added #GtkMenuItem
+- **/
+-void
+-thunar_standard_view_append_menu_item (ThunarStandardView *standard_view,
+- GtkMenu *menu,
+- ThunarStandardViewAction action)
+-{
+- _thunar_return_if_fail (THUNAR_IS_STANDARD_VIEW (standard_view));
+-
+- xfce_gtk_menu_item_new_from_action_entry (get_action_entry (action), G_OBJECT (standard_view), GTK_MENU_SHELL (menu));
+-}
+-
+-
+-
+ /**
+ * thunar_standard_view_append_accelerators:
+ * @standard_view : a #ThunarStandardView.
+@@ -3680,12 +3638,6 @@ thunar_standard_view_append_accelerators (ThunarStandardView *standard_view,
+ {
+ _thunar_return_if_fail (THUNAR_IS_STANDARD_VIEW (standard_view));
+
+- xfce_gtk_accel_map_add_entries (thunar_standard_view_action_entries, G_N_ELEMENTS (thunar_standard_view_action_entries));
+- xfce_gtk_accel_group_connect_action_entries (accel_group,
+- thunar_standard_view_action_entries,
+- G_N_ELEMENTS (thunar_standard_view_action_entries),
+- standard_view);
+-
+ /* as well append accelerators of derived widgets */
+ (*THUNAR_STANDARD_VIEW_GET_CLASS (standard_view)->append_accelerators) (standard_view, accel_group);
+ }
+diff --git a/thunar/thunar-standard-view.h b/thunar/thunar-standard-view.h
+index 67d20894..c95778c1 100644
+--- a/thunar/thunar-standard-view.h
++++ b/thunar/thunar-standard-view.h
+@@ -40,15 +40,6 @@ typedef struct _ThunarStandardView ThunarStandardView;
+ #define THUNAR_IS_STANDARD_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), THUNAR_TYPE_STANDARD_VIEW))
+ #define THUNAR_STANDARD_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), THUNAR_TYPE_STANDARD_VIEW, ThunarStandardViewClass))
+
+-/* #XfceGtkActionEntrys provided by this widget */
+-typedef enum
+-{
+- THUNAR_STANDARD_VIEW_ACTION_SELECT_ALL_FILES,
+- THUNAR_STANDARD_VIEW_ACTION_SELECT_BY_PATTERN,
+- THUNAR_STANDARD_VIEW_ACTION_INVERT_SELECTION,
+-
+-} ThunarStandardViewAction;
+-
+ struct _ThunarStandardViewClass
+ {
+ GtkScrolledWindowClass __parent__;
+@@ -157,11 +148,11 @@ ThunarHistory *thunar_standard_view_copy_history (ThunarStandardView
+ void thunar_standard_view_append_menu_items (ThunarStandardView *standard_view,
+ GtkMenu *menu,
+ GtkAccelGroup *accel_group);
+-void thunar_standard_view_append_menu_item (ThunarStandardView *standard_view,
+- GtkMenu *menu,
+- ThunarStandardViewAction action);
+ void thunar_standard_view_append_accelerators (ThunarStandardView *standard_view,
+ GtkAccelGroup *accel_group);
++void thunar_standard_view_select_all_files (ThunarStandardView *standard_view);
++void thunar_standard_view_select_by_pattern (ThunarStandardView *standard_view);
++void thunar_standard_view_selection_invert (ThunarStandardView *standard_view);
+
+ G_END_DECLS;
+
+diff --git a/thunar/thunar-window.c b/thunar/thunar-window.c
+index 1afa5362..935b6c34 100644
+--- a/thunar/thunar-window.c
++++ b/thunar/thunar-window.c
+@@ -156,6 +156,9 @@ static void thunar_window_action_close_tab (ThunarWindow
+ GtkWidget *menu_item);
+ static void thunar_window_action_close_window (ThunarWindow *window,
+ GtkWidget *menu_item);
++static void thunar_window_action_select_all_files (ThunarWindow *window);
++static void thunar_window_action_select_by_pattern (ThunarWindow *window);
++static void thunar_window_action_selection_invert (ThunarWindow *window);
+ static void thunar_window_action_preferences (ThunarWindow *window,
+ GtkWidget *menu_item);
+ static void thunar_window_action_reload (ThunarWindow *window,
+@@ -339,6 +342,9 @@ static XfceGtkActionEntry thunar_window_action_entries[] =
+ { THUNAR_WINDOW_ACTION_CLOSE_ALL_WINDOWS, "<Actions>/ThunarWindow/close-all-windows", "<Primary><Shift>w", XFCE_GTK_IMAGE_MENU_ITEM, N_ ("Close _All Windows"), N_ ("Close all Thunar windows"), NULL, G_CALLBACK (thunar_window_action_close_all_windows), },
+
+ { THUNAR_WINDOW_ACTION_EDIT_MENU, "<Actions>/ThunarWindow/edit-menu", "", XFCE_GTK_MENU_ITEM, N_ ("_Edit"), NULL, NULL, NULL, },
++ { THUNAR_WINDOW_ACTION_SELECT_ALL_FILES, "<Actions>/ThunarStandardView/select-all-files", "<Primary>a", XFCE_GTK_MENU_ITEM, N_ ("Select _all Files"), N_ ("Select all files in this window"), NULL, G_CALLBACK (thunar_window_action_select_all_files), },
++ { THUNAR_WINDOW_ACTION_SELECT_BY_PATTERN, "<Actions>/ThunarStandardView/select-by-pattern", "<Primary>s", XFCE_GTK_MENU_ITEM, N_ ("Select _by Pattern..."), N_ ("Select all files that match a certain pattern"), NULL, G_CALLBACK (thunar_window_action_select_by_pattern), },
++ { THUNAR_WINDOW_ACTION_INVERT_SELECTION, "<Actions>/ThunarStandardView/invert-selection", "", XFCE_GTK_MENU_ITEM, N_ ("_Invert Selection"), N_ ("Select all files but not those currently selected"), NULL, G_CALLBACK (thunar_window_action_selection_invert), },
+ { THUNAR_WINDOW_ACTION_PREFERENCES, "<Actions>/ThunarWindow/preferences", "", XFCE_GTK_IMAGE_MENU_ITEM, N_ ("Pr_eferences..."), N_ ("Edit Thunars Preferences"), "preferences-system", G_CALLBACK (thunar_window_action_preferences), },
+
+ { THUNAR_WINDOW_ACTION_VIEW_MENU, "<Actions>/ThunarWindow/view-menu", "", XFCE_GTK_MENU_ITEM, N_ ("_View"), NULL, NULL, NULL, },
+@@ -942,15 +948,9 @@ thunar_window_create_edit_menu (ThunarWindow *window,
+ thunar_menu_add_sections (submenu, THUNAR_MENU_SECTION_CUT
+ | THUNAR_MENU_SECTION_COPY_PASTE
+ | THUNAR_MENU_SECTION_TRASH_DELETE);
+- if (window->view != NULL)
+- {
+- thunar_standard_view_append_menu_item (THUNAR_STANDARD_VIEW (window->view),
+- GTK_MENU (submenu), THUNAR_STANDARD_VIEW_ACTION_SELECT_ALL_FILES);
+- thunar_standard_view_append_menu_item (THUNAR_STANDARD_VIEW (window->view),
+- GTK_MENU (submenu), THUNAR_STANDARD_VIEW_ACTION_SELECT_BY_PATTERN);
+- thunar_standard_view_append_menu_item (THUNAR_STANDARD_VIEW (window->view),
+- GTK_MENU (submenu), THUNAR_STANDARD_VIEW_ACTION_INVERT_SELECTION);
+- }
++ xfce_gtk_menu_item_new_from_action_entry (get_action_entry (THUNAR_WINDOW_ACTION_SELECT_ALL_FILES), G_OBJECT (window), GTK_MENU_SHELL(submenu));
++ xfce_gtk_menu_item_new_from_action_entry (get_action_entry (THUNAR_WINDOW_ACTION_SELECT_BY_PATTERN), G_OBJECT (window), GTK_MENU_SHELL(submenu));
++ xfce_gtk_menu_item_new_from_action_entry (get_action_entry (THUNAR_WINDOW_ACTION_INVERT_SELECTION), G_OBJECT (window), GTK_MENU_SHELL(submenu));
+ xfce_gtk_menu_append_seperator (GTK_MENU_SHELL (submenu));
+ thunar_menu_add_sections (submenu, THUNAR_MENU_SECTION_DUPLICATE
+ | THUNAR_MENU_SECTION_MAKELINK
+@@ -2456,6 +2456,38 @@ thunar_window_action_close_window (ThunarWindow *window,
+
+
+
++static void
++thunar_window_action_select_all_files (ThunarWindow *window)
++{
++ _thunar_return_if_fail (THUNAR_IS_WINDOW (window));
++
++ thunar_standard_view_select_all_files (THUNAR_STANDARD_VIEW (window->view));
++
++}
++
++
++
++static void
++thunar_window_action_select_by_pattern (ThunarWindow *window)
++{
++ _thunar_return_if_fail (THUNAR_IS_WINDOW (window));
++
++ thunar_standard_view_select_by_pattern (THUNAR_STANDARD_VIEW (window->view));
++}
++
++
++
++static void
++thunar_window_action_selection_invert (ThunarWindow *window)
++{
++ _thunar_return_if_fail (THUNAR_IS_WINDOW (window));
++
++ thunar_standard_view_selection_invert (THUNAR_STANDARD_VIEW (window->view));
++
++}
++
++
++
+ static void
+ thunar_window_action_preferences (ThunarWindow *window,
+ GtkWidget *menu_item)
+diff --git a/thunar/thunar-window.h b/thunar/thunar-window.h
+index 5b595d6f..e2e98bac 100644
+--- a/thunar/thunar-window.h
++++ b/thunar/thunar-window.h
+@@ -49,6 +49,9 @@ typedef enum
+ THUNAR_WINDOW_ACTION_CLOSE_WINDOW,
+ THUNAR_WINDOW_ACTION_CLOSE_ALL_WINDOWS,
+ THUNAR_WINDOW_ACTION_EDIT_MENU,
++ THUNAR_WINDOW_ACTION_SELECT_ALL_FILES,
++ THUNAR_WINDOW_ACTION_SELECT_BY_PATTERN,
++ THUNAR_WINDOW_ACTION_INVERT_SELECTION,
+ THUNAR_WINDOW_ACTION_PREFERENCES,
+ THUNAR_WINDOW_ACTION_VIEW_MENU,
+ THUNAR_WINDOW_ACTION_RELOAD,
+--
+2.26.2
+