~ubuntu-branches/ubuntu/maverick/liferea/maverick

« back to all changes in this revision

Viewing changes to src/mozilla/mozsupport.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Steve Kowalik
  • Date: 2008-06-23 12:44:17 UTC
  • mfrom: (1.2.52 upstream)
  • Revision ID: james.westby@ubuntu.com-20080623124417-o4klc8dom3qwd7wn
Tags: 1.4.16b-0.1ubuntu1
* Merge from Debian unstable.
* Remaining Ubuntu changes:
  - Change Build-Depends from xulrunner-dev to xulrunner-1.9-dev.
  - Add intltool to Build-Depends.
  - Fix systray mis-behaviour when Liferea is visible in another workspace.
  - Add Hildonisation from Frothing as a patch.
  - Add libhildon-1-dev Build-Depends for lpia.
  - --enable-maemo when building on lpia.
  - Call intltool-update -p to generate translation template for Rosetta.
  - Do not build transitional packages (not required due to Conflicts/
    Provides/Replaces).
  - Build-depend on liblualib50-dev instead of liblua5.1-0-dev.
  - Do not build webkit package.
  - Munge Maintainer field as per spec.
* Ubuntu changes dropped:
  - mobile.desktop, it isn't needed any more.
  - Added xulrunner-1.9 to liferea dependencies.
  - Quilt changes.
* Edit xulrunner-1.9 patch to not patch configure, handle that in
  99_autoconf.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
 *
4
4
 * Copyright (C) 2004-2007 Lars Lindner <lars.lindner@gmail.com>
5
5
 * Copyright (C) 2004-2006 Nathan J. Conrad <t98502@users.sourceforge.net>
 
6
 * Copyright (C) 2008 Alexander Sack <asac@ubuntu.com>
6
7
 *
7
8
 * The preference handling was taken from the Galeon source
8
9
 *
29
30
#  include <config.h>
30
31
#endif
31
32
 
32
 
#define MOZILLA_INTERNAL_API
 
33
// for GLUE we _must_ not use MOZILLA_INTERNAL_API 
 
34
#ifndef XPCOM_GLUE
 
35
#  define MOZILLA_INTERNAL_API
 
36
#endif
33
37
 
34
38
#include "mozsupport.h"
35
39
#include <gtk/gtk.h>
 
40
 
36
41
#include <gtkmozembed.h>
37
42
#include <gtkmozembed_internal.h>
38
43
 
39
 
#include "nsIWebBrowser.h"
40
 
#include "nsIDOMMouseEvent.h"
41
 
#include "dom/nsIDOMKeyEvent.h"
42
 
#include "nsIDOMWindow.h"
43
 
#include "nsIPrefService.h"
44
 
#include "nsIServiceManager.h"
45
 
#include "nsIIOService.h"
46
 
#include "necko/nsNetCID.h"
 
44
// if we use the glue (since 1.9), we must explicitly get the gtkmozembed symbols
 
45
#ifdef XPCOM_GLUE
 
46
#  include <gtkmozembed_glue.cpp>
 
47
#endif
 
48
 
 
49
// some includes were moved with 1.9, so we need to switch here
 
50
#ifdef XPCOM_GLUE
 
51
#include <nsIDOMKeyEvent.h>
 
52
#include <nsNetCID.h>
 
53
#else
 
54
#include <dom/nsIDOMKeyEvent.h>
 
55
#include <necko/nsNetCID.h>
 
56
#endif
 
57
 
 
58
#include <nsIWebBrowser.h>
 
59
#include <nsIDOMMouseEvent.h>
 
60
#include <nsIDOMWindow.h>
 
61
#include <nsIPrefService.h>
 
62
#include <nsIServiceManager.h>
 
63
#include <nsIIOService.h>
 
64
#include <nsCOMPtr.h>
 
65
 
 
66
#include <nsServiceManagerUtils.h>
47
67
 
48
68
extern "C" {
49
69
#include "conf.h"
287
307
        //return FALSE;
288
308
}
289
309
 
 
310
 
 
311
/* helpers for binaries linked against XPCOM_GLUE */
 
312
#ifdef XPCOM_GLUE
 
313
 
 
314
/**
 
315
 * load xpcom through glue.
 
316
 * When using the glue you have to call this method before doing
 
317
 * anything else. It finds the GRE, loads the xpcom libs,
 
318
 * maps the gtkmozbemd symbols and intializes xpcom by setting
 
319
 * the path and component path.
 
320
 *
 
321
 * the caller still has to call gtk_moz_embed_push_startup ()
 
322
 */
 
323
extern "C" gboolean
 
324
mozsupport_xpcom_init ()
 
325
{
 
326
        static const GREVersionRange greVersion = {
 
327
                "1.9a", PR_TRUE,
 
328
                "1.9.*", PR_TRUE
 
329
        };
 
330
        char xpcomLocation[4096];
 
331
        nsresult rv = GRE_GetGREPathWithProperties (&greVersion, 1, nsnull, 0, xpcomLocation, 4096);
 
332
        NS_ENSURE_SUCCESS (rv, NS_SUCCEEDED (rv));
 
333
        // Startup the XPCOM Glue that links us up with XPCOM.
 
334
        rv = XPCOMGlueStartup(xpcomLocation);
 
335
        NS_ENSURE_SUCCESS (rv, NS_SUCCEEDED (rv));
 
336
        rv = GTKEmbedGlueStartup();
 
337
        NS_ENSURE_SUCCESS (rv, NS_SUCCEEDED (rv));
 
338
        rv = GTKEmbedGlueStartupInternal();
 
339
        NS_ENSURE_SUCCESS (rv, NS_SUCCEEDED (rv));
 
340
        char *lastSlash = strrchr (xpcomLocation, '/');
 
341
        if (lastSlash)
 
342
                *lastSlash = '\0';
 
343
        gtk_moz_embed_set_path (xpcomLocation);
 
344
 
 
345
        return TRUE;
 
346
}
 
347
 
 
348
extern "C" gboolean
 
349
mozsupport_xpcom_shutdown ()
 
350
{
 
351
        return NS_SUCCEEDED (XPCOMGlueShutdown ());
 
352
}
 
353
#endif
 
354