summaryrefslogtreecommitdiff
path: root/thunar/thunar-location-button.c
diff options
context:
space:
mode:
authorBenedikt Meurer <benny@xfce.org>2006-02-18 20:51:06 +0000
committerBenedikt Meurer <benny@xfce.org>2006-02-18 20:51:06 +0000
commite454e1577e94d8b1d00a60eba6014a1996a76f3e (patch)
tree7dd25036caeaea1caae5c4c2da400c1c3061e93b /thunar/thunar-location-button.c
parenta9b45a63203f49629bc1f8ca85f0dc4af1b750c5 (diff)
downloadthunar-e454e1577e94d8b1d00a60eba6014a1996a76f3e.tar.gz
2006-02-18 Benedikt Meurer <benny@xfce.org>
* thunar/thunar-location-button.c: Set toggle button state to inconsistent while holding down middle mouse button to give the user some visual feedback. (Old svn revision: 19957)
Diffstat (limited to 'thunar/thunar-location-button.c')
-rw-r--r--thunar/thunar-location-button.c39
1 files changed, 33 insertions, 6 deletions
diff --git a/thunar/thunar-location-button.c b/thunar/thunar-location-button.c
index 5229794d..32e34a8a 100644
--- a/thunar/thunar-location-button.c
+++ b/thunar/thunar-location-button.c
@@ -72,6 +72,9 @@ static GdkDragAction thunar_location_button_get_dest_actions (ThunarLocat
guint time);
static void thunar_location_button_file_changed (ThunarLocationButton *location_button,
ThunarFile *file);
+static gboolean thunar_location_button_button_press_event (GtkWidget *button,
+ GdkEventButton *event,
+ ThunarLocationButton *location_button);
static gboolean thunar_location_button_button_release_event (GtkWidget *button,
GdkEventButton *event,
ThunarLocationButton *location_button);
@@ -260,6 +263,7 @@ thunar_location_button_init (ThunarLocationButton *location_button)
gtk_drag_source_set (GTK_WIDGET (button), GDK_BUTTON1_MASK, drag_targets, G_N_ELEMENTS (drag_targets), GDK_ACTION_LINK);
gtk_drag_dest_set (GTK_WIDGET (button), GTK_DEST_DEFAULT_HIGHLIGHT | GTK_DEST_DEFAULT_MOTION, drag_targets,
G_N_ELEMENTS (drag_targets), GDK_ACTION_ASK | GDK_ACTION_COPY | GDK_ACTION_LINK | GDK_ACTION_MOVE);
+ g_signal_connect (G_OBJECT (button), "button-press-event", G_CALLBACK (thunar_location_button_button_press_event), location_button);
g_signal_connect (G_OBJECT (button), "button-release-event", G_CALLBACK (thunar_location_button_button_release_event), location_button);
g_signal_connect (G_OBJECT (button), "drag-drop", G_CALLBACK (thunar_location_button_drag_drop), location_button);
g_signal_connect (G_OBJECT (button), "drag-data-get", G_CALLBACK (thunar_location_button_drag_data_get), location_button);
@@ -440,6 +444,22 @@ thunar_location_button_file_changed (ThunarLocationButton *location_button,
static gboolean
+thunar_location_button_button_press_event (GtkWidget *button,
+ GdkEventButton *event,
+ ThunarLocationButton *location_button)
+{
+ g_return_val_if_fail (THUNAR_IS_LOCATION_BUTTON (location_button), FALSE);
+
+ /* set button state to inconsistent while holding down the middle-mouse-button */
+ if (G_UNLIKELY (event->button == 2))
+ gtk_toggle_button_set_inconsistent (GTK_TOGGLE_BUTTON (button), TRUE);
+
+ return FALSE;
+}
+
+
+
+static gboolean
thunar_location_button_button_release_event (GtkWidget *button,
GdkEventButton *event,
ThunarLocationButton *location_button)
@@ -448,13 +468,20 @@ thunar_location_button_button_release_event (GtkWidget *button,
g_return_val_if_fail (THUNAR_IS_LOCATION_BUTTON (location_button), FALSE);
- /* open folder in window on middle-click events */
- if (G_UNLIKELY (event->button == 2 && location_button->file != NULL))
+ /* reset inconsistent button state after releasing the middle-mouse-button */
+ if (G_UNLIKELY (event->button == 2))
{
- /* popup a new window */
- application = thunar_application_get ();
- thunar_application_open_window (application, location_button->file, gtk_widget_get_screen (button));
- g_object_unref (G_OBJECT (application));
+ /* reset button state */
+ gtk_toggle_button_set_inconsistent (GTK_TOGGLE_BUTTON (button), FALSE);
+
+ /* open folder in window on middle-click events */
+ if (G_LIKELY (location_button->file != NULL))
+ {
+ /* popup a new window */
+ application = thunar_application_get ();
+ thunar_application_open_window (application, location_button->file, gtk_widget_get_screen (button));
+ g_object_unref (G_OBJECT (application));
+ }
}
return FALSE;