Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 485984
Collapse All | Expand All

(-)a/mozilla/toolkit/system/gnome/moz.build (+2 lines)
Lines 3-18 Link Here
3
# This Source Code Form is subject to the terms of the Mozilla Public
3
# This Source Code Form is subject to the terms of the Mozilla Public
4
# License, v. 2.0. If a copy of the MPL was not distributed with this
4
# License, v. 2.0. If a copy of the MPL was not distributed with this
5
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
5
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
6
7
MODULE = 'mozgnome'
7
MODULE = 'mozgnome'
8
8
9
CPP_SOURCES += [
9
CPP_SOURCES += [
10
    'nsGnomeModule.cpp',
10
    'nsGnomeModule.cpp',
11
    'nsSystemAlertsService.cpp',
12
    'nsAlertsIconListener.cpp'
11
]
13
]
12
14
13
if CONFIG['MOZ_ENABLE_GCONF']:
15
if CONFIG['MOZ_ENABLE_GCONF']:
14
    CPP_SOURCES += [
16
    CPP_SOURCES += [
15
        'nsGConfService.cpp',
17
        'nsGConfService.cpp',
16
    ]
18
    ]
17
19
18
if CONFIG['MOZ_ENABLE_GNOMEVFS']:
20
if CONFIG['MOZ_ENABLE_GNOMEVFS']:
(-)a/mozilla/toolkit/system/gnome/nsAlertsIconListener.h (+88 lines)
Line 0 Link Here
1
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* This Source Code Form is subject to the terms of the Mozilla Public
3
 * License, v. 2.0. If a copy of the MPL was not distributed with this
4
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6
#ifndef nsAlertsIconListener_h__
7
#define nsAlertsIconListener_h__
8
9
#include "nsCOMPtr.h"
10
#include "imgINotificationObserver.h"
11
#include "nsStringAPI.h"
12
#include "nsIObserver.h"
13
#include "nsWeakReference.h"
14
15
#include <gdk-pixbuf/gdk-pixbuf.h>
16
17
class imgIRequest;
18
19
struct NotifyNotification;
20
21
class nsAlertsIconListener : public imgINotificationObserver,
22
                             public nsIObserver,
23
                             public nsSupportsWeakReference
