2002-09-12 01:23:35 +00:00
|
|
|
//
|
|
|
|
// GnomeDb.Application.cs - libgnomedb initialization and event loop
|
|
|
|
//
|
|
|
|
// Author: Rodrigo Moya <rodrigo@ximian.com>
|
|
|
|
//
|
|
|
|
// (c) 2002 Rodrigo Moya
|
|
|
|
//
|
|
|
|
|
|
|
|
using System;
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
|
|
|
namespace GnomeDb
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// GnomeDb Application class
|
|
|
|
/// </summary>
|
|
|
|
///
|
|
|
|
/// <remarks>
|
|
|
|
/// Provides the initialization and event loop iteration related
|
|
|
|
/// methods for the libgnomedb library.
|
|
|
|
/// </remarks>
|
|
|
|
|
|
|
|
public class Application
|
|
|
|
{
|
2003-02-05 18:52:45 +00:00
|
|
|
private const string VERSION = "0.10";
|
|
|
|
|
2002-09-12 01:23:35 +00:00
|
|
|
[DllImport("gnomedb-2")]
|
|
|
|
static extern void gnome_db_init (string app_id, string version, int nargs, IntPtr args);
|
|
|
|
|
|
|
|
public static void Init ()
|
|
|
|
{
|
2003-02-05 18:52:45 +00:00
|
|
|
gnome_db_init ("GnomeDb#", VERSION, 0, new IntPtr(0));
|
2002-09-12 01:23:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public static void Init (string app_id, string version)
|
|
|
|
{
|
|
|
|
gnome_db_init (app_id, version, 0, new IntPtr(0));
|
|
|
|
}
|
|
|
|
|
|
|
|
static extern void gnome_db_init (string app_id, string version, ref int nargs, ref String [] args);
|
|
|
|
|
|
|
|
public static void Init (ref string [] args)
|
|
|
|
{
|
|
|
|
int argc = args.Length;
|
2003-02-05 18:52:45 +00:00
|
|
|
gnome_db_init ("GnomeDb#", VERSION, ref argc, ref args);
|
2002-09-12 01:23:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public static void Init (string app_id, string version, ref string [] args)
|
|
|
|
{
|
|
|
|
int argc = args.Length;
|
|
|
|
gnome_db_init (app_id, version, ref argc, ref args);
|
|
|
|
}
|
|
|
|
|
|
|
|
[DllImport("gnomedb-2")]
|
|
|
|
static extern void gnome_db_main_run (IntPtr init_func, IntPtr user_data);
|
|
|
|
|
|
|
|
public static void Run ()
|
|
|
|
{
|
|
|
|
gnome_db_main_run (IntPtr.Zero, IntPtr.Zero);
|
|
|
|
}
|
|
|
|
|
|
|
|
[DllImport("gnomedb-2")]
|
|
|
|
static extern void gnome_db_main_quit ();
|
|
|
|
|
|
|
|
public static void Quit ()
|
|
|
|
{
|
|
|
|
gnome_db_main_quit ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|