gnome: add to contact

Adds context menu item which allows the user to choose an existing
contact or create a new contact to add the selected contact method
to.

Note: this currently seems to fail with non local address books
(specifically with google contacts), even though the EDS methods
will ocasionally return as having succeeded. This is a bug which
will be addressed in later patches.

Issue: #78234
Change-Id: Ia7dc4e8cf5cc5582d4f734f6e46d26cf4b2195dd
diff --git a/src/historyview.cpp b/src/historyview.cpp
index 758391e..f53c603 100644
--- a/src/historyview.cpp
+++ b/src/historyview.cpp
@@ -200,7 +200,16 @@
         if (auto call = var_c.value<Call *>()) {
             auto contactmethod = call->peerContactMethod();
             if (!contact_method_has_contact(contactmethod)) {
-                auto add_to = menu_item_contact_add_to(contactmethod, GTK_WIDGET(treeview));
+                GtkTreeIter iter;
+                GtkTreeModel *model;
+                gtk_tree_selection_get_selected(selection, &model, &iter);
+                auto path = gtk_tree_model_get_path(model, &iter);
+                auto column = gtk_tree_view_get_column(treeview, 0);
+                GdkRectangle rect;
+                gtk_tree_view_get_cell_area(treeview, path, column, &rect);
+                gtk_tree_view_convert_bin_window_to_widget_coords(treeview, rect.x, rect.y, &rect.x, &rect.y);
+                gtk_tree_path_free(path);
+                auto add_to = menu_item_add_to_contact(contactmethod, GTK_WIDGET(treeview), &rect);
                 gtk_menu_shell_append(GTK_MENU_SHELL(menu), add_to);
             }
         }