24
{
25
public:
26
  NS_DECL_ISUPPORTS
27
  NS_DECL_IMGINOTIFICATIONOBSERVER
28
  NS_DECL_NSIOBSERVER
29
30
  nsAlertsIconListener();
31
  virtual ~nsAlertsIconListener();
32
33
  nsresult InitAlertAsync(const nsAString & aImageUrl,
34
                          const nsAString & aAlertTitle, 
35
                          const nsAString & aAlertText,
36
                          bool aAlertTextClickable,
37
                          const nsAString & aAlertCookie,
38
                          nsIObserver * aAlertListener);
39
40
  void SendCallback();
41
  void SendClosed();
42
43
protected:
44
  nsresult OnStopRequest(imgIRequest* aRequest);
45
  nsresult OnStopFrame(imgIRequest* aRequest);
46
47
  /**
48
   * The only difference between libnotify.so.4 and libnotify.so.1 for these symbols
49
   * is that notify_notification_new takes three arguments in libnotify.so.4 and
50
   * four in libnotify.so.1.
51
   * Passing the fourth argument as NULL is binary compatible.
52
   */
53
  typedef void (*NotifyActionCallback)(NotifyNotification*, char*, gpointer);
54
  typedef bool (*notify_is_initted_t)(void);
55
  typedef bool (*notify_init_t)(const char*);
56
  typedef GList* (*notify_get_server_caps_t)(void);
57
  typedef NotifyNotification* (*notify_notification_new_t)(const char*, const char*, const char*, const char*);
58
  typedef bool (*notify_notification_show_t)(void*, char*);
59
  typedef void (*notify_notification_set_icon_from_pixbuf_t)(void*, GdkPixbuf*);
60
  typedef void (*notify_notification_add_action_t)(void*, const char*, const char*, NotifyActionCallback, gpointer, GFreeFunc);
61
62
  nsCOMPtr<imgIRequest> mIconRequest;
63
  nsCString mAlertTitle;
64
  nsCString mAlertText;
65
66
  nsCOMPtr<nsIObserver> mAlertListener;
67
  nsString mAlertCookie;
68
69
  bool mLoadedFrame;
70
  bool mAlertHasAction;
71
72
  static void* libNotifyHandle;
73
  static bool libNotifyNotAvail;
74
  static notify_is_initted_t notify_is_initted;
75
  static notify_init_t notify_init;
76
  static notify_get_server_caps_t notify_get_server_caps;
77
  static notify_notification_new_t notify_notification_new;
78
  static notify_notification_show_t notify_notification_show;
79
  static notify_notification_set_icon_from_pixbuf_t notify_notification_set_icon_from_pixbuf;
80
  static notify_notification_add_action_t notify_notification_add_action;
81
  NotifyNotification* mNotification;
82
  gulong mClosureHandler;
83
84
  nsresult StartRequest(const nsAString & aImageUrl);
85
  nsresult ShowAlert(GdkPixbuf* aPixbuf);
86
};
87
88
#endif
(-)a/mozilla/toolkit/system/gnome/nsGnomeModule.cpp (+6 lines)
Lines 17-69 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsGC Link Here
17
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsGnomeVFSService, Init)
17
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsGnomeVFSService, Init)
18
#endif
18
#endif
19
#ifdef MOZ_ENABLE_GIO
19
#ifdef MOZ_ENABLE_GIO
20
#include "nsGIOService.h"
20
#include "nsGIOService.h"
21
#include "nsGSettingsService.h"
21
#include "nsGSettingsService.h"
22
NS_GENERIC_FACTORY_CONSTRUCTOR(nsGIOService)
22
NS_GENERIC_FACTORY_CONSTRUCTOR(nsGIOService)
23
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsGSettingsService, Init)
23
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsGSettingsService, Init)
24
#endif
24
#endif
25
#include "nsSystemAlertsService.h"
26
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsSystemAlertsService, Init)
25
27
26
#ifdef MOZ_ENABLE_GCONF
28
#ifdef MOZ_ENABLE_GCONF
27
NS_DEFINE_NAMED_CID(NS_GCONFSERVICE_CID);
29
NS_DEFINE_NAMED_CID(NS_GCONFSERVICE_CID);
28
#endif
30
#endif
29
#ifdef MOZ_ENABLE_GNOMEVFS
31
#ifdef MOZ_ENABLE_GNOMEVFS
30
NS_DEFINE_NAMED_CID(NS_GNOMEVFSSERVICE_CID);
32
NS_DEFINE_NAMED_CID(NS_GNOMEVFSSERVICE_CID);
31
#endif
33
#endif
32
#ifdef MOZ_ENABLE_GIO
34
#ifdef MOZ_ENABLE_GIO
33
NS_DEFINE_NAMED_CID(NS_GIOSERVICE_CID);
35
NS_DEFINE_NAMED_CID(NS_GIOSERVICE_CID);
34
NS_DEFINE_NAMED_CID(NS_GSETTINGSSERVICE_CID);
36
NS_DEFINE_NAMED_CID(NS_GSETTINGSSERVICE_CID);
35
#endif
37
#endif
38
NS_DEFINE_NAMED_CID(NS_SYSTEMALERTSSERVICE_CID);
39
36
40
37
static const mozilla::Module::CIDEntry kGnomeCIDs[] = {
41
static const mozilla::Module::CIDEntry kGnomeCIDs[] = {
38
#ifdef MOZ_ENABLE_GCONF
42
#ifdef MOZ_ENABLE_GCONF
39
  { &kNS_GCONFSERVICE_CID, false, NULL, nsGConfServiceConstructor },
43
  { &kNS_GCONFSERVICE_CID, false, NULL, nsGConfServiceConstructor },
40
#endif
44
#endif
41
#ifdef MOZ_ENABLE_GNOMEVFS
45
#ifdef MOZ_ENABLE_GNOMEVFS
42
  { &kNS_GNOMEVFSSERVICE_CID, false, NULL, nsGnomeVFSServiceConstructor },
46
  { &kNS_GNOMEVFSSERVICE_CID, false, NULL, nsGnomeVFSServiceConstructor },
43
#endif
47
#endif
44
#ifdef MOZ_ENABLE_GIO
48
#ifdef MOZ_ENABLE_GIO
45
  { &kNS_GIOSERVICE_CID, false, NULL, nsGIOServiceConstructor },
49
  { &kNS_GIOSERVICE_CID, false, NULL, nsGIOServiceConstructor },
46
  { &kNS_GSETTINGSSERVICE_CID, false, NULL, nsGSettingsServiceConstructor },
50
  { &kNS_GSETTINGSSERVICE_CID, false, NULL, nsGSettingsServiceConstructor },
47
#endif
51
#endif
52
  { &kNS_SYSTEMALERTSSERVICE_CID, false, NULL, nsSystemAlertsServiceConstructor },
48
  { NULL }
53
  { NULL }
49
};
54
};
50
55
51
static const mozilla::Module::ContractIDEntry kGnomeContracts[] = {
56
static const mozilla::Module::ContractIDEntry kGnomeContracts[] = {
52
#ifdef MOZ_ENABLE_GCONF
57
#ifdef MOZ_ENABLE_GCONF
53
  { NS_GCONFSERVICE_CONTRACTID, &kNS_GCONFSERVICE_CID },
58
  { NS_GCONFSERVICE_CONTRACTID, &kNS_GCONFSERVICE_CID },
54
#endif
59
#endif
55
#ifdef MOZ_ENABLE_GNOMEVFS
60
#ifdef MOZ_ENABLE_GNOMEVFS
56
  { NS_GNOMEVFSSERVICE_CONTRACTID, &kNS_GNOMEVFSSERVICE_CID },
61
  { NS_GNOMEVFSSERVICE_CONTRACTID, &kNS_GNOMEVFSSERVICE_CID },
57
#endif
62
#endif
58
#ifdef MOZ_ENABLE_GIO
63
#ifdef MOZ_ENABLE_GIO
59
  { NS_GIOSERVICE_CONTRACTID, &kNS_GIOSERVICE_CID },
64
  { NS_GIOSERVICE_CONTRACTID, &kNS_GIOSERVICE_CID },
60
  { NS_GSETTINGSSERVICE_CONTRACTID, &kNS_GSETTINGSSERVICE_CID },
65
  { NS_GSETTINGSSERVICE_CONTRACTID, &kNS_GSETTINGSSERVICE_CID },
61
#endif
66
#endif
67
  { NS_SYSTEMALERTSERVICE_CONTRACTID, &kNS_SYSTEMALERTSSERVICE_CID },
62
  { NULL }
68
  { NULL }
63
};
69
};
64
70
65
static nsresult
71
static nsresult
66
InitGType ()
72
InitGType ()
67
{
73
{
68
  g_type_init();
74
  g_type_init();
69
  return NS_OK;
75
  return NS_OK;
(-)a/mozilla/toolkit/system/gnome/nsSystemAlertsService.cpp (+54 lines)
Line 0 Link Here
1
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode:nil; c-basic-offset: 2 -*- */
2
/* This Source Code Form is subject to the terms of the Mozilla Public
3
 * License, v. 2.0. If a copy of the MPL was not distributed with this
4
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6
#include "nsSystemAlertsService.h"
7
#include "nsAlertsIconListener.h"
8
#include "nsAutoPtr.h"
9
10
NS_IMPL_THREADSAFE_ADDREF(nsSystemAlertsService)
11
NS_IMPL_THREADSAFE_RELEASE(nsSystemAlertsService)
12
13
NS_INTERFACE_MAP_BEGIN(nsSystemAlertsService)
14
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIAlertsService)
15
   NS_INTERFACE_MAP_ENTRY(nsIAlertsService)
16
NS_INTERFACE_MAP_END_THREADSAFE
17
18
nsSystemAlertsService::nsSystemAlertsService()
19
{}
20
21
nsSystemAlertsService::~nsSystemAlertsService()
22
{}
23
24
nsresult
25
nsSystemAlertsService::Init()
26
{
27
  return NS_OK;
28
}
29
30
NS_IMETHODIMP
31
nsSystemAlertsService::ShowAlertNotification(const nsAString & aImageUrl,
32
                                             const nsAString & aAlertTitle, 
33
                                             const nsAString & aAlertText,
34
                                             bool aAlertTextClickable,
35
                                             const nsAString & aAlertCookie,
36
                                             nsIObserver * aAlertListener,
37
                                             const nsAString & aAlertName,
38
                                             const nsAString & aBidi,
39
                                             const nsAString & aLang)
40
{
41
  nsRefPtr<nsAlertsIconListener> alertListener = new nsAlertsIconListener();
42
  if (!alertListener)
43
    return NS_ERROR_OUT_OF_MEMORY;
44
45
  return alertListener->InitAlertAsync(aImageUrl, aAlertTitle, aAlertText, aAlertTextClickable,
46
                                       aAlertCookie, aAlertListener);
47
}
48
49
NS_IMETHODIMP
50
nsSystemAlertsService::CloseAlert(const nsAString & aAlertName)
51
{
52
  return NS_ERROR_NOT_IMPLEMENTED;
53
}
54
(-)a/mozilla/toolkit/system/gnome/nsSystemAlertsService.h (+27 lines)
Line 0 Link Here
1
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* This Source Code Form is subject to the terms of the Mozilla Public
3
 * License, v. 2.0. If a copy of the MPL was not distributed with this
4
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6
#ifndef nsSystemAlertsService_h__
7
#define nsSystemAlertsService_h__
8
9
#include "nsIAlertsService.h"
10
#include "nsCOMPtr.h"
11
12
class nsSystemAlertsService : public nsIAlertsService
13
{
14
public:
15
  NS_DECL_NSIALERTSSERVICE
16
  NS_DECL_ISUPPORTS
17
18
  nsSystemAlertsService();
19
  virtual ~nsSystemAlertsService();
20
21
  nsresult Init();
22
23
protected:
24
25
};
26
27
#endif /* nsSystemAlertsService_h__ */

Return to bug 485984