static gboolean query_completed_cb (GcalShellSearchProvider *search_provider, GcalManager *manager) { GcalShellSearchProviderPrivate *priv = search_provider->priv; GList *events, *l; GVariantBuilder builder; time_t current_time_t; g_hash_table_remove_all (priv->events); events = gcal_manager_get_shell_search_events (priv->manager); if (events == NULL) { g_dbus_method_invocation_return_value (priv->pending_search->invocation, g_variant_new ("(as)", NULL)); goto out; } g_variant_builder_init (&builder, G_VARIANT_TYPE ("as")); current_time_t = time (NULL); events = g_list_sort_with_data (events, (GCompareDataFunc) sort_event_data, ¤t_time_t); for (l = events; l != NULL; l = g_list_next (l)) { const gchar *uid; uid = gcal_event_get_uid (l->data); if (g_hash_table_contains (priv->events, uid)) continue; g_variant_builder_add (&builder, "s", uid); g_hash_table_insert (priv->events, g_strdup (uid), l->data); } g_list_free (events); g_dbus_method_invocation_return_value (priv->pending_search->invocation, g_variant_new ("(as)", &builder)); out: g_object_unref (priv->pending_search->invocation); g_strfreev (priv->pending_search->terms); g_clear_pointer (&(priv->pending_search), g_free); g_application_release (g_application_get_default ()); return FALSE; }
/** * gcal_event_widget_equal: * @widget1: an #GcalEventWidget representing an event * @widget2: an #GcalEventWidget representing an event * * Check if two widget represent the same event. * * Returns: %TRUE if both widget represent the same event, * false otherwise **/ gboolean gcal_event_widget_equal (GcalEventWidget *widget1, GcalEventWidget *widget2) { return g_strcmp0 (gcal_event_get_uid (widget1->event), gcal_event_get_uid (widget2->event)) == 0; }