Commit b5b294aa authored by Xavier Claessens's avatar Xavier Claessens Committed by Xavier Claessens

Add python binding. Fixes bug #457660 (Michael Sheldon).

2007-08-19 Xavier Claessens  <xclaesse@gmail.com>

	* python/pyempathy/pyempathy.defs:
	* python/pyempathy/pyempathymodule.c:
	* python/pyempathy/Makefile.am:
	* python/pyempathy/pyempathy.override:
	* python/pyempathygtk/pyempathygtk.override:
	* python/pyempathygtk/pyempathygtk.defs:
	* python/pyempathygtk/Makefile.am:
	* python/pyempathygtk/pyempathygtkmodule.c:
	* python/Makefile.am:
	* libempathy/empathy-time.h:
	* configure.ac:
	* Makefile.am: Add python binding. Fixes bug #457660 (Michael Sheldon).


svn path=/trunk/; revision=264
parent 6a23f8ca
2007-08-19 Xavier Claessens <xclaesse@gmail.com>
* python/pyempathy/pyempathy.defs:
* python/pyempathy/pyempathymodule.c:
* python/pyempathy/Makefile.am:
* python/pyempathy/pyempathy.override:
* python/pyempathygtk/pyempathygtk.override:
* python/pyempathygtk/pyempathygtk.defs:
* python/pyempathygtk/Makefile.am:
* python/pyempathygtk/pyempathygtkmodule.c:
* python/Makefile.am:
* libempathy/empathy-time.h:
* configure.ac:
* Makefile.am: Add python binding. Fixes bug #457660 (Michael Sheldon).
2007-08-19 Xavier Claessens <xclaesse@gmail.com>
* libempathy-gtk/empathy-main-window.glade: Edit menu should be second
......
SUBDIRS = po data libempathy libempathy-gtk src doc
if HAVE_PYTHON
SUBDIRS += python
endif
DISTCHECK_CONFIGURE_FLAGS = \
--disable-scrollkeeper \
--enable-gtk-doc
......
......@@ -145,7 +145,46 @@ if test "x$enable_aspell" = "xyes" -a "x$have_aspell" != "xyes"; then
AC_MSG_ERROR([Couldn't find aspell.])
fi
dnl -----------------------------------------------------------
dnl Python Bindings
dnl -----------------------------------------------------------
AC_ARG_ENABLE(python,
AS_HELP_STRING([--enable-python=@<:@no/yes/auto@:>@],
[build python bindings to libempathy and libempathy-gtk]), ,
enable_python=auto)
PKG_CHECK_MODULES(PYTHON_BINDING,
[
pygtk-2.0,
glib-2.0 >= $GLIB_REQUIRED
gobject-2.0
gconf-2.0 >= $GCONF_REQUIRED
libxml-2.0
gnome-vfs-2.0
libtelepathy >= $TELEPATHY_REQUIRED
libmissioncontrol >= $MISSION_CONTROL_REQUIRED
gtk+-2.0 >= $GTK_REQUIRED
libglade-2.0 >= $LIBGLADE_REQUIRED
libgnomeui-2.0
], have_python="yes", have_python="no")
if test "x$have_python" = "xno"; then
if test "x$enable_python" = "xyes"; then
AC_MSG_ERROR([Could not find python dependencies])
fi
enable_python="no (missing dependencies)"
else
if test "x$enable_python" != "xno"; then
enable_python="yes"
else
enable_python="no (disabled)"
fi
fi
AM_CONDITIONAL(HAVE_PYTHON, test x$enable_python = xyes)
dnl -----------------------------------------------------------
AC_OUTPUT([
Makefile
data/Makefile
......@@ -164,5 +203,7 @@ AC_OUTPUT([
doc/Makefile
doc/libempathy/Makefile
doc/libempathy-gtk/Makefile
python/Makefile
python/pyempathy/Makefile
python/pyempathygtk/Makefile
])
......@@ -21,7 +21,9 @@
#ifndef __EMPATHY_TIME_H__
#define __EMPATHY_TIME_H__
#ifndef __USE_XOPEN
#define __USE_XOPEN
#endif
#include <time.h>
#include <glib.h>
......
SUBDIRS = pyempathy pyempathygtk
PYDEFS=`pkg-config --variable=defsdir pygtk-2.0`
AM_CPPFLAGS = \
-I. \
-I$(top_srcdir)/libempathy \
-I$(top_srcdir) \
-DDATADIR=\""$(datadir)"\" \
$(PYTHON_BINDING_CFLAGS) \
`python-config --cflags` \
$(WARN_CFLAGS)
BUILT_SOURCES = \
pyempathy.c
pyempathydir = $(prefix)/lib/`pyversions -d`/site-packages
pyempathy_LTLIBRARIES = empathy.la
empathy_la_SOURCES = \
pyempathymodule.c \
pyempathy.c
empathy_la_LIBADD = \
$(PYTHON_BINDING_LIBS) \
$(top_builddir)/libempathy/libempathy.la
empathy_la_LDFLAGS = \
`python-config --libs` \
-module -avoid-version
pyempathy.c: pyempathy.override pyempathy.defs
pygtk-codegen-2.0 --prefix empathy \
--register $(PYDEFS)/gdk-types.defs \
--register $(PYDEFS)/gtk-types.defs \
--override pyempathy.override \
pyempathy.defs > $@
CLEANFILES = $(BUILT_SOURCES)
;; -*- scheme -*-
; interfaces
(define-interface ContactList
(in-module "Empathy")
(c-name "EmpathyContactList")
(gtype-id "EMPATHY_TYPE_CONTACT_LIST")
)
; object definitions ...
(define-object Chandler
(in-module "Empathy")
(parent "GObject")
(c-name "EmpathyChandler")
(gtype-id "EMPATHY_TYPE_CHANDLER")
)
(define-object Chatroom
(in-module "Empathy")
(parent "GObject")
(c-name "EmpathyChatroom")
(gtype-id "EMPATHY_TYPE_CHATROOM")
)
(define-object ChatroomManager
(in-module "Empathy")
(parent "GObject")
(c-name "EmpathyChatroomManager")
(gtype-id "EMPATHY_TYPE_CHATROOM_MANAGER")
)
(define-object Conf
(in-module "Empathy")
(parent "GObject")
(c-name "EmpathyConf")
(gtype-id "EMPATHY_TYPE_CONF")
)
(define-object Contact
(in-module "Empathy")
(parent "GObject")
(c-name "EmpathyContact")
(gtype-id "EMPATHY_TYPE_CONTACT")
)
(define-object ContactManager
(in-module "Empathy")
(parent "GObject")
(c-name "EmpathyContactManager")
(gtype-id "EMPATHY_TYPE_CONTACT_MANAGER")
(implements "EmpathyContactList")
)
(define-object Filter
(in-module "Empathy")
(parent "GObject")
(c-name "EmpathyFilter")
(gtype-id "EMPATHY_TYPE_FILTER")
)
(define-object Idle
(in-module "Empathy")
(parent "GObject")
(c-name "EmpathyIdle")
(gtype-id "EMPATHY_TYPE_IDLE")
)
(define-object LogManager
(in-module "Empathy")
(parent "GObject")
(c-name "EmpathyLogManager")
(gtype-id "EMPATHY_TYPE_LOG_MANAGER")
)
(define-object Message
(in-module "Empathy")
(parent "GObject")
(c-name "EmpathyMessage")
(gtype-id "EMPATHY_TYPE_MESSAGE")
)
(define-object Presence
(in-module "Empathy")
(parent "GObject")
(c-name "EmpathyPresence")
(gtype-id "EMPATHY_TYPE_PRESENCE")
)
(define-object TpChat
(in-module "Empathy")
(parent "GObject")
(c-name "EmpathyTpChat")
(gtype-id "EMPATHY_TYPE_TP_CHAT")
)
(define-object TpChatroom
(in-module "Empathy")
(parent "EmpathyTpChat")
(c-name "EmpathyTpChatroom")
(gtype-id "EMPATHY_TYPE_TP_CHATROOM")
(implements "EmpathyContactList")
)
(define-object TpContactList
(in-module "Empathy")
(parent "GObject")
(c-name "EmpathyTpContactList")
(gtype-id "EMPATHY_TYPE_TP_CONTACT_LIST")
(implements "EmpathyContactList")
)
(define-object TpGroup
(in-module "Empathy")
(parent "GObject")
(c-name "EmpathyTpGroup")
(gtype-id "EMPATHY_TYPE_TP_GROUP")
)
;; Enumerations and flags ...
(define-flags Subscription
(in-module "Empathy")
(c-name "EmpathySubscription")
(gtype-id "EMPATHY_TYPE_SUBSCRIPTION")
(values
'("none" "EMPATHY_SUBSCRIPTION_NONE")
'("to" "EMPATHY_SUBSCRIPTION_TO")
'("from" "EMPATHY_SUBSCRIPTION_FROM")
'("both" "EMPATHY_SUBSCRIPTION_BOTH")
)
)
(define-enum MessageType
(in-module "Empathy")
(c-name "EmpathyMessageType")
(gtype-id "EMPATHY_TYPE_MESSAGE_TYPE")
(values
'("normal" "EMPATHY_MESSAGE_TYPE_NORMAL")
'("action" "EMPATHY_MESSAGE_TYPE_ACTION")
'("notice" "EMPATHY_MESSAGE_TYPE_NOTICE")
'("auto-reply" "EMPATHY_MESSAGE_TYPE_AUTO_REPLY")
'("last" "EMPATHY_MESSAGE_TYPE_LAST")
)
)
(define-enum RegExType
(in-module "Empathy")
(c-name "EmpathyRegExType")
(gtype-id "EMPATHY_TYPE_REG_EX_TYPE")
(values
'("as-is" "EMPATHY_REGEX_AS_IS")
'("browser" "EMPATHY_REGEX_BROWSER")
'("email" "EMPATHY_REGEX_EMAIL")
'("other" "EMPATHY_REGEX_OTHER")
'("all" "EMPATHY_REGEX_ALL")
)
)
;; From empathy-avatar.h
(define-function empathy_avatar_get_gtype
(c-name "empathy_avatar_get_gtype")
(return-type "GType")
)
(define-function empathy_avatar_new
(c-name "empathy_avatar_new")
(is-constructor-of "EmpathyAvatar")
(return-type "EmpathyAvatar*")
(parameters
'("guchar*" "avatar")
'("gsize" "len")
'("gchar*" "format")
)
)
(define-method ref
(of-object "EmpathyAvatar")
(c-name "empathy_avatar_ref")
(return-type "EmpathyAvatar*")
)
(define-method unref
(of-object "EmpathyAvatar")
(c-name "empathy_avatar_unref")
(return-type "none")
)
;; From empathy-chandler-glue.h
(define-function dbus_glib_marshal_empathy_chandler_BOOLEAN__STRING_BOXED_STRING_BOXED_UINT_UINT_POINTER
(c-name "dbus_glib_marshal_empathy_chandler_BOOLEAN__STRING_BOXED_STRING_BOXED_UINT_UINT_POINTER")
(return-type "none")
(parameters
'("GClosure*" "closure")
'("GValue*" "return_value")
'("guint" "n_param_values")
'("const-GValue*" "param_values")
'("gpointer" "invocation_hint")
'("gpointer" "marshal_data")
)
)
;; From empathy-chandler.h
(define-function empathy_chandler_get_type
(c-name "empathy_chandler_get_type")
(return-type "GType")
)
(define-function empathy_chandler_new
(c-name "empathy_chandler_new")
(is-constructor-of "EmpathyChandler")
(return-type "EmpathyChandler*")
(parameters
'("const-gchar*" "bus_name")
'("const-gchar*" "object_path")
)
)
;; From empathy-chatroom-manager.h
(define-function empathy_chatroom_manager_get_type
(c-name "empathy_chatroom_manager_get_type")
(return-type "GType")
)
(define-function empathy_chatroom_manager_new
(c-name "empathy_chatroom_manager_new")
(is-constructor-of "EmpathyChatroomManager")
(return-type "EmpathyChatroomManager*")
)
(define-method add
(of-object "EmpathyChatroomManager")
(c-name "empathy_chatroom_manager_add")
(return-type "gboolean")
(parameters
'("EmpathyChatroom*" "chatroom")
)
)
(define-method remove
(of-object "EmpathyChatroomManager")
(c-name "empathy_chatroom_manager_remove")
(return-type "none")
(parameters
'("EmpathyChatroom*" "chatroom")
)
)
(define-method find
(of-object "EmpathyChatroomManager")
(c-name "empathy_chatroom_manager_find")
(return-type "EmpathyChatroom*")
(parameters
'("McAccount*" "account")
'("const-gchar*" "room")
)
)
(define-method get_chatrooms
(of-object "EmpathyChatroomManager")
(c-name "empathy_chatroom_manager_get_chatrooms")
(return-type "GList*")
(parameters
'("McAccount*" "account")
)
)
(define-method get_count
(of-object "EmpathyChatroomManager")
(c-name "empathy_chatroom_manager_get_count")
(return-type "guint")
(parameters
'("McAccount*" "account")
)
)
(define-method store
(of-object "EmpathyChatroomManager")
(c-name "empathy_chatroom_manager_store")
(return-type "none")
)
;; From empathy-chatroom.h
(define-function empathy_chatroom_get_type
(c-name "empathy_chatroom_get_type")
(return-type "GType")
)
(define-function empathy_chatroom_new
(c-name "empathy_chatroom_new")
(is-constructor-of "EmpathyChatroom")
(return-type "EmpathyChatroom*")
(parameters
'("McAccount*" "account")
'("const-gchar*" "room")
)
)
(define-function empathy_chatroom_new_full
(c-name "empathy_chatroom_new_full")
(return-type "EmpathyChatroom*")
(parameters
'("McAccount*" "account")
'("const-gchar*" "room")
'("const-gchar*" "name")
'("gboolean" "auto_connect")
)
)
(define-method get_account
(of-object "EmpathyChatroom")
(c-name "empathy_chatroom_get_account")
(return-type "McAccount*")
)
(define-method set_account
(of-object "EmpathyChatroom")
(c-name "empathy_chatroom_set_account")
(return-type "none")
(parameters
'("McAccount*" "account")
)
)
(define-method get_room
(of-object "EmpathyChatroom")
(c-name "empathy_chatroom_get_room")
(return-type "const-gchar*")
)
(define-method set_room
(of-object "EmpathyChatroom")
(c-name "empathy_chatroom_set_room")
(return-type "none")
(parameters
'("const-gchar*" "room")
)
)
(define-method get_name
(of-object "EmpathyChatroom")
(c-name "empathy_chatroom_get_name")
(return-type "const-gchar*")
)
(define-method set_name
(of-object "EmpathyChatroom")
(c-name "empathy_chatroom_set_name")
(return-type "none")
(parameters
'("const-gchar*" "name")
)
)
(define-method get_auto_connect
(of-object "EmpathyChatroom")
(c-name "empathy_chatroom_get_auto_connect")
(return-type "gboolean")
)
(define-method set_auto_connect
(of-object "EmpathyChatroom")
(c-name "empathy_chatroom_set_auto_connect")
(return-type "none")
(parameters
'("gboolean" "auto_connect")
)
)
(define-function empathy_chatroom_equal
(c-name "empathy_chatroom_equal")
(return-type "gboolean")
(parameters
'("gconstpointer" "v1")
'("gconstpointer" "v2")
)
)
;; From empathy-conf.h
(define-function empathy_conf_get_type
(c-name "empathy_conf_get_type")
(return-type "GType")
)
(define-function empathy_conf_get
(c-name "empathy_conf_get")
(return-type "EmpathyConf*")
)
(define-function empathy_conf_shutdown
(c-name "empathy_conf_shutdown")
(return-type "none")
)
(define-method notify_add
(of-object "EmpathyConf")
(c-name "empathy_conf_notify_add")
(return-type "guint")
(parameters
'("const-gchar*" "key")
'("EmpathyConfNotifyFunc" "func")
'("gpointer" "data")
)
)
(define-method notify_remove
(of-object "EmpathyConf")
(c-name "empathy_conf_notify_remove")
(return-type "gboolean")
(parameters
'("guint" "id")
)
)
(define-method set_int
(of-object "EmpathyConf")
(c-name "empathy_conf_set_int")
(return-type "gboolean")
(parameters
'("const-gchar*" "key")
'("gint" "value")
)
)
(define-method get_int
(of-object "EmpathyConf")
(c-name "empathy_conf_get_int")
(return-type "gboolean")
(parameters
'("const-gchar*" "key")
'("gint*" "value")
)
)
(define-method set_bool
(of-object "EmpathyConf")
(c-name "empathy_conf_set_bool")
(return-type "gboolean")
(parameters
'("const-gchar*" "key")
'("gboolean" "value")
)
)
(define-method get_bool
(of-object "EmpathyConf")
(c-name "empathy_conf_get_bool")
(return-type "gboolean")
(parameters
'("const-gchar*" "key")
'("gboolean*" "value")
)
)
(define-method set_string
(of-object "EmpathyConf")
(c-name "empathy_conf_set_string")
(return-type "gboolean")
(parameters
'("const-gchar*" "key")
'("const-gchar*" "value")
)
)
(define-method get_string
(of-object "EmpathyConf")
(c-name "empathy_conf_get_string")
(return-type "gboolean")
(parameters
'("const-gchar*" "key")
'("gchar**" "value")
)
)
(define-method set_string_list
(of-object "EmpathyConf")
(c-name "empathy_conf_set_string_list")
(return-type "gboolean")
(parameters
'("const-gchar*" "key")
'("GSList*" "value")
)
)
(define-method get_string_list
(of-object "EmpathyConf")
(c-name "empathy_conf_get_string_list")
(return-type "gboolean")
(parameters
'("const-gchar*" "key")
'("GSList**" "value")
)
)
;; From empathy-contact-list.h
(define-function contact_list_get_type
(c-name "empathy_contact_list_get_type")
(return-type "GType")
)
(define-method list_info_new
(of-object "EmpathyContact")
(c-name "empathy_contact_list_info_new")
(return-type "EmpathyContactListInfo*")
(parameters
'("const-gchar*" "message")
)
)
(define-method free
(of-object "EmpathyContactListInfo")
(c-name "empathy_contact_list_info_free")
(return-type "none")
)
(define-method setup
(of-object "EmpathyContactList")
(c-name "empathy_contact_list_setup")
(return-type "none")
)
(define-method find
(of-object "EmpathyContactList")
(c-name "empathy_contact_list_find")
(return-type "EmpathyContact*")
(parameters
'("const-gchar*" "id")
)
)
(define-method add
(of-object "EmpathyContactList")
(c-name "empathy_contact_list_add")
(return-type "none")
(parameters
'("EmpathyContact*" "contact")
'("const-gchar*" "message")
)
)
(define-method remove
(of-object "EmpathyContactList")
(c-name "empathy_contact_list_remove")
(return-type "none")
(parameters
'("EmpathyContact*" "contact")
'("const-gchar*" "message")
)
)
(define-method get_members
(of-object "EmpathyContactList")
(c-name "empathy_contact_list_get_members")
(return-type "GList*")
)
(define-method get_local_pending
(of-object "EmpathyContactList")
(c-name "empathy_contact_list_get_local_pending")
(return-type "GList*")
)
(define-method process_pending
(of-object "EmpathyContactList")
(c-name "empathy_contact_list_process_pending")
(return-type "none")
(parameters
'("EmpathyContact*" "contact")
'("gboolean" "accept")
)
)
(define-virtual setup
(of-object "EmpathyContactList")
(return-type "none")
)
(define-virtual find
(of-object "EmpathyContactList")
(return-type "EmpathyContact*")
(parameters
'("const-gchar*" "id")
)
)
(define-virtual add
(of-object "EmpathyContactList")
(return-type "none")
(parameters
'("EmpathyContact*" "contact")
'("const-gchar*" "message")
)
)