GNOME Clipboard Manager - Documentation
Creating applications with libgcm
Index
Step1: Creating the configure.in and Makefile.am for your application
configure.in
AC_INIT(configure.in)
AM_INIT_AUTOMAKE(yourapp, 0.1)
AM_CONFIG_HEADER(config.h)
AM_MAINTAINER_MODE
AC_ISC_POSIX
AC_PROG_CC
AM_PROG_CC_STDC
AC_HEADER_STDC
GTK_REQUIRED=1.3.1
LIBGNOMEUI_REQUIRED=1.96.0
GCONF_REQUIRED=1.0.8
LIBXML_REQUIRED=2.0
LIBPANEL_REQUIRED=1.4.0
LIBGTKHTML_REQUIRED=2.0
PKG_CHECK_MODULES(PACKAGE,
gtk+-2.0 >= $GTK_REQUIRED
libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED
gconf-2.0 >= $GCONF_REQUIRED
libxml-2.0 >= $LIBXML_REQUIRED
libgtkhtml-2.0 >= $LIBGTKHTML_REQUIRED
libgcm)
dnl The last one is important ! if you did a make
dnl install then the pkg-config file /usr/lib/pkgconfig/libgcm.pc
dnl should exist ! This file is required else it will not
dnl work.
AC_SUBST(PACKAGE_CFLAGS)
AC_SUBST(PACKAGE_LIBS)
dnl other stuff
AC_OUTPUT([
Makefile
src/Makefile
po/Makefile.in
dnl etc
dnl etc
])
Makefile.am
SUBDIRS = src # po ...
# Other stuff
src/Makefile.am
INCLUDES = \
-DPACKAGE_DATA_DIR=\""$(datadir)"\" \
-DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
@PACKAGE_CFLAGS@
bin_PROGRAMS = yourapp
# This example uses glade but it is possible that you have
# more or less files in your SOURCES.
yourapp_SOURCES = \
main.c \
support.c support.h \
interface.c interface.h \
callbacks.c callbacks.h
yourapp_LDADD = @PACKAGE_LIBS@
Step2: Make your application
hello.c
#include <gnome.h>
#include <libgcm.h>
int main() {
g_print("Hello World\n");
return 0;
}
You can use the following functions, which are explained in libgcm.h, in your libgcm application :
/* Remote functions */
gboolean gcm_remote_is_running (gint session);
gint gcm_remote_get_version (gint session);
gint gcm_remote_get_rowcnt (gint session);
gchar *gcm_remote_get_rowpreview (gint session, gint row);
gchar *gcm_remote_get_rowfrom (gint session, gint row);
gchar *gcm_remote_get_rowdate (gint session, gint row);
void gcm_remote_mainwin_hide (gint session);
void gcm_remote_mainwin_show (gint session);
void gcm_remote_prefswin_show (gint session);
void gcm_remote_newitemwin_show (gint session);
void gcm_remote_aboutwin_show (gint session);
void gcm_remote_select_row (gint session, gint row);
void gcm_remote_edit_item(gint session, gint row);
void gcm_remote_exit_gcm(gint session, gint code);
void gcm_remote_save_all (gint session);
void gcm_remote_save (gint session);
void gcm_remote_merge_selected (gint session);
void gcm_remote_delete_selected (gint session);
void gcm_remote_get_new (gint sesssion);
void gcm_remote_select_all (gint session);
void gcm_remote_select_none (gint session);
void gcm_remote_clear (gint session);
void gcm_remote_add_textitem (gint session, gchar *text);
/* General library functions */
gboolean gcm_check_and_start_gcm (gint session);
gchar * gcm_decodeblock (gchar *s, gint *size, gint *exp);
gchar * gcm_uudecode(gchar *s, gint *size);
gchar * gcm_encodeblock (gchar *s, gint from, gint len);
GString * gcm_uuencode (gchar *s, gint length);
gint gcm_target_to_enum (GdkAtom target);