File: printuimodule.c

package info (click to toggle)
gnome-python-desktop 2.32.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 4,548 kB
  • sloc: sh: 10,214; xml: 8,851; ansic: 3,428; python: 1,457; makefile: 664
file content (67 lines) | stat: -rw-r--r-- 1,799 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/* -*- Mode: C; c-basic-offset: 4 -*- */

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

/* include this first, before NO_IMPORT_PYGOBJECT is defined */
#include <pygobject.h>
#include <pygtk/pygtk.h>

#include <libgnomeprintui/gnome-print-dialog.h>
#include <libgnomeprintui/gnome-font-dialog.h>
#include <libgnomeprintui/gnome-print-job-preview.h>
#include <libgnomeprintui/gnome-print-preview.h>
#include <libgnomeprintui/gnome-print-paper-selector.h>
#include <libgnomeprintui/gnome-print-unit-selector.h>

void pyprintui_register_classes (PyObject *d);
extern PyMethodDef pyprintui_functions[];

void
pyprintui_add_defined_constants (PyObject *dict)
{
#define add_item(short)\
    PyDict_SetItemString (dict, #short, PyInt_FromLong (GNOME_PRINT_##short))
      /* GnomePrintRangeType */
    add_item(RANGETYPE_NONE);
    add_item(RANGETYPE_CUSTOM);
    add_item(RANGETYPE_PAGES);
      /* GnomePrintDialogRangeFlags */
    add_item(RANGE_CURRENT);
    add_item(RANGE_ALL);
    add_item(RANGE_RANGE);
    add_item(RANGE_SELECTION);
    add_item(RANGE_SELECTION_UNSENSITIVE);
      /* GnomePrintDialogFlags */
    add_item(DIALOG_RANGE);
    add_item(DIALOG_COPIES);
      /* GnomePrintButtons */
    add_item(DIALOG_RESPONSE_PRINT);
    add_item(DIALOG_RESPONSE_PREVIEW);
    add_item(DIALOG_RESPONSE_CANCEL);
#undef add_item

#define add_item(short)\
    PyDict_SetItemString (dict, #short, PyInt_FromLong (GNOME_##short))
    add_item(PAPER_SELECTOR_MARGINS);
    add_item(PAPER_SELECTOR_FEED_ORIENTATION);
#undef add_item
}


DL_EXPORT(void)
initui (void)
{
    PyObject *m, *d;
	
    init_pygobject ();
    init_pygtk();
    
    m = Py_InitModule ("ui", pyprintui_functions);
    d = PyModule_GetDict (m);
	
    pyprintui_register_classes (d);
    pyprintui_add_defined_constants (d);
}