New file.
2000-11-22 Martin Baulig <martin@home-of-linux.org> * lib/glibtop-server.c: New file. * lib/test-backends.c: New file. * lib/Makefile.am: Build test-backends test program. * lib/init-backends.c: Port this to libxml 2. * configure.in: Make this really work. * acinclude.m4: Removed the xml stuff. * Makefile.am (SUBDIRS): Put lib in front of sysdeps and backends.
This commit is contained in:
committed by
Martin Baulig
parent
81b009733e
commit
cee38c53bc
13
ChangeLog
13
ChangeLog
@@ -1,3 +1,16 @@
|
|||||||
|
2000-11-22 Martin Baulig <martin@home-of-linux.org>
|
||||||
|
|
||||||
|
* lib/glibtop-server.c: New file.
|
||||||
|
|
||||||
|
* lib/test-backends.c: New file.
|
||||||
|
* lib/Makefile.am: Build test-backends test program.
|
||||||
|
|
||||||
|
* lib/init-backends.c: Port this to libxml 2.
|
||||||
|
|
||||||
|
* configure.in: Make this really work.
|
||||||
|
* acinclude.m4: Removed the xml stuff.
|
||||||
|
* Makefile.am (SUBDIRS): Put lib in front of sysdeps and backends.
|
||||||
|
|
||||||
2000-11-21 Martin Baulig <martin@home-of-linux.org>
|
2000-11-21 Martin Baulig <martin@home-of-linux.org>
|
||||||
|
|
||||||
* configure.in: Removed gnomesupport checks here and started
|
* configure.in: Removed gnomesupport checks here and started
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
## Process this file with automake to produce Makefile.in.
|
## Process this file with automake to produce Makefile.in.
|
||||||
|
|
||||||
SUBDIRS = po intl misc include sysdeps backends lib src doc dtd scripts
|
SUBDIRS = po intl misc include lib sysdeps backends src doc dtd scripts
|
||||||
|
|
||||||
include_HEADERS = glibtop.h
|
include_HEADERS = glibtop.h
|
||||||
configincludedir = $(pkglibdir)/include
|
configincludedir = $(pkglibdir)/include
|
||||||
|
38
acinclude.m4
38
acinclude.m4
@@ -520,41 +520,3 @@ AC_DEFUN([GNOME_LIBGTOP_SYSDEPS],[
|
|||||||
AM_CONDITIONAL(HAVE_SYSDEPS, test x$libgtop_have_sysdeps = xyes)
|
AM_CONDITIONAL(HAVE_SYSDEPS, test x$libgtop_have_sysdeps = xyes)
|
||||||
AM_CONDITIONAL(LIBGTOP_USE_GMODULE, test x$libgtop_use_gmodule = xyes)
|
AM_CONDITIONAL(LIBGTOP_USE_GMODULE, test x$libgtop_use_gmodule = xyes)
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl
|
|
||||||
dnl LIBGTOP_XML_HOOK (script-if-xml-found, failflag)
|
|
||||||
dnl
|
|
||||||
dnl If failflag is "failure", script aborts due to lack of XML
|
|
||||||
dnl
|
|
||||||
dnl Check for availability of the libxml library
|
|
||||||
dnl the XML parser uses libz if available too
|
|
||||||
dnl
|
|
||||||
|
|
||||||
AC_DEFUN([LIBGTOP_XML_HOOK],[
|
|
||||||
LIBGTOP_XML_LIB=
|
|
||||||
AC_PATH_PROG(XML_CONFIG,xml-config,no)
|
|
||||||
if test "$XML_CONFIG" = no; then
|
|
||||||
if test x$2 = xfailure; then
|
|
||||||
AC_MSG_ERROR(Could not find xml-config)
|
|
||||||
else
|
|
||||||
AC_MSG_WARN(Could not find xml-config)
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
AC_CHECK_LIB(xml, xmlDocGetRootElement, [
|
|
||||||
$1
|
|
||||||
LIBGTOP_XML_LIB=`$XML_CONFIG --libs`
|
|
||||||
AC_DEFINE(HAVE_LIBXML)
|
|
||||||
], [
|
|
||||||
if test x$2 = xfailure; then
|
|
||||||
AC_MSG_ERROR(Could not link sample xml program)
|
|
||||||
else
|
|
||||||
AC_MSG_WARN(Could not link sample xml program)
|
|
||||||
fi
|
|
||||||
], `$XML_CONFIG --libs`)
|
|
||||||
fi
|
|
||||||
AC_SUBST(LIBGTOP_XML_LIB)
|
|
||||||
])
|
|
||||||
|
|
||||||
AC_DEFUN([LIBGTOP_XML_CHECK], [
|
|
||||||
LIBGTOP_XML_HOOK([],failure)
|
|
||||||
])
|
|
||||||
|
46
configure.in
46
configure.in
@@ -50,10 +50,8 @@ AC_SUBST(LT_CURRENT)
|
|||||||
AC_SUBST(LT_REVISION)
|
AC_SUBST(LT_REVISION)
|
||||||
AC_SUBST(LT_AGE)
|
AC_SUBST(LT_AGE)
|
||||||
|
|
||||||
GNOME_INTERFACE_VERSION=2
|
|
||||||
AC_SUBST(GNOME_INTERFACE_VERSION)
|
|
||||||
|
|
||||||
GNOME_COMMON_INIT
|
GNOME_COMMON_INIT
|
||||||
|
GNOME_PLATFORM_GNOME_2(yes, force)
|
||||||
|
|
||||||
AC_ISC_POSIX
|
AC_ISC_POSIX
|
||||||
AC_PROG_CC
|
AC_PROG_CC
|
||||||
@@ -94,7 +92,7 @@ AM_PROG_LIBTOOL
|
|||||||
dnl Let the user enable compiler warnings
|
dnl Let the user enable compiler warnings
|
||||||
GNOME_COMPILE_WARNINGS
|
GNOME_COMPILE_WARNINGS
|
||||||
|
|
||||||
PKG_CHECK_MODULES(GNOMESUPPORT, gnome-support-2.0:1.2.1)
|
GNOME_PKGCONFIG_CHECK_MODULES(GNOMESUPPORT, gnome-support-2.0:1.2.1)
|
||||||
AC_SUBST(GNOMESUPPORT_CFLAGS)
|
AC_SUBST(GNOMESUPPORT_CFLAGS)
|
||||||
AC_SUBST(GNOMESUPPORT_LIBS)
|
AC_SUBST(GNOMESUPPORT_LIBS)
|
||||||
|
|
||||||
@@ -117,7 +115,10 @@ fi
|
|||||||
AC_SUBST(sysdeps_init_file)
|
AC_SUBST(sysdeps_init_file)
|
||||||
AC_MSG_RESULT($sysdeps_init_file)
|
AC_MSG_RESULT($sysdeps_init_file)
|
||||||
|
|
||||||
LIBGTOP_XML_CHECK
|
GNOME_PKGCONFIG_CHECK_MODULES(XML, libxml-2.0:2.2.8)
|
||||||
|
AC_DEFINE(HAVE_LIBXML)
|
||||||
|
AC_SUBST(XML_CFLAGS)
|
||||||
|
AC_SUBST(XML_LIBS)
|
||||||
|
|
||||||
AC_ARG_WITH(libgtop-inodedb,
|
AC_ARG_WITH(libgtop-inodedb,
|
||||||
[ --with-libgtop-inodedb Build the inodedb stuff (default=no)],
|
[ --with-libgtop-inodedb Build the inodedb stuff (default=no)],
|
||||||
@@ -142,15 +143,12 @@ AM_CONDITIONAL(ENABLE_SHARED, test x$enable_static = xyes)
|
|||||||
AM_PROG_LIBTOOL
|
AM_PROG_LIBTOOL
|
||||||
|
|
||||||
if test x$libgtop_use_gmodule = xyes ; then
|
if test x$libgtop_use_gmodule = xyes ; then
|
||||||
AM_PATH_GLIB_2_0(1.3.0,,AC_MSG_ERROR(GLIB >= 1.3.0 is required for LibGTop),
|
GNOME_PKGCONFIG_CHECK_MODULES(GLIB, glib-2.0:1.3.1 gmodule-2.0:1.3.1 gobject-2.0:1.3.1)
|
||||||
[gmodule])
|
|
||||||
else
|
else
|
||||||
AM_PATH_GLIB_2_0(1.3.0,,AC_MSG_ERROR(GLIB >= 1.3.0 is required for LibGTop))
|
GNOME_PKGCONFIG_CHECK_MODULES(GLIB, glib-2.0:1.3.1 gobject-2.0:1.3.1)
|
||||||
fi
|
fi
|
||||||
|
AC_SUBST(GLIB_CFLAGS)
|
||||||
dnl You need to uncomment the following line if you want to use
|
AC_SUBST(GLIB_LIBS)
|
||||||
dnl libGTop without Gnome.
|
|
||||||
dnl GNOME_SUPPORT_CHECKS
|
|
||||||
|
|
||||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||||
AC_C_CONST
|
AC_C_CONST
|
||||||
@@ -278,24 +276,6 @@ if test "x$libgtop_enable_debug" = xyes ; then
|
|||||||
AC_DEFINE(LIBGTOP_ENABLE_DEBUG)
|
AC_DEFINE(LIBGTOP_ENABLE_DEBUG)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "x$gnome_found" = xyes ; then
|
|
||||||
LIBSUPPORT="$GNOME_LIBDIR -lgnomesupport"
|
|
||||||
SUPPORTINCS="$GNOME_INCLUDEDIR"
|
|
||||||
else
|
|
||||||
LIBSUPPORT='$(top_builddir)/support/libgnomesupport.la'
|
|
||||||
SUPPORTINCS='-DNEED_GNOMESUPPORT_H -I$(top_builddir)/support -I$(top_srcdir)/support'
|
|
||||||
fi
|
|
||||||
|
|
||||||
dnl Some ugly hack; if '-lgnomesupport' is part of $GNOME_LIBS,
|
|
||||||
dnl we include it here.
|
|
||||||
case "$GNOME_LIBS" in
|
|
||||||
'*-lgnomesupport*' )
|
|
||||||
LIBSUPPORT="$GNOME_LIBDIR -lgnomesupport"
|
|
||||||
SUPPORTINCS="$GNOME_INCLUDEDIR" ;;
|
|
||||||
esac
|
|
||||||
AC_SUBST(LIBSUPPORT)
|
|
||||||
AC_SUBST(SUPPORTINCS)
|
|
||||||
|
|
||||||
dnl These definitions are expanded in make.
|
dnl These definitions are expanded in make.
|
||||||
LIBGTOP_LIBS='-L$(libdir)'
|
LIBGTOP_LIBS='-L$(libdir)'
|
||||||
LIBGTOP_INCS='-I$(includedir) -I$(pkglibdir)/include'
|
LIBGTOP_INCS='-I$(includedir) -I$(pkglibdir)/include'
|
||||||
@@ -316,12 +296,12 @@ if test x$libgtop_have_sysinfo = xyes ; then
|
|||||||
LIBGTOP_INCS="$LIBGTOP_INCS -DHAVE_LIBGTOP_SYSINFO"
|
LIBGTOP_INCS="$LIBGTOP_INCS -DHAVE_LIBGTOP_SYSINFO"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
LIBGTOP_INCS="$LIBGTOP_INCS $SUPPORTINCS $GLIB_CFLAGS"
|
LIBGTOP_INCS="$LIBGTOP_INCS $GNOMESUPPORT_CFLAGS $GLIB_CFLAGS $XML_CFLAGS"
|
||||||
|
|
||||||
LIBGTOP_BINDIR='$(bindir)'
|
LIBGTOP_BINDIR='$(bindir)'
|
||||||
LIBGTOP_SERVER='$(bindir)/libgtop_server'
|
LIBGTOP_SERVER='$(bindir)/libgtop_server'
|
||||||
|
|
||||||
LIBGTOP_EXTRA_LIBS="$LIBGTOP_EXTRA_LIBS $GLIB_LIBS $LIBGTOP_XML_LIB"
|
LIBGTOP_EXTRA_LIBS="$LIBGTOP_EXTRA_LIBS $GLIB_LIBS $XML_LIBS"
|
||||||
|
|
||||||
if test x$libgtop_use_gmodule != xyes ; then
|
if test x$libgtop_use_gmodule != xyes ; then
|
||||||
LIBGTOP_LIBS="$LIBGTOP_LIBS -lgtop -lgtop_backend_common -lgtop_common"
|
LIBGTOP_LIBS="$LIBGTOP_LIBS -lgtop -lgtop_backend_common -lgtop_common"
|
||||||
@@ -348,7 +328,7 @@ AC_SUBST(machine_incs)
|
|||||||
|
|
||||||
LIBGTOP_BACKEND_DIR="\$(datadir)/libgtop/backends"
|
LIBGTOP_BACKEND_DIR="\$(datadir)/libgtop/backends"
|
||||||
|
|
||||||
INCLUDES="-D_IN_LIBGTOP -D_GNU_SOURCE -DGLIBTOP_NAMES -I\$(top_builddir) -I\$(top_srcdir) -I\$(top_srcdir)/sysdeps/$sysdeps_dir -I\$(top_srcdir)/include -I\$(top_builddir)/include -I\$(top_srcdir)/intl $SUPPORTINCS $GLIB_CFLAGS $CFLAGS $X_CFLAGS "'-DGTOPLOCALEDIR=\"$(datadir)/locale\" -DLIBGTOP_VERSION=\"'"$LIBGTOP_VERSION"'\" -DLIBGTOP_SERVER_VERSION=\"'"$LIBGTOP_SERVER_VERSION"'\" -DLIBGTOP_VERSION_CODE='$LIBGTOP_VERSION_CODE' -DLIBGTOP_SERVER=\"'"$LIBGTOP_SERVER"'\" -DLIBGTOP_BACKEND_DIR=\"'"$LIBGTOP_BACKEND_DIR"'\"'
|
INCLUDES="-D_IN_LIBGTOP -D_GNU_SOURCE -DGLIBTOP_NAMES -I\$(top_builddir) -I\$(top_srcdir) -I\$(top_srcdir)/sysdeps/$sysdeps_dir -I\$(top_srcdir)/include -I\$(top_builddir)/include -I\$(top_srcdir)/intl $GNOMESUPPORT_CFLAGS $GLIB_CFLAGS $XML_CFLAGS $CFLAGS $X_CFLAGS "'-DGTOPLOCALEDIR=\"$(datadir)/locale\" -DLIBGTOP_VERSION=\"'"$LIBGTOP_VERSION"'\" -DLIBGTOP_SERVER_VERSION=\"'"$LIBGTOP_SERVER_VERSION"'\" -DLIBGTOP_VERSION_CODE='$LIBGTOP_VERSION_CODE' -DLIBGTOP_SERVER=\"'"$LIBGTOP_SERVER"'\" -DLIBGTOP_BACKEND_DIR=\"'"$LIBGTOP_BACKEND_DIR"'\"'
|
||||||
|
|
||||||
AC_SUBST(INCLUDES)
|
AC_SUBST(INCLUDES)
|
||||||
|
|
||||||
|
@@ -7,3 +7,5 @@ libgtop.la
|
|||||||
lib.c
|
lib.c
|
||||||
structures.h
|
structures.h
|
||||||
sysdeps-init.c
|
sysdeps-init.c
|
||||||
|
libgtop_server.la
|
||||||
|
test-backends
|
||||||
|
@@ -2,18 +2,27 @@ LINK = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@
|
|||||||
|
|
||||||
INCLUDES = @INCLUDES@
|
INCLUDES = @INCLUDES@
|
||||||
|
|
||||||
lib_LTLIBRARIES = libgtop.la libgtop_server.la
|
noinst_PROGRAMS = test-backends
|
||||||
|
|
||||||
libgtop_la_SOURCES = errors.c glib-arrays.c backend.c \
|
lib_LTLIBRARIES = libgtop.la
|
||||||
|
|
||||||
|
noinst_LTLIBRARIES = libgtop_server.la
|
||||||
|
|
||||||
|
libgtop_la_SOURCES = errors.c backend.c \
|
||||||
init-backends.c open-backend.c \
|
init-backends.c open-backend.c \
|
||||||
glibtop-client.c
|
glibtop-client.c glibtop-server.c
|
||||||
|
|
||||||
libgtop_server_la_SOURCES = error.c xmalloc.c
|
libgtop_server_la_SOURCES = error.c xmalloc.c
|
||||||
|
|
||||||
libgtop_server_la_LDFLAGS = $(LT_VERSION_INFO)
|
libgtop_server_la_LDFLAGS = $(LT_VERSION_INFO)
|
||||||
|
|
||||||
libgtop_la_LDFLAGS = $(LT_VERSION_INFO)
|
libgtop_la_LDFLAGS = $(LT_VERSION_INFO)
|
||||||
libgtop_la_LIBADD = $(LIBGTOP_XML_LIB)
|
libgtop_la_LIBADD = $(GLIB_LIBS) $(XML_LIBS)
|
||||||
|
|
||||||
|
test_backends_SOURCES = \
|
||||||
|
test-backends.c
|
||||||
|
|
||||||
|
test_backends_LDADD = libgtop.la
|
||||||
|
|
||||||
glibtopdir = $(includedir)/glibtop
|
glibtopdir = $(includedir)/glibtop
|
||||||
|
|
||||||
|
@@ -25,6 +25,9 @@
|
|||||||
|
|
||||||
#include <glibtop.h>
|
#include <glibtop.h>
|
||||||
|
|
||||||
|
#include <gobject/gsignal.h>
|
||||||
|
#include <gobject/gvaluetypes.h>
|
||||||
|
|
||||||
static void glibtop_client_class_init (glibtop_client_class *klass);
|
static void glibtop_client_class_init (glibtop_client_class *klass);
|
||||||
static void glibtop_client_init (glibtop_client *client);
|
static void glibtop_client_init (glibtop_client *client);
|
||||||
static void glibtop_client_finalize (GObject *object);
|
static void glibtop_client_finalize (GObject *object);
|
||||||
@@ -38,6 +41,14 @@ struct _glibtop_client_private
|
|||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum {
|
||||||
|
GLIBTOP_CLIENT_SIGNAL_ERROR,
|
||||||
|
GLIBTOP_CLIENT_SIGNAL_WARNING,
|
||||||
|
LAST_SIGNAL
|
||||||
|
};
|
||||||
|
|
||||||
|
static guint glibtop_client_signals [LAST_SIGNAL] = { 0 };
|
||||||
|
|
||||||
GType
|
GType
|
||||||
glibtop_client_get_type (void)
|
glibtop_client_get_type (void)
|
||||||
{
|
{
|
||||||
@@ -63,14 +74,103 @@ glibtop_client_get_type (void)
|
|||||||
return glibtop_client_type;
|
return glibtop_client_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
glibtop_client_error_handler (glibtop_client *client, GError *error)
|
||||||
|
{
|
||||||
|
g_return_if_fail (GLIBTOP_IS_CLIENT (client));
|
||||||
|
|
||||||
|
if (error == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
g_error ("%s (%d): %s", g_quark_to_string (error->domain),
|
||||||
|
error->code, error->message);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
glibtop_client_warning_handler (glibtop_client *client, GError *error)
|
||||||
|
{
|
||||||
|
g_return_if_fail (GLIBTOP_IS_CLIENT (client));
|
||||||
|
|
||||||
|
if (error == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
g_warning ("%s (%d): %s", g_quark_to_string (error->domain),
|
||||||
|
error->code, error->message);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
glibtop_client_marshal_VOID__POINTER (GClosure *closure,
|
||||||
|
GValue *return_value,
|
||||||
|
guint n_param_values,
|
||||||
|
const GValue *param_values,
|
||||||
|
gpointer invocation_hint,
|
||||||
|
gpointer marshal_data)
|
||||||
|
{
|
||||||
|
typedef void (*GSignalFunc_VOID__POINTER) (gpointer data1,
|
||||||
|
gpointer arg_1,
|
||||||
|
gpointer data2);
|
||||||
|
register GSignalFunc_VOID__POINTER callback;
|
||||||
|
register GCClosure *cc = (GCClosure*) closure;
|
||||||
|
register gpointer data1, data2;
|
||||||
|
|
||||||
|
g_return_if_fail (n_param_values >= 2);
|
||||||
|
|
||||||
|
if (G_CCLOSURE_SWAP_DATA (closure))
|
||||||
|
{
|
||||||
|
data1 = closure->data;
|
||||||
|
data2 = g_value_get_as_pointer (param_values + 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
data1 = g_value_get_as_pointer (param_values + 0);
|
||||||
|
data2 = closure->data;
|
||||||
|
}
|
||||||
|
callback = (GSignalFunc_VOID__POINTER) (marshal_data ? marshal_data : cc->callback);
|
||||||
|
|
||||||
|
callback (data1,
|
||||||
|
g_value_get_as_pointer (param_values + 1),
|
||||||
|
data2);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
glibtop_client_class_init (glibtop_client_class *class)
|
glibtop_client_class_init (glibtop_client_class *class)
|
||||||
{
|
{
|
||||||
GObjectClass *gobject_class;
|
GObjectClass *gobject_class;
|
||||||
|
GType *param_types;
|
||||||
|
GClosure *closure;
|
||||||
|
|
||||||
gobject_class = (GObjectClass *) class;
|
gobject_class = (GObjectClass *) class;
|
||||||
|
|
||||||
parent_class = g_type_class_ref (G_TYPE_OBJECT);
|
parent_class = g_type_class_ref (G_TYPE_OBJECT);
|
||||||
|
|
||||||
|
closure = g_signal_type_closure_new (G_TYPE_FROM_CLASS (class),
|
||||||
|
G_STRUCT_OFFSET (glibtop_client_class,
|
||||||
|
error));
|
||||||
|
|
||||||
|
param_types = g_new0 (GType, 1);
|
||||||
|
param_types [0] = G_TYPE_POINTER;
|
||||||
|
|
||||||
|
glibtop_client_signals [GLIBTOP_CLIENT_SIGNAL_ERROR] =
|
||||||
|
g_signal_newv ("error", G_TYPE_FROM_CLASS (class),
|
||||||
|
G_SIGNAL_RUN_LAST, closure, NULL,
|
||||||
|
glibtop_client_marshal_VOID__POINTER,
|
||||||
|
G_TYPE_NONE, 1, param_types);
|
||||||
|
|
||||||
|
closure = g_signal_type_closure_new (G_TYPE_FROM_CLASS (class),
|
||||||
|
G_STRUCT_OFFSET (glibtop_client_class,
|
||||||
|
warning));
|
||||||
|
|
||||||
|
glibtop_client_signals [GLIBTOP_CLIENT_SIGNAL_WARNING] =
|
||||||
|
g_signal_newv ("warning", G_TYPE_FROM_CLASS (class),
|
||||||
|
G_SIGNAL_RUN_LAST, closure, NULL,
|
||||||
|
glibtop_client_marshal_VOID__POINTER,
|
||||||
|
G_TYPE_NONE, 1, param_types);
|
||||||
|
|
||||||
|
g_free (param_types);
|
||||||
|
|
||||||
|
class->error = glibtop_client_error_handler;
|
||||||
|
class->warning = glibtop_client_warning_handler;
|
||||||
|
|
||||||
gobject_class->finalize = glibtop_client_finalize;
|
gobject_class->finalize = glibtop_client_finalize;
|
||||||
}
|
}
|
||||||
@@ -104,3 +204,51 @@ glibtop_client_new (void)
|
|||||||
{
|
{
|
||||||
return g_object_new (GLIBTOP_TYPE_CLIENT, NULL);
|
return g_object_new (GLIBTOP_TYPE_CLIENT, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
glibtop_client_propagate_error (glibtop_client *client, GError *error)
|
||||||
|
{
|
||||||
|
GValue params [2] = { { 0, }, { 0, } };
|
||||||
|
|
||||||
|
g_return_if_fail (GLIBTOP_IS_CLIENT (client));
|
||||||
|
|
||||||
|
if (error == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
g_value_init (params, GLIBTOP_CLIENT_TYPE (client));
|
||||||
|
g_value_set_object (params, G_OBJECT (client));
|
||||||
|
|
||||||
|
g_value_init (params + 1, G_TYPE_POINTER);
|
||||||
|
g_value_set_pointer (params + 1, error);
|
||||||
|
|
||||||
|
g_signal_emitv (params,
|
||||||
|
glibtop_client_signals [GLIBTOP_CLIENT_SIGNAL_ERROR],
|
||||||
|
0, NULL);
|
||||||
|
|
||||||
|
g_value_unset (params + 1);
|
||||||
|
g_value_unset (params + 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
glibtop_client_propagate_warning (glibtop_client *client, GError *error)
|
||||||
|
{
|
||||||
|
GValue params [2] = { { 0, }, { 0, } };
|
||||||
|
|
||||||
|
g_return_if_fail (GLIBTOP_IS_CLIENT (client));
|
||||||
|
|
||||||
|
if (error == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
g_value_init (params, GLIBTOP_CLIENT_TYPE (client));
|
||||||
|
g_value_set_object (params, G_OBJECT (client));
|
||||||
|
|
||||||
|
g_value_init (params + 1, G_TYPE_POINTER);
|
||||||
|
g_value_set_pointer (params + 1, error);
|
||||||
|
|
||||||
|
g_signal_emitv (params,
|
||||||
|
glibtop_client_signals [GLIBTOP_CLIENT_SIGNAL_WARNING],
|
||||||
|
0, NULL);
|
||||||
|
|
||||||
|
g_value_unset (params + 1);
|
||||||
|
g_value_unset (params + 0);
|
||||||
|
}
|
||||||
|
57
lib/glibtop-server.c
Normal file
57
lib/glibtop-server.c
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
|
||||||
|
|
||||||
|
/* $Id$ */
|
||||||
|
|
||||||
|
/* Copyright (C) 1998-99 Martin Baulig
|
||||||
|
This file is part of LibGTop 2.0.
|
||||||
|
|
||||||
|
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||||
|
|
||||||
|
LibGTop is free software; you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License,
|
||||||
|
or (at your option) any later version.
|
||||||
|
|
||||||
|
LibGTop is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with LibGTop; see the file COPYING. If not, write to the
|
||||||
|
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <glibtop.h>
|
||||||
|
|
||||||
|
glibtop_server *
|
||||||
|
glibtop_server_new (void)
|
||||||
|
{
|
||||||
|
glibtop_server *retval;
|
||||||
|
|
||||||
|
retval = g_new0 (glibtop_server, 1);
|
||||||
|
retval->info = g_new0 (glibtop_server_info, 1);
|
||||||
|
retval->_priv = g_new0 (glibtop_server_private, 1);
|
||||||
|
retval->refcount = 1;
|
||||||
|
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
glibtop_server_ref (glibtop_server *server)
|
||||||
|
{
|
||||||
|
server->refcount++;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
glibtop_server_unref (glibtop_server *server)
|
||||||
|
{
|
||||||
|
server->refcount--;
|
||||||
|
|
||||||
|
if (server->refcount <= 0) {
|
||||||
|
g_free (server->_priv);
|
||||||
|
g_free (server->info);
|
||||||
|
g_free (server);
|
||||||
|
}
|
||||||
|
}
|
@@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
#define LIBGTOP_XML_NAMESPACE "http://www.home-of-linux.org/libgtop/1.1"
|
#define LIBGTOP_XML_NAMESPACE "http://www.home-of-linux.org/libgtop/1.1"
|
||||||
|
|
||||||
#include <gnome-xml/parser.h>
|
#include <libxml/parser.h>
|
||||||
|
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
|
|
||||||
@@ -51,6 +51,8 @@ glibtop_init_backends (void)
|
|||||||
backends_initialized = 1;
|
backends_initialized = 1;
|
||||||
|
|
||||||
#if HAVE_LIBXML
|
#if HAVE_LIBXML
|
||||||
|
LIBXML_TEST_VERSION;
|
||||||
|
|
||||||
_glibtop_init_gmodule_backends (LIBGTOP_BACKEND_DIR);
|
_glibtop_init_gmodule_backends (LIBGTOP_BACKEND_DIR);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -60,7 +62,7 @@ glibtop_init_backends (void)
|
|||||||
static gchar *
|
static gchar *
|
||||||
_get_library_filename (xmlDocPtr doc, xmlNodePtr cur, const char *directory)
|
_get_library_filename (xmlDocPtr doc, xmlNodePtr cur, const char *directory)
|
||||||
{
|
{
|
||||||
char *filename = xmlNodeListGetString (doc, cur->childs, 1);
|
char *filename = xmlNodeListGetString (doc, cur->xmlChildrenNode, 1);
|
||||||
gchar *retval;
|
gchar *retval;
|
||||||
|
|
||||||
if (!filename)
|
if (!filename)
|
||||||
@@ -81,10 +83,10 @@ _parse_extra_libs (xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, const char *dir)
|
|||||||
GSList *list = NULL;
|
GSList *list = NULL;
|
||||||
|
|
||||||
/* We don't care what the top level element name is */
|
/* We don't care what the top level element name is */
|
||||||
cur = cur->childs;
|
cur = cur->xmlChildrenNode;
|
||||||
while (cur != NULL) {
|
while (cur != NULL) {
|
||||||
if ((!strcmp (cur->name, "ExtraLib")) && (cur->ns == ns)) {
|
if ((!strcmp (cur->name, "ExtraLib")) && (cur->ns == ns)) {
|
||||||
xmlNodePtr sub = cur->childs;
|
xmlNodePtr sub = cur->xmlChildrenNode;
|
||||||
|
|
||||||
while (sub != NULL) {
|
while (sub != NULL) {
|
||||||
if ((!strcmp (sub->name, "ShlibName")) && (sub->ns == ns))
|
if ((!strcmp (sub->name, "ShlibName")) && (sub->ns == ns))
|
||||||
@@ -112,14 +114,14 @@ _parseBackend (xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, const char *dir)
|
|||||||
ret = g_new0 (glibtop_backend_entry, 1);
|
ret = g_new0 (glibtop_backend_entry, 1);
|
||||||
|
|
||||||
/* We don't care what the top level element name is */
|
/* We don't care what the top level element name is */
|
||||||
cur = cur->childs;
|
cur = cur->xmlChildrenNode;
|
||||||
while (cur != NULL) {
|
while (cur != NULL) {
|
||||||
if ((!strcmp (cur->name, "Name")) && (cur->ns == ns))
|
if ((!strcmp (cur->name, "Name")) && (cur->ns == ns))
|
||||||
ret->name = xmlNodeListGetString
|
ret->name = xmlNodeListGetString
|
||||||
(doc, cur->childs, 1);
|
(doc, cur->xmlChildrenNode, 1);
|
||||||
|
|
||||||
if ((!strcmp (cur->name, "Location")) && (cur->ns == ns)) {
|
if ((!strcmp (cur->name, "Location")) && (cur->ns == ns)) {
|
||||||
xmlNodePtr sub = cur->childs;
|
xmlNodePtr sub = cur->xmlChildrenNode;
|
||||||
|
|
||||||
while (sub != NULL) {
|
while (sub != NULL) {
|
||||||
if ((!strcmp (sub->name, "LibtoolName")) && (sub->ns == ns))
|
if ((!strcmp (sub->name, "LibtoolName")) && (sub->ns == ns))
|
||||||
@@ -198,7 +200,7 @@ _glibtop_init_gmodule_backends (const char *directory)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
cur = cur->childs;
|
cur = cur->xmlChildrenNode;
|
||||||
while (cur != NULL) {
|
while (cur != NULL) {
|
||||||
glibtop_backend_entry *backend;
|
glibtop_backend_entry *backend;
|
||||||
|
|
||||||
|
66
lib/test-backends.c
Normal file
66
lib/test-backends.c
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
|
||||||
|
|
||||||
|
/* $Id$ */
|
||||||
|
|
||||||
|
/* Copyright (C) 1998-99 Martin Baulig
|
||||||
|
This file is part of LibGTop 1.0.
|
||||||
|
|
||||||
|
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||||
|
|
||||||
|
LibGTop is free software; you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License,
|
||||||
|
or (at your option) any later version.
|
||||||
|
|
||||||
|
LibGTop is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with LibGTop; see the file COPYING. If not, write to the
|
||||||
|
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <glibtop.h>
|
||||||
|
#include <glibtop/backend.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
main (int argc, char *argv [])
|
||||||
|
{
|
||||||
|
glibtop_client *client;
|
||||||
|
glibtop_backend *backend_common;
|
||||||
|
glibtop_backend *backend_sysdeps;
|
||||||
|
GError *error = NULL;
|
||||||
|
|
||||||
|
g_type_init ();
|
||||||
|
|
||||||
|
glibtop_init_backends ();
|
||||||
|
|
||||||
|
client = glibtop_client_new ();
|
||||||
|
|
||||||
|
backend_common = glibtop_open_backend_l (client, "glibtop-backend-common",
|
||||||
|
0, NULL, &error);
|
||||||
|
|
||||||
|
g_message (G_STRLOC ": backend = %p (%p)", backend_common, error);
|
||||||
|
|
||||||
|
if (error != NULL) {
|
||||||
|
glibtop_client_propagate_error (client, error);
|
||||||
|
g_error_free (error);
|
||||||
|
error = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
backend_sysdeps = glibtop_open_backend_l (client, "glibtop-backend-sysdeps",
|
||||||
|
0, NULL, &error);
|
||||||
|
|
||||||
|
g_message (G_STRLOC ": backend = %p (%p)", backend_sysdeps, error);
|
||||||
|
|
||||||
|
if (error != NULL) {
|
||||||
|
glibtop_client_propagate_error (client, error);
|
||||||
|
g_error_free (error);
|
||||||
|
error = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
exit (0);
|
||||||
|
}
|
Reference in New Issue
Block a user