Implement delete call with context menu on longpress

* src/ui/call-record-row.ui: Add menu, GtkPopover. Surround existing
  elements with GtkEventBox to capture longpress/rightclicks
* src/calls-call-record-row.c: Provide functions emiting "call-delete"
  signal, add widgets from ui file
* src/calls-record.c: Add "call-delete" signal
* src/calls-history-box.c: Add callback for "call-delete" signal
* src/calls-record-store.c: Add callback for "call-delete" signal
* src/util.c: Add convenience function calls_find_in_store for finding
  items in ListModel
* src/util.h: Add declaration of calls_find_in_store
This commit is contained in:
Evangelos Ribeiro Tzaras
2020-06-08 15:09:57 +02:00
parent b15c2876da
commit 4bf5cd5232
7 changed files with 330 additions and 77 deletions

View File

@@ -142,3 +142,36 @@ calls_date_time_is_same_year (GDateTime *a,
g_date_time_get_year (a) ==
g_date_time_get_year (b);
}
gboolean
calls_find_in_store (GListModel *list,
gpointer item,
guint *position)
{
#if GLIB_CHECK_VERSION(2, 64, 0)
return g_list_store_find ((GListStore *) list,
item,
position);
#else
guint count;
g_return_val_if_fail (G_IS_LIST_MODEL (list), FALSE);
count = g_list_model_get_n_items (list);
for (guint i = 0; i < count; i++)
{
g_autoptr (GObject) object = NULL;
object = g_list_model_get_item (list, i);
if (object == item)
{
*position = i;
return TRUE;
}
}
return FALSE;
#endif
}