[Xfce4-commits] [xfce/thunar] 01/01: Allow context menu when editing location in pathbar (Bug #16483)
noreply at xfce.org
noreply at xfce.org
Tue Mar 3 22:05:03 CET 2020
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 b81aade02d1c03d07b35096f711fcb0dc96a0d3b
Author: Theo Linkspfeifer <lastonestanding at tutanota.com>
Date: Mon Mar 2 20:35:08 2020 +0100
Allow context menu when editing location in pathbar (Bug #16483)
---
thunar/thunar-location-entry.c | 36 +++++++++++++++++++++++++++++++++++-
1 file changed, 35 insertions(+), 1 deletion(-)
diff --git a/thunar/thunar-location-entry.c b/thunar/thunar-location-entry.c
index fff18e1..bd9406e 100644
--- a/thunar/thunar-location-entry.c
+++ b/thunar/thunar-location-entry.c
@@ -62,6 +62,9 @@ static void thunar_location_entry_set_current_directory (ThunarNavigat
ThunarFile *current_directory);
static void thunar_location_entry_activate (GtkWidget *path_entry,
ThunarLocationEntry *location_entry);
+static gboolean thunar_location_entry_button_press_event (GtkWidget *path_entry,
+ GdkEventButton *event,
+ ThunarLocationEntry *location_entry);
static gboolean thunar_location_entry_reset (ThunarLocationEntry *location_entry);
static void thunar_location_entry_reload (GtkEntry *entry,
GtkEntryIconPosition icon_pos,
@@ -89,6 +92,8 @@ struct _ThunarLocationEntry
ThunarFile *current_directory;
GtkWidget *path_entry;
+
+ gboolean right_click_occurred;
};
@@ -198,6 +203,11 @@ thunar_location_entry_init (ThunarLocationEntry *location_entry)
/* make sure the edit-done signal is emitted upon moving the focus somewhere else */
g_signal_connect_swapped (location_entry->path_entry, "focus-out-event", G_CALLBACK (thunar_location_entry_emit_edit_done), location_entry);
+
+ /* ...except if it is grabbed by the context menu */
+ location_entry->right_click_occurred = FALSE;
+ g_signal_connect (G_OBJECT (location_entry->path_entry), "button-press-event",
+ G_CALLBACK (thunar_location_entry_button_press_event), location_entry);
}
@@ -411,6 +421,24 @@ thunar_location_entry_activate (GtkWidget *path_entry,
static gboolean
+thunar_location_entry_button_press_event (GtkWidget *path_entry,
+ GdkEventButton *event,
+ ThunarLocationEntry *location_entry)
+{
+ _thunar_return_val_if_fail (THUNAR_IS_LOCATION_ENTRY (location_entry), FALSE);
+
+ /* check if the context menu was triggered */
+ if (event->type == GDK_BUTTON_PRESS && event->button == 3)
+ {
+ location_entry->right_click_occurred = TRUE;
+ }
+
+ return FALSE;
+}
+
+
+
+static gboolean
thunar_location_entry_reset (ThunarLocationEntry *location_entry)
{
/* just reset the path entry to our current directory... */
@@ -445,7 +473,13 @@ thunar_location_entry_reload (GtkEntry *entry,
static void
thunar_location_entry_emit_edit_done (ThunarLocationEntry *entry)
{
- g_signal_emit_by_name (entry, "edit-done");
+ /* do not emit signal if the context menu was opened */
+ if (entry->right_click_occurred == FALSE)
+ {
+ g_signal_emit_by_name (entry, "edit-done");
+ }
+
+ entry->right_click_occurred = FALSE;
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list