Changeset 140

Show
Ignore:
Timestamp:
03/07/06 23:53:06
Author:
pvanhoof
Message:

Added initial python bindings by kikidonk

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/ChangeLog

    r1 r140  
     103-07-2006  Raphael Slinckx  <raphael@slinckx.net> 
     2 
     3        * Added initial Python bindings 
     4         
    1501-17-2006  Philip Van Hoof  <pvanhoof@gnome.org> 
    26         
  • trunk/Makefile.am

    r130 r140  
    1 SUBDIRS = libtinymail libtinymail-camel libtinymailui libtinymail-gnomevfs libtinymailui-gtk tinymail libtinymail-test docs 
     1SUBDIRS = libtinymail libtinymail-camel libtinymailui libtinymail-gnomevfs libtinymailui-gtk tinymail tinymail-python docs 
  • trunk/configure.ac

    r130 r140  
    22AC_CONFIG_SRCDIR(tinymail/tny-main.c) 
    33AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION) 
     4AC_CONFIG_MACRO_DIR([m4]) 
     5AC_SUBST(ACLOCAL_AMFLAGS, "$ACLOCAL_FLAGS -I m4") 
    46 
    57AM_CONFIG_HEADER(tinymail/config.h) 
    6 AM_CONFIG_HEADER(libtinymail-test/config.h) 
    78AM_CONFIG_HEADER(libtinymail/config.h) 
    89AM_CONFIG_HEADER(libtinymail-camel/config.h) 
     
    4344AC_SUBST(LIBTINYMAIL_GNOMEVFS_LIBS) 
    4445 
    45 PKG_CHECK_MODULES(LIBTINYMAIL_TEST, gunit gtk+-2.0 glib-2.0 >= 2.8 gobject-2.0 camel-1.2 camel-provider-1.2 gnome-vfs-2.0) 
    46 AC_SUBST(LIBTINYMAIL_TEST_CFLAGS) 
    47 AC_SUBST(LIBTINYMAIL_TEST_LIBS) 
    48  
    4946dnl gnomeui-2 is for gnome_icon_lookup :-\ 
    5047PKG_CHECK_MODULES(LIBTINYMAILUI_GTK, glib-2.0 >= 2.8 gobject-2.0 libgnomeui-2.0 gtk+-2.0) 
     
    5754AC_SUBST(TINYMAIL_LIBS) 
    5855 
     56AM_PATH_PYTHON(2.3) 
     57AM_CHECK_PYTHON_HEADERS(,[AC_MSG_ERROR(could not find Python headers)]) 
     58AC_PATH_PROG(PYGTK_CODEGEN, pygtk-codegen-2.0, no) 
     59if test "x$PYGTK_CODEGEN" = xno; then 
     60        AC_MSG_ERROR(could not find pygtk-codegen-2.0 script) 
     61fi 
     62AC_MSG_CHECKING(for pygtk defs) 
     63PYGTK_DEFSDIR=`$PKG_CONFIG --variable=defsdir pygtk-2.0` 
     64AC_SUBST(PYGTK_DEFSDIR) 
     65AC_MSG_RESULT($PYGTK_DEFSDIR) 
     66 
     67PKG_CHECK_MODULES(TINYMAIL_PYTHON, pygobject-2.0 pygtk-2.0 gnome-vfs-2.0) 
     68AC_SUBST(TINYMAIL_PYTHON_CFLAGS) 
     69AC_SUBST(TINYMAIL_PYTHON_LIBS) 
     70                                                 
    5971 
    6072BINDIR=$prefix/bin 
     
    7789libtinymail-gnomevfs/libtinymail-gnomevfs.pc 
    7890tinymail/Makefile 
    79 libtinymail-test/Makefile 
     91tinymail-python/Makefile 
    8092]) 
    8193 
  • trunk/libtinymail-test/Makefile.am

    r139 r140  
    99 
    1010lib_LTLIBRARIES = libtinymail-test-suite.la 
     11 
     12bin_PROGRAMS = tny-simple-test-runner 
    1113 
    1214libtinymail_test_suite_la_SOURCES =                                             \ 
     
    2224libtinymail_test_suite_la_LDFLAGS = $(LIBTINYMAIL_TEST_LIBS) 
    2325 
     26tny_simple_test_runner_SOURCES = tny-simple-test-runner.c 
     27 
     28 
    2429libtinymail_test_suite_la_LIBADD =                                              \ 
    2530        $(top_builddir)/libtinymail/libtinymail-$(API_VERSION).la               \ 
     
    2833        $(top_builddir)/libtinymail-camel/libtinymail-camel-$(API_VERSION).la 
    2934 
     35tny_simple_test_runner_LDADD =                                                  \ 
     36        $(LIBTINYMAIL_TEST_LIBS)                                                \ 
     37        $(top_builddir)/libtinymail/libtinymail-$(API_VERSION).la               \ 
     38        $(top_builddir)/libtinymailui/libtinymailui-$(API_VERSION).la           \ 
     39        $(top_builddir)/libtinymailui-gtk/libtinymailui-gtk-$(API_VERSION).la   \ 
     40        $(top_builddir)/libtinymail-camel/libtinymail-camel-$(API_VERSION).la   \ 
     41        libtinymail-test-suite.la 
     42 
  • trunk/libtinymail-test/tny-stream-iface-test.c

    r139 r140  
    2323/* We are going to test the camel implementation */ 
    2424#include <tny-stream-camel.h> 
     25#include <camel/camel-stream-mem.h> 
     26#include <camel/camel-data-wrapper.h> 
    2527 
    26 static TnyStreamIface *iface = NULL
     28static TnyStreamIface *iface = NULL, *source = NULL
    2729 
    2830static void 
    2931tny_stream_iface_test_setup (void) 
    3032{ 
    31         //iface = TNY_STREAM_IFACE (tny_stream_camel_new ()); 
     33        CamelStream *stream = camel_stream_mem_new (); 
     34 
     35        iface = TNY_STREAM_IFACE (tny_stream_camel_new (stream)); 
     36        source = TNY_STREAM_IFACE (tny_test_stream_new ()); 
    3237 
    3338        return; 
     
    3843{ 
    3944        g_object_unref (G_OBJECT (iface)); 
     45        g_object_unref (G_OBJECT (source)); 
    4046 
    4147        return; 
     
    4349 
    4450static void 
    45 tny_stream_iface_test_write (void) 
     51tny_stream_iface_test_stream (void) 
    4652{ 
     53        gchar *buffer = (gchar*) malloc (sizeof (gchar) * 42); 
    4754 
    48         //gunit_fail_unless(!strcmp (str_in, str_out), "Unable to set subject!\n"); 
     55        tny_stream_iface_write_to_stream (source, iface); 
     56 
     57        tny_stream_iface_read (iface, buffer, 42); 
     58 
     59        gunit_fail (buffer); 
    4960} 
    5061 
     
    6172        /* Add test case objects to test suite */ 
    6273        gunit_test_suite_add_test_case(suite, 
    63                gunit_test_case_new_with_funcs("tny_stream_iface_test_write", 
     74               gunit_test_case_new_with_funcs("tny_stream_iface_test_stream", 
    6475                                      tny_stream_iface_test_setup, 
    65                                       tny_stream_iface_test_write
     76                                      tny_stream_iface_test_stream
    6677                                      tny_stream_iface_test_teardown)); 
    6778 
  • trunk/libtinymail-test/tny-test-stream.c

    r139 r140  
    5959tny_test_stream_read  (TnyStreamIface *self, char *buffer, size_t n) 
    6060{ 
    61         int i = 0, t = n/2
     61        int i = 0
    6262 
    63         for (i = 0; i < t; i++) 
     63        for (i = 0; i < n; i++) 
    6464        { 
    65                 //if (i % 2 == 1) 
    66                          
     65                if (i % 2 == 1) 
     66                        buffer [i] = '2'; 
     67                else 
     68                        buffer [i] = '4';                
    6769        } 
     70 
    6871 
    6972        return 0; 
     
    7376tny_test_stream_write (TnyStreamIface *self, const char *buffer, size_t n) 
    7477{ 
    75          
    76  
    77         return -1; 
    78  
     78        return 0; 
    7979} 
    8080 
     
    8383{ 
    8484        return 0; 
     85} 
     86 
     87static gboolean 
     88tny_test_stream_eos (TnyStreamIface *self) 
     89{ 
     90        static gint count = 0; 
     91 
     92        count++; 
     93 
     94        return (count < 42); 
    8595} 
    8696 
     
    125135        klass->close_func = tny_test_stream_close; 
    126136        klass->write_to_stream_func = tny_test_stream_write_to_stream; 
     137        klass->eos_func = tny_test_stream_eos; 
    127138 
    128139        return; 
     
    143154 
    144155GType  
    145 tny_vfs_stream_get_type (void) 
     156tny_test_stream_get_type (void) 
    146157{ 
    147158        static GType type = 0; 
  • trunk/libtinymail-test/tny-test-stream.h

    r139 r140  
    2626 
    2727#include <tny-test-stream.h> 
     28 
     29#include "tny-test-suite.h" 
     30 
    2831 
    2932G_BEGIN_DECLS 
  • trunk/libtinymail-test/tny-test-suite.c

    r137 r140  
    2323 
    2424#include "tny-test-suite.h" 
     25 
    2526#include "tny-msg-header-iface-test.h" 
     27#include "tny-stream-iface-test.h" 
    2628 
    2729GList* 
     
    3133 
    3234        suites = g_list_append (suites, create_tny_msg_header_iface_suite ()); 
     35        suites = g_list_append (suites, create_tny_stream_iface_suite ()); 
    3336 
    3437        return suites; 
  • trunk/libtinymail-test/tny-test-suite.h

    r128 r140  
    2525#include <gunit.h> 
    2626 
     27GList* gunit_get_test_suites(); 
    2728 
    2829#endif