00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #include <stdio.h>
00033 #include <stdlib.h>
00034 #include <string.h>
00035 #include "config.h"
00036
00037 #include "debug.h"
00038 #include "easydbus-core.h"
00039 #include "utils.h"
00040
00046 void
00047 easydbus_init (void)
00048 {
00049 EasyDbusDebug ("%s version %s", PACKAGE_NAME, VERSION);
00050
00051
00052 dbus_threads_init_default ();
00053 }
00054
00055
00061 inline void
00062 easydbus_deinit (void)
00063 {
00064 EasyDbusDebug ("Deinit %s %s library...", PACKAGE_NAME, VERSION);
00065 dbus_shutdown ();
00066 }
00067
00068
00078 int
00079 easydbus_start_service (EasyDbus_conn * data,
00080 char *service_name)
00081 {
00082 struct EasyDbus_core *core =
00083 (struct EasyDbus_core *) data;
00084 DBusError err;
00085
00086 dbus_error_init (&err);
00087
00088 if (dbus_bus_start_service_by_name
00089 (core->conn, service_name, 0, NULL, &err)) {
00090 return 0;
00091 }
00092
00093 EasyDbusDebug ("Error on start service: %s\n",
00094 err.message);
00095
00096 dbus_error_free (&err);
00097 return -1;
00098 }
00099
00100