File:  [GNUtrition Sources] / gnutrition / dbus.h
Revision 1.1: download - view: text, annotated - select for diffs
Fri May 8 03:23:59 2026 UTC (12 days, 15 hours ago) by asm
Branches: MAIN
CVS tags: HEAD
Migration from Git with 0.33rc1 changes.

// SPDX-License-Identifier: GPL-3.0-or-later
/*
 * $Id: dbus.h,v 1.1 2026/05/08 03:23:59 asm Exp $
 *
 * dbus.h - D-Bus interface for GNUtrition
 *
 * Copyright (C) 2026 Free Software Foundation, Inc.
 *
 * Author: Jason Self <jself@gnu.org>
 */

#ifndef DBUS_H
#define DBUS_H

#include <gio/gio.h>
#include <sqlite3.h>

/* Context for the D-Bus service, holding database handles.  */
struct dbus_context
{
  sqlite3 *food_db;
  sqlite3 *log_db;
  int calories;
};

/* Start the D-Bus service on the session bus.  CTX holds the
   database handles used by method implementations.  Returns the
   owner ID (> 0) on success, 0 on failure.  The caller must call
   dbus_service_stop to release resources.  */
guint dbus_service_start (struct dbus_context *ctx);

/* Stop the D-Bus service and release the bus name.  */
void dbus_service_stop (guint owner_id);

#endif /* DBUS_H */

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>