diff src/dupe.c @ 448:a73cc0fa14d0

Use explicit names for mouse buttons instead of numbers. MOUSE_BUTTON_LEFT = 1 MOUSE_BUTTON_MIDDLE = 2 MOUSE_BUTTON_RIGHT = 3 It makes the code easier to read.
author zas_
date Sun, 20 Apr 2008 21:30:36 +0000
parents ddabc4873a3f
children 48c8e49b571c
line wrap: on
line diff
--- a/src/dupe.c	Sun Apr 20 20:35:26 2008 +0000
+++ b/src/dupe.c	Sun Apr 20 21:30:36 2008 +0000
@@ -2289,7 +2289,7 @@
 
 	dw->click_item = di;
 
-	if (bevent->button == 3)
+	if (bevent->button == MOUSE_BUTTON_RIGHT)
 		{
 		/* right click menu */
 		GtkWidget *menu;
@@ -2312,14 +2312,15 @@
 
 	if (!di) return FALSE;
 
-	if (bevent->button == 1 && bevent->type == GDK_2BUTTON_PRESS)
+	if (bevent->button == MOUSE_BUTTON_LEFT &&
+	    bevent->type == GDK_2BUTTON_PRESS)
 		{
 		dupe_menu_view(dw, di, widget, FALSE);
 		}
 
-	if (bevent->button == 2) return TRUE;
-
-	if (bevent->button == 3)
+	if (bevent->button == MOUSE_BUTTON_MIDDLE) return TRUE;
+
+	if (bevent->button == MOUSE_BUTTON_RIGHT)
 		{
 		if (!dupe_listview_item_is_selected(dw, di, widget))
 			{
@@ -2337,7 +2338,8 @@
 		return TRUE;
 		}
 
-	if (bevent->button == 1 && bevent->type == GDK_BUTTON_PRESS &&
+	if (bevent->button == MOUSE_BUTTON_LEFT &&
+	    bevent->type == GDK_BUTTON_PRESS &&
 	    !(bevent->state & GDK_SHIFT_MASK ) &&
 	    !(bevent->state & GDK_CONTROL_MASK ) &&
 	    dupe_listview_item_is_selected(dw, di, widget))
@@ -2358,7 +2360,7 @@
 	GtkTreeIter iter;
 	DupeItem *di = NULL;
 
-	if (bevent->button != 1 && bevent->button != 2) return TRUE;
+	if (bevent->button != MOUSE_BUTTON_LEFT && bevent->button != MOUSE_BUTTON_MIDDLE) return TRUE;
 
 	store = gtk_tree_view_get_model(GTK_TREE_VIEW(widget));
 
@@ -2371,7 +2373,7 @@
 		gtk_tree_path_free(tpath);
 		}
 
-	if (bevent->button == 2)
+	if (bevent->button == MOUSE_BUTTON_MIDDLE)
 		{
 		if (di && dw->click_item == di)
 			{