From 43273844fccd6990c8716ee67f90eedc105528aa Mon Sep 17 00:00:00 2001 From: hiro Date: Thu, 29 Oct 2009 01:54:05 +0000 Subject: src/addressbook.c: change selection if a non-selected row is right-clicked. git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@2311 ee746299-78ed-0310-b773-934348b2243d --- src/addressbook.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/addressbook.c b/src/addressbook.c index 3992ba71..7bfa7915 100644 --- a/src/addressbook.c +++ b/src/addressbook.c @@ -1490,14 +1490,30 @@ static gboolean addressbook_list_button_pressed(GtkWidget *widget, return FALSE; if (event->button == 3) { - gtk_menu_popup(GTK_MENU(addrbook.list_popup), NULL, NULL, NULL, NULL, event->button, event->time); - return TRUE; + GtkTreePath *path; + GtkTreeSelection *selection; + + gtk_menu_popup(GTK_MENU(addrbook.list_popup), NULL, NULL, + NULL, NULL, event->button, event->time); + if (gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(widget), + event->x, event->y, + &path, NULL, NULL, NULL)) { + selection = gtk_tree_view_get_selection + (GTK_TREE_VIEW(widget)); + if (gtk_tree_selection_path_is_selected + (selection, path)) { + gtk_tree_path_free(path); + return TRUE; + } + gtk_tree_path_free(path); + } } else if (event->type == GDK_2BUTTON_PRESS) { debug_print("addressbook_list_button_pressed: GDK_2BUTTON_PRESS\n"); /* Handle double click */ if (prefs_common.add_address_by_click && addrbook.target_compose) - addressbook_to_clicked(NULL, GINT_TO_POINTER(COMPOSE_ENTRY_TO)); + addressbook_to_clicked + (NULL, GINT_TO_POINTER(COMPOSE_ENTRY_TO)); else addressbook_edit_address_cb(NULL, 0, NULL); } -- cgit v1.2.3