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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
|
https://bugs.gentoo.org/show_bug.cgi?id=330847
Patch by the OpenSUSE folks, found by pacho.
Updated with https://build.opensuse.org/request/show/69983
Index: yelp-2.30.2/m4/gecko.m4
===================================================================
--- yelp-2.30.2.orig/m4/gecko.m4
+++ yelp-2.30.2/m4/gecko.m4
@@ -212,25 +212,6 @@ AC_LANG_PUSH([C++])
_SAVE_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $_GECKO_EXTRA_CPPFLAGS $_GECKO_CFLAGS"
-AC_MSG_CHECKING([[whether we have a gtk 2 gecko build]])
-AC_RUN_IFELSE(
- [AC_LANG_SOURCE(
- [[#include <mozilla-config.h>
- #include <string.h>
- #include <stdlib.h>
- int main(void) {
- if (strcmp (MOZ_DEFAULT_TOOLKIT, "gtk2") == 0 ||
- strcmp (MOZ_DEFAULT_TOOLKIT, "cairo-gtk2") == 0)
- return EXIT_SUCCESS;
-
- return EXIT_FAILURE;
- } ]]
- )],
- [result=yes],
- [AC_MSG_ERROR([[This program needs a gtk 2 gecko build]])],
- [result=maybe])
-AC_MSG_RESULT([$result])
-
AC_MSG_CHECKING([[whether we have a gecko debug build]])
AC_COMPILE_IFELSE(
[AC_LANG_SOURCE(
@@ -304,7 +285,9 @@ if (!stream) return 126;
#ifdef MOZILLA_1_8_BRANCH
version = "1.8.1";
#else
-if (strncmp (MOZILLA_VERSION, "1.9", strlen ("1.9")) == 0) {
+if (strncmp (MOZILLA_VERSION, "2.0", strlen ("2.0")) == 0) {
+ version = "2.0";
+} else if (strncmp (MOZILLA_VERSION, "1.9", strlen ("1.9")) == 0) {
version = "1.9";
} else if (strncmp (MOZILLA_VERSION, "1.8", strlen ("1.8")) == 0) {
version = "1.8";
@@ -328,7 +311,7 @@ AC_LANG_POP([C++])
gecko_cv_gecko_version_int="$(echo "$gecko_cv_gecko_version" | $AWK -F . '{print [$]1 * 1000000 + [$]2 * 1000 + [$]3}')"
-if test "$gecko_cv_gecko_version_int" -lt "1007000" -o "$gecko_cv_gecko_version_int" -gt "1009000"; then
+if test "$gecko_cv_gecko_version_int" -lt "1007000" -o "$gecko_cv_gecko_version_int" -gt "2000000"; then
AC_MSG_ERROR([Gecko version $gecko_cv_gecko_version is not supported!])
fi
@@ -350,7 +333,10 @@ if test "$gecko_cv_gecko_version_int" -g
fi
if test "${gecko_cv_gecko}" = "libxul-embedding" -o "${gecko_cv_gecko}" = "libxul"; then
- PKG_CHECK_EXISTS([${gecko_cv_gecko} >= 1.9.1],[gecko_cv_have_gecko_1_9_1=yes gecko_cv_gecko_version="1.9.1" gecko_cv_gecko_version_int=1009001],[gecko_cv_have_gecko_1_9_1=no])
+ PKG_CHECK_EXISTS([${gecko_cv_gecko} >= 1.9.1],
+ [ gecko_cv_have_gecko_1_9_1=yes
+ if test "$gecko_cv_gecko_version_int" -lt "2000000"; then gecko_cv_gecko_version="1.9.1" gecko_cv_gecko_version_int=1009001; fi
+ ],[gecko_cv_have_gecko_1_9_1=no])
else
gecko_cv_have_gecko_1_9_1=no
fi
@@ -359,6 +345,11 @@ if test "$gecko_cv_have_gecko_1_9_1" = "
AC_DEFINE([HAVE_GECKO_1_9_1],[1],[Define if we have gecko 1.9.1])
fi
+if test "$gecko_cv_gecko_version_int" -ge "2000000"; then
+ AC_DEFINE([HAVE_GECKO_2_0],[1],[Define if we have gecko 2.0])
+ gecko_cv_have_gecko_2_0=yes
+fi
+
fi # if gecko_cv_have_gecko
$1[]_VERSION=$gecko_cv_gecko_version
@@ -407,6 +398,7 @@ AM_CONDITIONAL([HAVE_GECKO_1_8],[test "$
AM_CONDITIONAL([HAVE_GECKO_1_8_1],[test "$gecko_cv_have_gecko" = "yes" -a "$gecko_cv_gecko_version_int" -ge "1008001"])
AM_CONDITIONAL([HAVE_GECKO_1_9],[test "$gecko_cv_have_gecko" = "yes" -a "$gecko_cv_gecko_version_int" -ge "1009000"])
AM_CONDITIONAL([HAVE_GECKO_1_9_1],[test "$gecko_cv_have_gecko" = "yes" -a "$gecko_cv_have_gecko_1_9_1" = "yes"])
+AM_CONDITIONAL([HAVE_GECKO_2_0],[test "$gecko_cv_have_gecko" = "yes" -a "$gecko_cv_have_gecko_2_0" = "yes"])
AM_CONDITIONAL([HAVE_GECKO_HOME],[test "x$_GECKO_HOME" != "x"])
AM_CONDITIONAL([HAVE_GECKO_DEBUG],[test "$gecko_cv_have_debug" = "yes"])
AM_CONDITIONAL([HAVE_GECKO_XPCOM_GLUE],[test "$gecko_cv_have_xpcom_glue" = "yes"])
Index: yelp-2.30.2/src/yelp-gecko-services.cpp
===================================================================
--- yelp-2.30.2.orig/src/yelp-gecko-services.cpp
+++ yelp-2.30.2/src/yelp-gecko-services.cpp
@@ -32,7 +32,11 @@
#include <nsIComponentManager.h>
#include <nsComponentManagerUtils.h>
#include <nsIComponentRegistrar.h>
+#ifndef HAVE_GECKO_2_0
#include <nsIGenericFactory.h>
+#else
+#include <nsIFactory.h>
+#endif
#include <nsILocalFile.h>
#include <nsIPrintSettings.h>
#include <nsServiceManagerUtils.h>
@@ -418,6 +422,8 @@ PrintListener::SetPrintSettings (YelpPri
/* component registration */
+#ifndef HAVE_GECKO_2_0
+
NS_GENERIC_FACTORY_CONSTRUCTOR(GPrintingPromptService)
static const nsModuleComponentInfo sAppComps[] = {
@@ -462,3 +468,115 @@ yelp_register_printing ()
}
}
+
+#else
+
+/*
+ * Adapted from code from ./embedding/browser/activex/src/control/PromptService.cpp in Firefox
+ */
+
+//*****************************************************************************
+// GPrintingPromptServiceFactory
+//*****************************************************************************
+
+class GPrintingPromptServiceFactory : public nsIFactory
+{
+public:
+ NS_DECL_ISUPPORTS
+ NS_DECL_NSIFACTORY
+
+ GPrintingPromptServiceFactory();
+ virtual ~GPrintingPromptServiceFactory();
+};
+
+//*****************************************************************************
+
+NS_IMPL_ISUPPORTS1(GPrintingPromptServiceFactory, nsIFactory)
+
+GPrintingPromptServiceFactory::GPrintingPromptServiceFactory()
+{
+}
+
+GPrintingPromptServiceFactory::~GPrintingPromptServiceFactory()
+{
+}
+
+NS_IMETHODIMP GPrintingPromptServiceFactory::CreateInstance(nsISupports *aOuter, const nsIID & aIID, void **aResult)
+{
+ NS_ENSURE_ARG_POINTER(aResult);
+
+ *aResult = NULL;
+ GPrintingPromptService *inst = new GPrintingPromptService;
+ if (!inst)
+ return NS_ERROR_OUT_OF_MEMORY;
+
+ nsresult rv = inst->QueryInterface(aIID, aResult);
+ if (rv != NS_OK) {
+ // We didn't get the right interface, so clean up
+ delete inst;
+ }
+
+ return rv;
+}
+
+NS_IMETHODIMP GPrintingPromptServiceFactory::LockFactory(PRBool lock)
+{
+ return NS_OK;
+}
+
+//*****************************************************************************
+
+nsresult NS_NewPrintingPromptServiceFactory(nsIFactory** aFactory)
+{
+ NS_ENSURE_ARG_POINTER(aFactory);
+ *aFactory = nsnull;
+
+ GPrintingPromptServiceFactory *result = new GPrintingPromptServiceFactory;
+ if (!result)
+ return NS_ERROR_OUT_OF_MEMORY;
+
+ NS_ADDREF(result);
+ *aFactory = result;
+
+ return NS_OK;
+}
+
+/*
+ * End of adapted code.
+ */
+
+static NS_DEFINE_CID(kGPrintingPromptServiceCID, G_PRINTINGPROMPTSERVICE_CID);
+
+void
+yelp_register_printing ()
+{
+ nsresult rv;
+ nsCOMPtr<nsIComponentRegistrar> cr;
+ rv = NS_GetComponentRegistrar(getter_AddRefs(cr));
+ NS_ENSURE_SUCCESS (rv, );
+
+ nsCOMPtr<nsIComponentManager> cm;
+ rv = NS_GetComponentManager (getter_AddRefs (cm));
+ NS_ENSURE_SUCCESS (rv, );
+
+ nsCOMPtr<nsIFactory> componentFactory;
+ rv = NS_NewPrintingPromptServiceFactory(getter_AddRefs(componentFactory));
+
+ if (NS_FAILED(rv) || !componentFactory)
+ {
+ g_warning ("Failed to make a factory for %s\n", G_PRINTINGPROMPTSERVICE_CLASSNAME);
+ return;
+ }
+
+ rv = cr->RegisterFactory(kGPrintingPromptServiceCID,
+ G_PRINTINGPROMPTSERVICE_CLASSNAME,
+ G_PRINTINGPROMPTSERVICE_CONTRACTID,
+ componentFactory);
+ if (NS_FAILED(rv))
+ {
+ g_warning ("Failed to register %s\n", G_PRINTINGPROMPTSERVICE_CLASSNAME);
+ }
+
+}
+
+#endif
Index: yelp-2.30.2/src/yelp-gecko-utils.cpp
===================================================================
--- yelp-2.30.2.orig/src/yelp-gecko-utils.cpp
+++ yelp-2.30.2/src/yelp-gecko-utils.cpp
@@ -213,8 +213,8 @@ yelp_gecko_init (void)
nsresult rv;
#ifdef XPCOM_GLUE
static const GREVersionRange greVersion = {
- "1.9a", PR_TRUE,
- "2", PR_TRUE
+ "2.0a", PR_TRUE,
+ "2.0.*", PR_TRUE
};
char xpcomLocation[PATH_MAX];
rv = GRE_GetGREPathWithProperties(&greVersion, 1, nsnull, 0, xpcomLocation, sizeof (xpcomLocation));
|