[Xfce4-commits] [xfce/thunar] 01/01: Ensure user customizable action uses currently selected file path (Bug #15119)
noreply at xfce.org
noreply at xfce.org
Sun Sep 22 23:48:38 CEST 2019
This is an automated email from the git hooks/post-receive script.
a l e x p u s h e d a c o m m i t t o b r a n c h x f c e - 4 . 1 4
in repository xfce/thunar.
commit 1b568d86396e3ec298ca7f06cb7b47db62224e02
Author: Reuben Green <reubengreen73 at gmail.com>
Date: Fri Sep 20 11:04:00 2019 +0100
Ensure user customizable action uses currently selected file path (Bug #15119)
Moves the call to thunar_standard_view_merge_custom_actions from thunar_standard_view_context_menu
to thunar_standard_view_selection_changed to ensure that the available menu items get updated
whenever the file selection changes, not just when a context menu is run.
---
thunar/thunar-standard-view.c | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/thunar/thunar-standard-view.c b/thunar/thunar-standard-view.c
index 1049194..29b8921 100644
--- a/thunar/thunar-standard-view.c
+++ b/thunar/thunar-standard-view.c
@@ -158,8 +158,7 @@ static ThunarFile *thunar_standard_view_get_drop_file (Thu
gint x,
gint y,
GtkTreePath **path_return);
-static void thunar_standard_view_merge_custom_actions (ThunarStandardView *standard_view,
- GList *selected_items);
+static void thunar_standard_view_merge_custom_actions (ThunarStandardView *standard_view);
static void thunar_standard_view_update_statusbar_text (ThunarStandardView *standard_view);
static void thunar_standard_view_current_directory_destroy (ThunarFile *current_directory,
ThunarStandardView *standard_view);
@@ -2020,8 +2019,7 @@ thunar_standard_view_get_drop_file (ThunarStandardView *standard_view,
static void
-thunar_standard_view_merge_custom_actions (ThunarStandardView *standard_view,
- GList *selected_items)
+thunar_standard_view_merge_custom_actions (ThunarStandardView *standard_view)
{
GtkTreeIter iter;
ThunarFile *file = NULL;
@@ -2031,6 +2029,7 @@ thunar_standard_view_merge_custom_actions (ThunarStandardView *standard_view,
GList *files = NULL;
GList *tmp;
GList *lp;
+ GList *selected_items;
gchar *path;
/* we cannot add anything if we aren't connected to any UI manager */
@@ -2040,6 +2039,9 @@ thunar_standard_view_merge_custom_actions (ThunarStandardView *standard_view,
/* determine the toplevel window we belong to */
window = gtk_widget_get_toplevel (GTK_WIDGET (standard_view));
+ /* get the selected items */
+ selected_items = (*THUNAR_STANDARD_VIEW_GET_CLASS (standard_view)->get_selected_items) (standard_view);
+
/* load the menu providers from the provider factory */
providers = thunarx_provider_factory_list_providers (standard_view->priv->provider_factory, THUNARX_TYPE_MENU_PROVIDER);
if (G_LIKELY (providers != NULL))
@@ -4338,15 +4340,12 @@ thunar_standard_view_context_menu (ThunarStandardView *standard_view)
_thunar_return_if_fail (THUNAR_IS_STANDARD_VIEW (standard_view));
- /* merge the custom menu actions for the selected items */
- selected_items = (*THUNAR_STANDARD_VIEW_GET_CLASS (standard_view)->get_selected_items) (standard_view);
- thunar_standard_view_merge_custom_actions (standard_view, selected_items);
-
/* grab an additional reference on the view */
g_object_ref (G_OBJECT (standard_view));
-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
/* run the menu (figuring out whether to use the file or the folder context menu) */
+ selected_items = (*THUNAR_STANDARD_VIEW_GET_CLASS (standard_view)->get_selected_items) (standard_view);
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
menu = gtk_ui_manager_get_widget (standard_view->ui_manager, (selected_items != NULL) ? "/file-context-menu" : "/folder-context-menu");
G_GNUC_END_IGNORE_DEPRECATIONS
/* if there is a drag_timer_event (long press), we use it */
@@ -4600,6 +4599,9 @@ G_GNUC_END_IGNORE_DEPRECATIONS
/* update the statusbar text */
thunar_standard_view_update_statusbar_text (standard_view);
+ /* merge the custom actions */
+ thunar_standard_view_merge_custom_actions (standard_view);
+
/* emit notification for "selected-files" */
g_object_notify_by_pspec (G_OBJECT (standard_view), standard_view_props[PROP_SELECTED_FILES]);
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list