~ubuntu-branches/ubuntu/trusty/gnome-python-extras/trusty

« back to all changes in this revision

Viewing changes to gtkmozembed/gtkmozembedmodule.cpp

  • Committer: Package Import Robot
  • Author(s): Michael Biebl, Laurent Bigonville, Michael Biebl
  • Date: 2011-10-10 01:45:28 UTC
  • mfrom: (1.1.22 sid)
  • Revision ID: package-import@ubuntu.com-20111010014528-h5nyqhes543ezy1i
Tags: 2.25.3-11
[ Laurent Bigonville ]
* debian/rules: Drop .la files

[ Michael Biebl ]
* Drop python-gdl package. There are no reverse dependencies left and gdl
  provides a gir package now.
* Drop python-gda package. There are no reverse dependencies left and gda
  provides a gir package now.
* Remove obsolete patches.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#ifdef HAVE_CONFIG_H
2
 
#include "config.h"
3
 
#endif
4
 
 
5
 
/* include this first, before NO_IMPORT_PYGOBJECT is defined */
6
 
#include <pygobject.h>
7
 
#include <pygtk/pygtk.h>
8
 
 
9
 
#ifdef XPCOM_GLUE
10
 
#include "gtkmozembed_glue.cpp"
11
 
#endif
12
 
 
13
 
G_BEGIN_DECLS
14
 
void initgtkmozembed(void);
15
 
void pygtkmozembed_add_constants(PyObject *module, const gchar *strip_prefix);
16
 
void pygtkmozembed_register_classes (PyObject *d);
17
 
G_END_DECLS
18
 
 
19
 
extern PyMethodDef pygtkmozembed_functions[];
20
 
 
21
 
void
22
 
initgtkmozembed(void)
23
 
{
24
 
    PyObject *m, *d;
25
 
    int argc = 0;
26
 
 
27
 
    init_pygobject ();
28
 
 
29
 
#ifdef XPCOM_GLUE
30
 
    static const GREVersionRange greVersion = {
31
 
    "2.0b", PR_TRUE,
32
 
    "2.0.*", PR_TRUE
33
 
    };
34
 
    char xpcomLocation[4096];
35
 
    nsresult rv = GRE_GetGREPathWithProperties(&greVersion, 1, nsnull, 0, xpcomLocation, 4096);
36
 
    if (NS_FAILED(rv)) {
37
 
        printf("GRE_GetGREPathWithProperties failed\n");
38
 
        return;
39
 
    }
40
 
 
41
 
    // Startup the XPCOM Glue that links us up with XPCOM.
42
 
    XPCOMGlueStartup(xpcomLocation);
43
 
    if (NS_FAILED(rv)) {
44
 
        printf("XPCOMGlueStartup failed\n");
45
 
        return;
46
 
    }
47
 
 
48
 
    rv = GTKEmbedGlueStartup();
49
 
    if (NS_FAILED(rv)) {printf("location: %s \n", xpcomLocation);
50
 
        printf("GTKEmbedGlueStartup failed\n");
51
 
        return;
52
 
    }
53
 
 
54
 
    rv = GTKEmbedGlueStartupInternal();
55
 
    if (NS_FAILED (rv)) {
56
 
        printf ("GTKEmbedGlueStartupInternal failed\n");
57
 
        return;
58
 
    }
59
 
 
60
 
    //gtk_moz_embed_set_comp_path(xpcomLocation);
61
 
 
62
 
    char *lastSlash = strrchr(xpcomLocation, '/');
63
 
    if (lastSlash)
64
 
      *lastSlash = '\0';
65
 
 
66
 
    gtk_moz_embed_set_path(xpcomLocation);
67
 
#endif
68
 
 
69
 
    m = Py_InitModule ("gtkmozembed", pygtkmozembed_functions);
70
 
    d = PyModule_GetDict (m);
71
 
 
72
 
    pygtkmozembed_add_constants(m, "GTK_MOZ_EMBED_");
73
 
    pygtkmozembed_register_classes (d);
74
 
 
75
 
    if (PyErr_Occurred ()) {
76
 
        Py_FatalError ("can't initialise module gtkmozembed");
77
 
    }
78
 
}