Changeset 401

Show
Ignore:
Timestamp:
09/17/07 16:03:14 (1 year ago)
Author:
bjourne
Message:

Add the three GDK_PIXBUF_DRAW_* constants to the module. Since they
have a different prefix (GDK_PIXBUF_ instead of GTK_IMAGE_), new
glib-mkenum rules had to be added for that prefix which complicates
lots of things. Then pyg_enum_add() has to be manually called for the
same reason -- it can't handle two different prefixes.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • pygtkimageview/src/Makefile.am

    r399 r401  
    1010_gtkimageview_la_LDFLAGS = -module -avoid-version \ 
    1111        --export-symbols-regex init_gtkimageview 
    12 _gtkimageview_la_SOURCES = gtkimageview.c gtkimageviewmodule.c enums-public.c  
    13 _gtkimageview_la_INCLUDES = enums-public.h enums-private.h 
     12_gtkimageview_la_SOURCES =      \ 
     13        gtkimageview.c          \ 
     14        gtkimageviewmodule.c    \ 
     15        enums-public-gdk.c      \ 
     16        enums-public-gtk.c 
    1417_gtkimageview_la_LIBADD = $(GTKIMAGEVIEW_LIBS) $(PYTHON_LIBS) 
    1518 
    16 CLEANFILES = gtkimageview.c enums-public.h enums-public.c 
     19CLEANFILES =                    \ 
     20        gtkimageview.c          \ 
     21        enums-public-gdk.h      \ 
     22        enums-public-gdk.c      \ 
     23        enums-public-gtk.h      \ 
     24        enums-public-gtk.c 
     25 
    1726EXTRA_DIST =                    \ 
    1827        gtkimageview.defs       \ 
    1928        gtkimageview.override   \ 
    20         enums-public.c          \ 
    21         enums-public.h 
     29        enums-public-gtk.c      \ 
     30        enums-public-gtk.h      \ 
     31        enums-public-gdk.c      \ 
     32        enums-public-gdk.h 
    2233 
    23 # Rule for creating all public enum objects. 
    24 enums-public.h:  
     34# Rules for creating all public enum objects. Two for the enums with 
     35# the GTK prefix and then two for the ones with the GDK prefix. 
     36enums-public-gtk.h:  
    2537        $(GLIB_MKENUMS) \ 
    2638        --fhead "#ifndef __PUB_ENUMS_H__\n#define __PUB_ENUMS_H__\nG_BEGIN_DECLS" \ 
     
    3042        `$(PKG_CONFIG) --variable=includedir gtkimageview`/gtkimageview/gtk*.h > $@ 
    3143 
    32 enums-public.c: 
     44enums-public-gtk.c: 
    3345        $(GLIB_MKENUMS) \ 
    3446        --fhead "#include <gtkimageview/gtkimageview.h>\n#include <gtkimageview/gtkimagetoolselector.h>\nG_BEGIN_DECLS\n" \ 
     
    3951        `$(PKG_CONFIG) --variable=includedir gtkimageview`/gtkimageview/gtk*.h > $@ 
    4052 
    41 gtkimageview.c: gtkimageview.defs gtkimageview.override enums-public.h 
     53enums-public-gdk.h: 
     54        $(GLIB_MKENUMS) \ 
     55        --fhead "#ifndef __PUB_ENUMS_GDK_H__\n#define __PUB_ENUMS_GDK_H__\nG_BEGIN_DECLS" \ 
     56        --fprod "/* enumerations from \"@filename@\" */" \ 
     57        --vhead "GType @enum_name@_get_type (void) G_GNUC_CONST;\n#define GDK_TYPE_@ENUMSHORT@ (@enum_name@_get_type())\n" \ 
     58        --ftail "G_END_DECLS\n\n#endif" \ 
     59        `$(PKG_CONFIG) --variable=includedir gtkimageview`/gtkimageview/gdk*.h > $@ 
     60 
     61enums-public-gdk.c: 
     62        $(GLIB_MKENUMS) \ 
     63        --fhead "#include <gtkimageview/gtkimageview.h>\n#include <gtkimageview/gtkimagetoolselector.h>\nG_BEGIN_DECLS\n" \ 
     64        --fprod "/* enumerations from \"@filename@\" */" \ 
     65        --vhead "GType\n@enum_name@_get_type (void)\n{\n  static GType etype = 0;\n  if (etype == 0) {\n    static const G@Type@Value values[] = {" \ 
     66        --vprod "      { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \ 
     67        --vtail "      { 0, NULL, NULL }\n    };\n    etype = g_@type@_register_static (g_intern_static_string (\"@EnumName@\"), values);\n  }\n  return etype;\n}\n" \ 
     68        `$(PKG_CONFIG) --variable=includedir gtkimageview`/gtkimageview/gdk*.h > $@ 
     69 
     70gtkimageview.c:             \ 
     71        gtkimageview.defs   \ 
     72        gtkimageview.override   \ 
     73        enums-public-gdk.h  \ 
     74        enums-public-gtk.h   
    4275 
    4376.defs.c: 
  • pygtkimageview/src/gtkimageview.defs

    r398 r401  
    6262) 
    6363 
     64(define-enum PixbufDrawMethod 
     65  (in-module "Gdk") 
     66  (c-name "GdkPixbufDrawMethod") 
     67  (gtype-id "GDK_TYPE_PIXBUF_DRAW_METHOD") 
     68  (values 
     69   '("contains", "GDK_PIXBUF_DRAW_METHOD_CONTAINS") 
     70   '("scale", "GDK_PIXBUF_DRAW_METHOD_SCALE") 
     71   '("scroll", "GDK_PIXBUF_DRAW_METHOD_SCROLL") 
     72   ) 
     73  ) 
    6474 
    6575;; From gtkanimview.h 
  • pygtkimageview/src/gtkimageview.override

    r363 r401  
    1010#include <gtkimageview/gtkzooms.h> 
    1111#include "pygobject.h" 
    12 #include "enums-public.h" 
     12#include "enums-public-gdk.h" 
     13#include "enums-public-gtk.h" 
    1314 
    1415/* This is apparently something you need to copy into every .override 
  • pygtkimageview/src/gtkimageviewmodule.c

    r312 r401  
    11#include <pygobject.h> 
    22#include <pygtk/pygtk.h> 
     3 
     4#include "enums-public-gdk.h" 
     5#include "enums-public-gtk.h" 
    36 
    47void gtkimageview_register_classes (PyObject *d); 
     
    1922 
    2023    gtkimageview_register_classes (d); 
    21     gtkimageview_add_constants (m, "GTK_IMAGE_"); 
     24 
     25    // Add the constants here, because gtkimageview_add_constants() 
     26    // doesn't like that I use two different prefixes. 
     27    pyg_enum_add(m, "ImageTransp", "GTK_IMAGE_", GTK_TYPE_IMAGE_TRANSP); 
     28 
     29    // Here I think we rely on buggy behaviour. pyg_enum_add() should 
     30    // turn things like GDK_PIXBUF_DRAW_METHOD_CONTAINS into 
     31    // DRAW_METHOD_CONTAINS, and only by writing a strip_prefix like 
     32    // below will it do so. 
     33    pyg_enum_add(m, "PixbufDrawMethod", "GDK_TYPE_P_", 
     34                 GDK_TYPE_PIXBUF_DRAW_METHOD); 
     35 
     36    if (PyErr_Occurred()) 
     37        PyErr_Print(); 
    2238}