FireTray v0.4.0a2

This commit is contained in:
foudfou 2011-09-24 12:00:31 +02:00
parent 92e5a49a77
commit d3b07c348d
28 changed files with 232 additions and 205 deletions

View File

@ -1,15 +1,15 @@
Moztray
Firetray
=======
Overview
--------
Rewrite attempt of **Firetray** with js-ctypes, with focus on unread message count display.
Js-ctypes rewrite of the binary XPCOM version of **Firetray**.
Notes
-----
* Moztray unsets the `tabs.warnOnClose` built-in preference, which otherwise disrupts the handeling of the close event.
* Firetray unsets the `tabs.warnOnClose` built-in preference, which otherwise disrupts the handeling of the close event.
* Experimental non-customizable keyboard shortcut for hiding all windows set to: `accel-shift-w`
References
@ -34,4 +34,8 @@ Acknowledgment
--------------
* Some code borrowed from [Mike Conley](http://mzl.la/messagingmenu "Thanks Mike").
* Some code borrowed from
[Nils Mayer](https://addons.mozilla.org/fr/firefox/addon/minimizetotray-revived/
"MinToTrayR addon page").
* kind support from Neil Deaking

View File

@ -2,7 +2,7 @@
help:
@echo "BUILD/INSTALL INSTRUCTIONS"
@echo
@echo "to build Moztray, just:"
@echo "to build Firetray, just:"
@echo " make all"
@echo
@echo "by default, debug calls are stripped from js files and DEBUG_MODE"
@ -13,9 +13,11 @@ help:
@echo " firefox -no-remote -P # then create '$(profile_id)'"
@echo " thunderbird -no-remote -P # then create '$(profile_id)'"
@echo
@echo "to deploy to dev profile:"
@echo " make clean"
@echo " make install"
@echo "to test the extension with the dev profile:"
@echo " cd ~/.mozilla/firefox/mozilla-dev/extensions"
@echo " ln -s ../../path/to/firetray/src '{9533f794-00b4-4354-aa15-c2bbda6989f8}'"
@echo " cd ~/.thunderbird/mozilla-dev/extensions"
@echo " ln -s ../path/to/firetray/src '{9533f794-00b4-4354-aa15-c2bbda6989f8}'"
@echo
@echo "to test with dev profile:"
@echo " firefox -no-remote -P mozilla-dev"
@ -24,7 +26,7 @@ help:
@echo "Have fun !"
# The UUID of the extension.
extension_uuid := moztray@foudil.fr
extension_name := firetray
# The name of the profile dir where the extension can be installed.
profile_id := mozilla-dev
@ -52,10 +54,10 @@ VERSION := $(shell awk '/<em:version>/ { version=$$1; \
print version }' $(install_rdf))
# The target XPI files.
xpi_file := $(extension_uuid)-$(VERSION).xpi
xpi_file := $(extension_name)-$(VERSION).xpi
xpi_built := $(build_dir)/$(xpi_file)
# Since we use <em:unpack>false, we need the same name across versions
xpi_deployed := $(extension_uuid).xpi
xpi_deployed := $(extension_name).xpi
# The chrome.manifest file.
chrome_manifest := chrome.manifest
@ -110,20 +112,9 @@ all: $(xpi_built)
# This cleans all temporary files and directories created by 'make'.
.PHONY: clean
clean: clean_build clean_profile
clean: clean_build
@echo "Cleanup is done."
# This builds everything except for the actual XPI, and then it copies it to the
# specified profile directory, allowing a quick update that requires no install.
.PHONY: install
install: $(xpi_built) $(profile_locations)
@echo "Installing in profile folder: $(profile_locations)"
@for p in $(profile_locations) ; do \
cp -f $(xpi_built) $$p/$(xpi_deployed); \
done
@echo "Installing in profile folder. Done!"
@echo
# Regex for 'no'
YES_RE := yes|y|Y|true|on
@ -172,9 +163,3 @@ $(profile_locations):
clean_build:
@echo "Removing build dir: $(build_dir)"
@rm -rf $(build_dir)
clean_profile:
@echo "Removing extension from extension folders: $(profile_locations)"
@for p in $(profile_locations) ; do \
rm -f $$p/$(xpi_deployed); \
done

View File

@ -1,11 +1,11 @@
content moztray chrome/content/
skin moztray classic/1.0 chrome/skin/
locale moztray en-US chrome/locale/en-US/
resource moztray modules/
content firetray chrome/content/
skin firetray classic/1.0 chrome/skin/
locale firetray en-US chrome/locale/en-US/
resource firetray modules/
overlay chrome://browser/content/browser.xul chrome://moztray/content/overlay.xul
overlay chrome://messenger/content/messenger.xul chrome://moztray/content/overlay.xul
overlay chrome://songbird/content/xul/mainScriptsOverlay.xul chrome://moztray/content/overlay.xul
overlay chrome://sunbird/content/calendar.xul chrome://moztray/content/overlay.xul
overlay chrome://navigator/content/navigator.xul chrome://moztray/content/overlay.xul
overlay chrome://chatzilla/content/chatzilla.xul chrome://moztray/content/overlay.xul
overlay chrome://browser/content/browser.xul chrome://firetray/content/overlay.xul
overlay chrome://messenger/content/messenger.xul chrome://firetray/content/overlay.xul
overlay chrome://songbird/content/xul/mainScriptsOverlay.xul chrome://firetray/content/overlay.xul
overlay chrome://sunbird/content/calendar.xul chrome://firetray/content/overlay.xul
overlay chrome://navigator/content/navigator.xul chrome://firetray/content/overlay.xul
overlay chrome://chatzilla/content/chatzilla.xul chrome://firetray/content/overlay.xul

View File

@ -5,22 +5,22 @@ const Ci = Components.interfaces;
const Cu = Components.utils;
Cu.import("resource:///modules/mailServices.js");
Cu.import("resource://moztray/MoztHandler.jsm");
Cu.import("resource://moztray/commons.js");
Cu.import("resource://firetray/FiretrayHandler.jsm");
Cu.import("resource://firetray/commons.js");
/**
* mozt namespace.
* firetray namespace.
*/
if ("undefined" == typeof(mozt)) {
var mozt = {};
if ("undefined" == typeof(firetray)) {
var firetray = {};
};
mozt.UIOptions = {
firetray.UIOptions = {
accountBoxId: "accounts_box",
onLoad: function() {
if(mozt.Handler.inMailApp) {
Cu.import("resource://moztray/MoztMessaging.jsm");
if(firetray.Handler.inMailApp) {
Cu.import("resource://firetray/FiretrayMessaging.jsm");
this.insertMailAccountsExcluded(this.accountBoxId);
}
},
@ -29,9 +29,9 @@ mozt.UIOptions = {
// the DOM parent where we do appendChild
let targetNode = document.getElementById(parentId);
let accounts = new mozt.Messaging.Accounts(true);
let accounts = new firetray.Messaging.Accounts(true);
for (let accountServer in accounts) {
if (mozt.Messaging.SERVER_TYPES_EXCLUDED.indexOf(accountServer.type) >= 0)
if (firetray.Messaging.SERVER_TYPES_EXCLUDED.indexOf(accountServer.type) >= 0)
continue;
let nodeAccount = document.createElement("checkbox");
@ -39,9 +39,9 @@ mozt.UIOptions = {
nodeAccount.setAttribute('id', accountServerKey);
nodeAccount.setAttribute('label', accountServer.rootFolder.name);
nodeAccount.setAttribute('checked',
(mozt.Messaging.getPrefAccountsExcluded().indexOf(accountServerKey) >= 0));
(firetray.Messaging.getPrefAccountsExcluded().indexOf(accountServerKey) >= 0));
nodeAccount.setAttribute('oncommand',
'mozt.UIOptions.updateMailAccountsExcluded(mozt.UIOptions.accountBoxId)');
'firetray.UIOptions.updateMailAccountsExcluded(firetray.UIOptions.accountBoxId)');
targetNode.appendChild(nodeAccount);
}
@ -59,9 +59,9 @@ mozt.UIOptions = {
}
LOG("accounts_to_exclude:"+prefValue);
mozt.Utils.prefService.setCharPref('accounts_to_exclude', prefValue.toString());
firetray.Utils.prefService.setCharPref('accounts_to_exclude', prefValue.toString());
mozt.Messaging.updateUnreadMsgCount();
firetray.Messaging.updateUnreadMsgCount();
},
_disableGroup: function(group, disableval) {

View File

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<!DOCTYPE prefwindow SYSTEM "chrome://moztray/locale/options.dtd">
<prefwindow id="moztray-preferences"
<!DOCTYPE prefwindow SYSTEM "chrome://firetray/locale/options.dtd">
<prefwindow id="firetray-preferences"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="&prefwindow.title;"
onload="mozt.UIOptions.onLoad()">
onload="firetray.UIOptions.onLoad()">
<script type="application/x-javascript" src="options.js" />
@ -12,7 +12,7 @@
<preferences>
<preference id="pref_bool_close_hides"
name="extensions.moztray.close_hides" type="bool"/>
name="extensions.firetray.close_hides" type="bool"/>
</preferences>
<groupbox>
@ -21,7 +21,7 @@
accesskey="&bool_close_hides.accesskey;"/>
</groupbox>
<groupbox id="accounts_box"> <!-- mozt.UIOptions.accountBoxId -->
<groupbox id="accounts_box"> <!-- firetray.UIOptions.accountBoxId -->
<caption label="&mail_accounts_exclude;"/>
<!-- accounts are dynamically added here with insert_accounts_name() functions, called at the bottom of this file -->
</groupbox>

View File

@ -1,54 +1,54 @@
/* -*- Mode: js2; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
Components.utils.import("resource://moztray/commons.js");
Components.utils.import("resource://moztray/MoztHandler.jsm");
Components.utils.import("resource://firetray/commons.js");
Components.utils.import("resource://firetray/FiretrayHandler.jsm");
/**
* mozt namespace.
* firetray namespace.
*/
if ("undefined" == typeof(mozt)) {
var mozt = {};
if ("undefined" == typeof(firetray)) {
var firetray = {};
};
mozt.Main = {
firetray.Main = {
onLoad: function(e) {
// initialization code
this.strings = document.getElementById("moztray-strings");
this.strings = document.getElementById("firetray-strings");
try {
// Set up preference change observer
mozt.Utils.prefService.QueryInterface(Ci.nsIPrefBranch2);
firetray.Utils.prefService.QueryInterface(Ci.nsIPrefBranch2);
let that = this;
mozt.Utils.prefService.addObserver("", that, false);
firetray.Utils.prefService.addObserver("", that, false);
}
catch (ex) {
ERROR(ex);
return false;
}
let init = mozt.Handler.initialized || mozt.Handler.init();
let init = firetray.Handler.initialized || firetray.Handler.init();
// update unread messages count
if (mozt.Handler.inMailApp)
mozt.Messaging.updateUnreadMsgCount();
if (firetray.Handler.inMailApp)
firetray.Messaging.updateUnreadMsgCount();
// prevent window closing.
let that = this;
window.addEventListener('close', that.onClose, true);
// NOTE: each new window gets a new mozt.Main, and hence listens to pref
// NOTE: each new window gets a new firetray.Main, and hence listens to pref
// changes
LOG('Moztray LOADED: ' + init);
LOG('Firetray LOADED: ' + init);
return true;
},
onQuit: function(e) {
// Remove observer
let that = this;
mozt.Utils.prefService.removeObserver("", that);
LOG('Moztray UNLOADED !');
/* NOTE: don't mozt.Handler.initialized=false here, otherwise after a
firetray.Utils.prefService.removeObserver("", that);
LOG('Firetray UNLOADED !');
/* NOTE: don't firetray.Handler.initialized=false here, otherwise after a
window close, a new window will create a new handler (and hence, a new
tray icon) */
},
@ -56,11 +56,11 @@ mozt.Main = {
// TODO: prevent preceding warning about closing multiple tabs
// (browser.tabs.warnOnClose)
onClose: function(event) {
LOG('Moztray CLOSE');
let close_hides = mozt.Utils.prefService.getBoolPref('close_hides');
LOG('Firetray CLOSE');
let close_hides = firetray.Utils.prefService.getBoolPref('close_hides');
LOG('close_hides: '+close_hides);
if (close_hides) {
mozt.Handler.showHideToTray();
firetray.Handler.showHideToTray();
event && event.preventDefault(); // no event when called directly (xul)
}
},
@ -81,12 +81,12 @@ mozt.Main = {
window.addEventListener(
'load', function (e) {
removeEventListener('load', arguments.callee, true);
mozt.Main.onLoad(); },
firetray.Main.onLoad(); },
false);
window.addEventListener(
'unload', function (e) {
removeEventListener('unload', arguments.callee, true);
mozt.Main.onQuit(); },
firetray.Main.onQuit(); },
false);
// // TEST - can we catch minimize event ?

View File

@ -1,17 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="chrome://moztray/skin/overlay.css" type="text/css"?>
<!DOCTYPE overlay SYSTEM "chrome://moztray/locale/overlay.dtd">
<overlay id="moztray-overlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<?xml-stylesheet href="chrome://firetray/skin/overlay.css" type="text/css"?>
<!DOCTYPE overlay SYSTEM "chrome://firetray/locale/overlay.dtd">
<overlay id="firetray-overlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/javascript;version=1.7" src="overlay.js"/>
<stringbundleset id="stringbundleset">
<stringbundle id="moztray-strings" src="chrome://moztray/locale/overlay.properties"/>
<stringbundle id="firetray-strings" src="chrome://firetray/locale/overlay.properties"/>
</stringbundleset>
<keyset>
<!-- otherwide window.addEventListener("keypress", mozt.Main.onKeyPress, true);
<!-- otherwide window.addEventListener("keypress", firetray.Main.onKeyPress, true);
see https://addons.mozilla.org/en-US/firefox/addon/move-tabs/ -->
<key id="key_close" key="W" modifiers="shift meta" oncommand="mozt.Handler.showHideToTray();" /> <!-- mozt.Main.onKeyClose(); -->
<key id="key_close" key="W" modifiers="shift meta" oncommand="firetray.Handler.showHideToTray();" /> <!-- firetray.Main.onKeyClose(); -->
</keyset>
</overlay>

View File

@ -1,5 +1,5 @@
<!ENTITY prefwindow.title "MozTray preferences">
<!ENTITY pane1.title "MozTray preferences">
<!ENTITY prefwindow.title "FireTray preferences">
<!ENTITY pane1.title "FireTray preferences">
<!ENTITY bool_close_hides.label "Closing windows hides to tray">
<!ENTITY bool_close_hides.accesskey "C">
<!ENTITY mail_accounts_exclude "Mail accounts to exclude" >

View File

@ -1 +1 @@
<!ENTITY moztray.label "My localized menuitem">
<!ENTITY firetray.label "My localized menuitem">

View File

@ -1,3 +1,3 @@
extensions.moztray@foudil.fr.description=A system tray extension for linux.
extensions.{9533f794-00b4-4354-aa15-c2bbda6989f8}.description=A system tray extension for linux.
popupMenu.itemLabel.Quit=Quit
tooltip.unread_messages=#1 unread message;#1 unread messages

View File

@ -13,8 +13,8 @@
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
inkscape:export-ydpi="90"
inkscape:export-xdpi="90"
inkscape:export-filename="/home/foudil/src/xul/moztray/src/chrome/skin/moztray128.png"
sodipodi:docname="moztray128.svg"
inkscape:export-filename="/home/foudil/src/xul/firetray/src/chrome/skin/firetray128.png"
sodipodi:docname="firetray128.svg"
inkscape:version="0.48.1 r9760"
id="svg3082"
height="128"
@ -42,7 +42,7 @@
inkscape:current-layer="svg3082"
width="64px" />
<title
id="title5320">Moztray icon</title>
id="title5320">FireTray icon</title>
<metadata
id="metadata58">
<rdf:RDF>
@ -51,7 +51,7 @@
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title>Moztray icon</dc:title>
<dc:title>FireTray icon</dc:title>
<cc:license
rdf:resource="http://creativecommons.org/licenses/by/3.0/" />
<dc:date>2011-08-27</dc:date>

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -1,22 +1,22 @@
/* This is just an example. You shouldn't do this. */
#moztray-hello
#firetray-hello
{
color: red ! important;
}
#moztray-toolbar-button
#firetray-toolbar-button
{
list-style-image: url("chrome://moztray/skin/toolbar-button.png");
list-style-image: url("chrome://firetray/skin/toolbar-button.png");
-moz-image-region: rect(0px 24px 24px 0px);
}
#moztray-toolbar-button:hover
#firetray-toolbar-button:hover
{
-moz-image-region: rect(24px 24px 48px 0px);
}
[iconsize="small"] #moztray-toolbar-button
[iconsize="small"] #firetray-toolbar-button
{
-moz-image-region: rect( 0px 40px 16px 24px);
}
[iconsize="small"] #moztray-toolbar-button:hover
[iconsize="small"] #firetray-toolbar-button:hover
{
-moz-image-region: rect(24px 40px 40px 24px);
}

View File

@ -1,9 +1,9 @@
// https://developer.mozilla.org/en/Localizing_extension_descriptions
pref("extensions.moztray@foudil.fr.description", "chrome://moztray/locale/overlay.properties");
pref("extensions.{9533f794-00b4-4354-aa15-c2bbda6989f8}.description", "chrome://firetray/locale/overlay.properties");
// Global prefs
pref("browser.tabs.warnOnClose", false);
// Extension prefs
pref("extensions.moztray.close_hides", true);
pref("extensions.moztray.accounts_to_exclude", "");
pref("extensions.firetray.close_hides", true);
pref("extensions.firetray.accounts_to_exclude", "");

View File

@ -1,18 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#">
<Description about="urn:mozilla:install-manifest">
<em:id>moztray@foudil.fr</em:id>
<em:id>{9533f794-00b4-4354-aa15-c2bbda6989f8}</em:id>
<em:unpack>true</em:unpack> <!-- needed for embedded icons -->
<em:type>2</em:type>
<em:name>MozTray</em:name>
<em:version>0.1.2</em:version>
<em:creator>Foudil BRÉTEL</em:creator>
<em:name>FireTray</em:name>
<em:version>0.4.0a2</em:version>
<em:creator>Hua Luo, Francesco Solero, Foudil BRÉTEL</em:creator>
<em:contributor>Hua Luo, Francesco Solero (Firetray original authors)</em:contributor>
<em:homepageURL>https://github.com/foudfou/moztray</em:homepageURL>
<em:homepageURL>https://github.com/foudfou/firetray</em:homepageURL>
<em:description>A system tray extension for linux.</em:description>
<em:optionsURL>chrome://moztray/content/options.xul</em:optionsURL>
<em:iconURL>chrome://moztray/skin/moztray48.png</em:iconURL>
<em:icon64URL>chrome://moztray/skin/moztray64.png</em:icon64URL>
<em:optionsURL>chrome://firetray/content/options.xul</em:optionsURL>
<em:iconURL>chrome://firetray/skin/firetray48.png</em:iconURL>
<em:icon64URL>chrome://firetray/skin/firetray64.png</em:icon64URL>
<em:targetPlatform>Linux</em:targetPlatform> <!-- only Linux supported for now -->
<em:targetApplication>
@ -63,5 +63,43 @@
</Description>
</em:targetApplication>
<em:developer>Jared Forsyth</em:developer>
<em:developer>Glen Winters</em:developer>
<em:contributor>Simone 'Underpass'</em:contributor>
<em:contributor>Diego Rodriguez</em:contributor>
<em:contributor>Dave Bartlett</em:contributor>
<em:contributor>Bertolotti Pierre</em:contributor>
<em:contributor>Ziyuan Yao</em:contributor>
<em:contributor>+Hard -Soft</em:contributor>
<em:contributor>SparkyBluefang</em:contributor>
<em:contributor>Corossig</em:contributor>
<em:contributor>Hicham.Haouari</em:contributor>
<em:contributor>Jreybert</em:contributor>
<em:contributor>aedrin</em:contributor>
<em:translator>Lachezar [bg-BG]</em:translator>
<em:translator>SoftcatalàAljullu,ellibre [ca-AD]</em:translator>
<em:translator>Sam [cz-CZ]</em:translator>
<em:translator>bricks [de-DE]</em:translator>
<em:translator>profediego [es-AR]</em:translator>
<em:translator>chuzo [es-ES]</em:translator>
<em:translator>GµårÐïåñ [fa-IR]</em:translator>
<em:translator>BatBat,Jojaba,nico@nc [fr-FR]</em:translator>
<em:translator>Simone 'Underpass' [it-IT]</em:translator>
<em:translator>drry [ja-JP]</em:translator>
<em:translator>renegade06 [mk-MK]</em:translator>
<em:translator>markh [nl-NL]</em:translator>
<em:translator>Wacław Jacek [pl-PL]</em:translator>
<em:translator>Alberto Eidh [pt-BR]</em:translator>
<em:translator>Quicksilver tears [ru-RU]</em:translator>
<em:translator>lukas_sk [sk-SK]</em:translator>
<em:translator>miles [sl-SL]</em:translator>
<em:translator>Lakrits [sv-SE]</em:translator>
<em:translator>efecan [tr-TR]</em:translator>
<em:translator>Sappa [uk-UA]</em:translator>
<em:translator>xmoke [zh-CN]</em:translator>
</Description>
</RDF>

View File

@ -1,6 +1,6 @@
/* -*- Mode: js2; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
var EXPORTED_SYMBOLS = [ "mozt" ];
var EXPORTED_SYMBOLS = [ "firetray" ];
const Cc = Components.classes;
const Ci = Components.interfaces;
@ -8,15 +8,15 @@ const Cu = Components.utils;
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/ctypes.jsm");
Cu.import("resource://moztray/gobject.jsm");
Cu.import("resource://moztray/gtk.jsm");
Cu.import("resource://moztray/commons.js");
Cu.import("resource://firetray/gobject.jsm");
Cu.import("resource://firetray/gtk.jsm");
Cu.import("resource://firetray/commons.js");
/**
* mozt namespace.
* firetray namespace.
*/
if ("undefined" == typeof(mozt)) {
var mozt = {};
if ("undefined" == typeof(firetray)) {
var firetray = {};
};
/**
@ -26,7 +26,7 @@ if ("undefined" == typeof(mozt)) {
// chrome, modules don't have access to objects such as window, document, or
// other global functions
// (https://developer.mozilla.org/en/XUL_School/JavaScript_Object_Management)
mozt.Handler = {
firetray.Handler = {
initialized: false,
inMailApp: false,
@ -52,7 +52,7 @@ mozt.Handler = {
else if (winType == "XUL")
winOut = winInterface.getInterface(Ci.nsIXULWindow);
else {
ERROR("MOZTRAY: unknown winType '" + winType + "'");
ERROR("FIRETRAY: unknown winType '" + winType + "'");
return null;
}
@ -157,17 +157,17 @@ mozt.Handler = {
let xulVer = Services.appinfo.platformVersion; // Services.vc.compare(xulVer,"2.0a")>=0
LOG("OS=" + runtimeOS + ", XULrunner=" + xulVer);
if (runtimeOS != "Linux") {
ERROR("MOZTRAY: only Linux platform supported at this time. Moztray not loaded");
ERROR("FIRETRAY: only Linux platform supported at this time. Firetray not loaded");
return false;
}
Cu.import("resource://moztray/MoztIconLinux.jsm");
LOG('MoztIconLinux imported');
Cu.import("resource://firetray/FiretrayIconLinux.jsm");
LOG('FiretrayIconLinux imported');
// init all handled windows
this._updateHandledDOMWindows();
// instanciate tray icon
mozt.IconLinux.init();
firetray.IconLinux.init();
LOG('IconLinux initialized');
// check if in mail app
@ -175,15 +175,15 @@ mozt.Handler = {
if (mozAppId === THUNDERBIRD_ID || mozAppId === SEAMONKEY_ID) {
this.inMailApp = true;
try {
Cu.import("resource://moztray/MoztMessaging.jsm");
mozt.Messaging.enable();
Cu.import("resource://firetray/FiretrayMessaging.jsm");
firetray.Messaging.enable();
} catch (x) {
ERROR(x);
return false;
}
// init unread messages count
mozt.Messaging.updateUnreadMsgCount();
firetray.Messaging.updateUnreadMsgCount();
}
LOG('inMailApp: '+this.inMailApp);
@ -193,9 +193,9 @@ mozt.Handler = {
shutdown: function() { // NOT USED YET
if (this.inMailApp)
mozt.Messaging.disable();
firetray.Messaging.disable();
mozt.IconLinux.shutdown();
firetray.IconLinux.shutdown();
}
}; // mozt.Handler
}; // firetray.Handler

View File

@ -1,6 +1,6 @@
/* -*- Mode: js2; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
var EXPORTED_SYMBOLS = [ "mozt" ];
var EXPORTED_SYMBOLS = [ "firetray" ];
const Cc = Components.classes;
const Ci = Components.interfaces;
@ -9,13 +9,13 @@ const Cu = Components.utils;
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/ctypes.jsm");
Cu.import("resource://moztray/cairo.jsm");
Cu.import("resource://moztray/gobject.jsm");
Cu.import("resource://moztray/gdk.jsm");
Cu.import("resource://moztray/gtk.jsm");
Cu.import("resource://moztray/libc.jsm");
Cu.import("resource://moztray/pango.jsm");
Cu.import("resource://moztray/commons.js");
Cu.import("resource://firetray/cairo.jsm");
Cu.import("resource://firetray/gobject.jsm");
Cu.import("resource://firetray/gdk.jsm");
Cu.import("resource://firetray/gtk.jsm");
Cu.import("resource://firetray/libc.jsm");
Cu.import("resource://firetray/pango.jsm");
Cu.import("resource://firetray/commons.js");
const Services2 = {};
XPCOMUtils.defineLazyServiceGetter(
@ -25,18 +25,18 @@ XPCOMUtils.defineLazyServiceGetter(
"nsIUUIDGenerator"
);
if ("undefined" == typeof(mozt.Handler))
ERROR("MoztIcon*.jsm MUST be imported from/after MoztHandler !");
if ("undefined" == typeof(firetray.Handler))
ERROR("FiretrayIcon*.jsm MUST be imported from/after FiretrayHandler !");
// pointers to JS functions. should *not* be eaten by GC ("Running global
// cleanup code from study base classes" ?)
var mozt_iconActivateCb;
var mozt_popupMenuCb;
var mozt_menuItemQuitActivateCb;
var mozt_findGtkWindowByTitleCb;
var firetray_iconActivateCb;
var firetray_popupMenuCb;
var firetray_menuItemQuitActivateCb;
var firetray_findGtkWindowByTitleCb;
/**
* custum type used to pass data in to and out of mozt_findGtkWindowByTitleCb
* custum type used to pass data in to and out of firetray_findGtkWindowByTitleCb
*/
var _find_data_t = ctypes.StructType("_find_data_t", [
{ inTitle: ctypes.char.ptr },
@ -44,7 +44,7 @@ var _find_data_t = ctypes.StructType("_find_data_t", [
]);
mozt.IconLinux = {
firetray.IconLinux = {
tryIcon: null,
menu: null,
appName: null,
@ -58,10 +58,10 @@ mozt.IconLinux = {
// init tray icon, some variables
this.trayIcon = gtk.gtk_status_icon_new();
this.appName = Services.appinfo.name.toLowerCase();
this.FILENAME_DEFAULT = mozt.Utils.chromeToPath(
"chrome://moztray/skin/" + this.appName + this.FILENAME_SUFFIX);
this.FILENAME_NEWMAIL = mozt.Utils.chromeToPath(
"chrome://moztray/skin/newmail.png");
this.FILENAME_DEFAULT = firetray.Utils.chromeToPath(
"chrome://firetray/skin/" + this.appName + this.FILENAME_SUFFIX);
this.FILENAME_NEWMAIL = firetray.Utils.chromeToPath(
"chrome://firetray/skin/newmail.png");
} catch (x) {
ERROR(x);
return false;
@ -77,10 +77,10 @@ mozt.IconLinux = {
try {
// watch out for binding problems ! here we prefer to keep 'this' in
// showHideToTray() and abandon the args.
mozt_iconActivateCb = gobject.GCallback_t(
function(){mozt.Handler.showHideToTray();});
firetray_iconActivateCb = gobject.GCallback_t(
function(){firetray.Handler.showHideToTray();});
gobject.g_signal_connect(this.trayIcon, "activate",
mozt_iconActivateCb, null);
firetray_iconActivateCb, null);
} catch (x) {
ERROR(x);
return false;
@ -101,7 +101,7 @@ mozt.IconLinux = {
_buildPopupMenu: function() {
this.menu = gtk.gtk_menu_new();
// shouldn't need to convert to utf8 thank to js-ctypes
var menuItemQuitLabel = mozt.Utils.strings.GetStringFromName("popupMenu.itemLabel.Quit");
var menuItemQuitLabel = firetray.Utils.strings.GetStringFromName("popupMenu.itemLabel.Quit");
var menuItemQuit = gtk.gtk_image_menu_item_new_with_label(
menuItemQuitLabel);
var menuItemQuitIcon = gtk.gtk_image_new_from_stock(
@ -110,10 +110,10 @@ mozt.IconLinux = {
var menuShell = ctypes.cast(this.menu, gtk.GtkMenuShell.ptr);
gtk.gtk_menu_shell_append(menuShell, menuItemQuit);
mozt_menuItemQuitActivateCb = gobject.GCallback_t(
function(){mozt.Handler.quitApplication();});
firetray_menuItemQuitActivateCb = gobject.GCallback_t(
function(){firetray.Handler.quitApplication();});
gobject.g_signal_connect(menuItemQuit, "activate",
mozt_menuItemQuitActivateCb, null);
firetray_menuItemQuitActivateCb, null);
var menuWidget = ctypes.cast(this.menu, gtk.GtkWidget.ptr);
gtk.gtk_widget_show_all(menuWidget);
@ -122,10 +122,10 @@ mozt.IconLinux = {
* definition) because we need the args passed to it ! On the other hand
* we need to abandon 'this' in popupMenu() */
let that = this;
mozt_popupMenuCb =
firetray_popupMenuCb =
gtk.GCallbackMenuPopup_t(that.popupMenu);
gobject.g_signal_connect(this.trayIcon, "popup-menu",
mozt_popupMenuCb, this.menu);
firetray_popupMenuCb, this.menu);
},
popupMenu: function(icon, button, activateTime, menu) {
@ -316,13 +316,13 @@ mozt.IconLinux = {
// Search the window by the *temporary* title
let widgets = gtk.gtk_window_list_toplevels();
let that = this;
mozt_findGtkWindowByTitleCb = gobject.GFunc_t(that._findGtkWindowByTitle);
firetray_findGtkWindowByTitleCb = gobject.GFunc_t(that._findGtkWindowByTitle);
var userData = new _find_data_t(
ctypes.char.array()(baseWindow.title),
null
).address();
LOG("userData="+userData);
gobject.g_list_foreach(widgets, mozt_findGtkWindowByTitleCb, userData);
gobject.g_list_foreach(widgets, firetray_findGtkWindowByTitleCb, userData);
gobject.g_list_free(widgets);
if (userData.contents.outWindow.isNull()) {
@ -380,7 +380,7 @@ mozt.IconLinux = {
testWindowHandle: function() {
try {
let win = Services.wm.getMostRecentWindow(null);
let gtkWin = mozt.IconLinux._getGtkWindowHandle(win);
let gtkWin = firetray.IconLinux._getGtkWindowHandle(win);
LOG("FOUND: "+gtk.gtk_window_get_title(gtkWin).readString());
gtk.gtk_window_set_decorated(gtkWin, false);
@ -395,4 +395,4 @@ mozt.IconLinux = {
}
}
}; // mozt.IconLinux
}; // firetray.IconLinux

View File

@ -1,6 +1,6 @@
/* -*- Mode: js2; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
var EXPORTED_SYMBOLS = [ "mozt" ];
var EXPORTED_SYMBOLS = [ "firetray" ];
const Cc = Components.classes;
const Ci = Components.interfaces;
@ -8,8 +8,8 @@ const Cu = Components.utils;
Cu.import("resource:///modules/mailServices.js");
Cu.import("resource://gre/modules/PluralForm.jsm");
Cu.import("resource://moztray/MoztIconLinux.jsm");
Cu.import("resource://moztray/commons.js");
Cu.import("resource://firetray/FiretrayIconLinux.jsm");
Cu.import("resource://firetray/commons.js");
const FLDR_UNINTERESTING =
Ci.nsMsgFolderFlags.Archive |
@ -22,14 +22,14 @@ const FLDR_UNINTERESTING =
const ICON_TEXT_COLOR = "#00000";
/**
* mozt namespace.
* firetray namespace.
*/
if ("undefined" == typeof(mozt)) {
var mozt = {};
if ("undefined" == typeof(firetray)) {
var firetray = {};
};
mozt.Messaging = {
firetray.Messaging = {
// TODO: turn into pref
SERVER_TYPES_EXCLUDED: ["nntp","rss","movemail"], // keep "pop3","imap","none"
@ -70,7 +70,7 @@ mozt.Messaging = {
if (property.toString() === "TotalUnreadMessages" &&
!(folder.flags & FLDR_UNINTERESTING)) {
LOG("Unread msgs for folder "+folder.prettyName+" was "+oldValue+" became "+newValue);
mozt.Messaging.updateUnreadMsgCount();
firetray.Messaging.updateUnreadMsgCount();
}
}
},
@ -80,7 +80,7 @@ mozt.Messaging = {
* containing the keys of the accounts to exclude
*/
getPrefAccountsExcluded: function() {
return mozt.Utils.prefService.getCharPref('accounts_to_exclude').split(',') || [];
return firetray.Utils.prefService.getCharPref('accounts_to_exclude').split(',') || [];
},
/**
@ -116,15 +116,15 @@ mozt.Messaging = {
// update icon
if (this._unreadMsgCount == 0) {
mozt.IconLinux.setImageDefault();
mozt.IconLinux.setTooltipDefault();
firetray.IconLinux.setImageDefault();
firetray.IconLinux.setTooltipDefault();
} else if (this._unreadMsgCount > 0) {
mozt.IconLinux.setText(this._unreadMsgCount.toString(), ICON_TEXT_COLOR);
firetray.IconLinux.setText(this._unreadMsgCount.toString(), ICON_TEXT_COLOR);
let localizedMessage = PluralForm.get(
this._unreadMsgCount,
mozt.Utils.strings.GetStringFromName("tooltip.unread_messages"))
firetray.Utils.strings.GetStringFromName("tooltip.unread_messages"))
.replace("#1", this._unreadMsgCount);;
mozt.IconLinux.setTooltip(localizedMessage);
firetray.IconLinux.setTooltip(localizedMessage);
} else {
ERROR("negative unread messages' count ?"); // should never happen
throw "negative message count"; // should never happen
@ -139,7 +139,7 @@ mozt.Messaging = {
* Accounts Iterator/Generator for iterating over account servers
* @param sortByTypeAndName: boolean
*/
mozt.Messaging.Accounts = function(sortByTypeAndName) {
firetray.Messaging.Accounts = function(sortByTypeAndName) {
if (typeof(sortByTypeAndName) == "undefined") {
this.sortByTypeAndName = false;
return;
@ -149,7 +149,7 @@ mozt.Messaging.Accounts = function(sortByTypeAndName) {
this.sortByTypeAndName = sortByTypeAndName;
};
mozt.Messaging.Accounts.prototype.__iterator__ = function() {
firetray.Messaging.Accounts.prototype.__iterator__ = function() {
let accounts = MailServices.accounts.accounts;
LOG("sortByTypeAndName="+this.sortByTypeAndName);

View File

@ -10,7 +10,7 @@ const Cc = Components.classes;
const Ci = Components.interfaces;
Cu.import("resource://gre/modules/ctypes.jsm");
Cu.import("resource://moztray/ctypes-utils.jsm");
Cu.import("resource://firetray/ctypes-utils.jsm");
function cairo_defines(lib) {
this.cairo_t = ctypes.StructType("cairo_t");

View File

@ -1,7 +1,7 @@
/* -*- Mode: js2; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
var EXPORTED_SYMBOLS =
[ "mozt", "Cc", "Ci", "Cu", "LOG", "WARN", "ERROR",
[ "firetray", "Cc", "Ci", "Cu", "LOG", "WARN", "ERROR",
"FIREFOX_ID", "THUNDERBIRD_ID", "SEAMONKEY_ID" ];
const Cc = Components.classes;
@ -18,25 +18,25 @@ const SEAMONKEY_ID = "{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}";
const CHATZILLA_ID = "{59c81df5-4b7a-477b-912d-4e0fdf64e5f2}";
/**
* mozt namespace.
* firetray namespace.
*/
if ("undefined" == typeof(mozt)) {
var mozt = {};
if ("undefined" == typeof(firetray)) {
var firetray = {};
};
// about:config extensions.logging.enabled
["LOG", "WARN", "ERROR"].forEach(function(aName) {
this.__defineGetter__(aName, function() {
Components.utils.import("resource://gre/modules/AddonLogging.jsm");
LogManager.getLogger("moztray", this);
LogManager.getLogger("firetray", this);
return this[aName];
});
}, this);
mozt.Utils = {
prefService: Services.prefs.getBranch("extensions.moztray."),
strings: Services.strings.createBundle("chrome://moztray/locale/overlay.properties"),
firetray.Utils = {
prefService: Services.prefs.getBranch("extensions.firetray."),
strings: Services.strings.createBundle("chrome://firetray/locale/overlay.properties"),
dumpObj: function(obj) {
let str = "";

View File

@ -12,7 +12,7 @@
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Moztray
* The Original Code is Firetray
*
* The Initial Developer of the Original Code is
* Mozilla Messaging, Ltd.
@ -46,7 +46,7 @@ var EXPORTED_SYMBOLS = [ "ctypes_library", "ERROR" ];
["LOG", "WARN", "ERROR"].forEach(function(aName) {
this.__defineGetter__(aName, function() {
Components.utils.import("resource://gre/modules/AddonLogging.jsm");
LogManager.getLogger("moztray", this);
LogManager.getLogger("firetray", this);
return this[aName];
});
}, this);

View File

@ -12,7 +12,7 @@
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Moztray
* The Original Code is Firetray
*
* The Initial Developer of the Original Code is
* Mozilla Messaging, Ltd.
@ -47,10 +47,10 @@ const Cc = Components.classes;
const Ci = Components.interfaces;
Cu.import("resource://gre/modules/ctypes.jsm");
Cu.import("resource://moztray/ctypes-utils.jsm");
Cu.import("resource://moztray/cairo.jsm");
Cu.import("resource://moztray/glib.jsm");
Cu.import("resource://moztray/gobject.jsm");
Cu.import("resource://firetray/ctypes-utils.jsm");
Cu.import("resource://firetray/cairo.jsm");
Cu.import("resource://firetray/glib.jsm");
Cu.import("resource://firetray/gobject.jsm");
function gdk_defines(lib) {
this.GDK_INTERP_NEAREST = 1, // enum GdkInterpType

View File

@ -10,7 +10,7 @@ const Cc = Components.classes;
const Ci = Components.interfaces;
Cu.import("resource://gre/modules/ctypes.jsm");
Cu.import("resource://moztray/ctypes-utils.jsm");
Cu.import("resource://firetray/ctypes-utils.jsm");
function glib_defines(lib) {
this.GError = ctypes.StructType("GError");

View File

@ -12,7 +12,7 @@
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Moztray
* The Original Code is Firetray
*
* The Initial Developer of the Original Code is
* Mozilla Messaging, Ltd.
@ -47,7 +47,7 @@ const Cc = Components.classes;
const Ci = Components.interfaces;
Cu.import("resource://gre/modules/ctypes.jsm");
Cu.import("resource://moztray/ctypes-utils.jsm");
Cu.import("resource://firetray/ctypes-utils.jsm");
function gobject_defines(lib) {
this.GObject = ctypes.StructType("GObject");

View File

@ -10,10 +10,10 @@ const Cc = Components.classes;
const Ci = Components.interfaces;
Cu.import("resource://gre/modules/ctypes.jsm");
Cu.import("resource://moztray/ctypes-utils.jsm");
Cu.import("resource://moztray/gdk.jsm");
Cu.import("resource://moztray/gobject.jsm");
Cu.import("resource://moztray/pango.jsm");
Cu.import("resource://firetray/ctypes-utils.jsm");
Cu.import("resource://firetray/gdk.jsm");
Cu.import("resource://firetray/gobject.jsm");
Cu.import("resource://firetray/pango.jsm");
function gtk_defines(lib) {
this.GTK_ICON_SIZE_MENU = 1;

View File

@ -10,7 +10,7 @@ const Cc = Components.classes;
const Ci = Components.interfaces;
Cu.import("resource://gre/modules/ctypes.jsm");
Cu.import("resource://moztray/ctypes-utils.jsm");
Cu.import("resource://firetray/ctypes-utils.jsm");
function libc_defines(lib) {
this.FILE = ctypes.StructType("FILE");

View File

@ -12,9 +12,9 @@ const Cc = Components.classes;
const Ci = Components.interfaces;
Cu.import("resource://gre/modules/ctypes.jsm");
Cu.import("resource://moztray/ctypes-utils.jsm");
Cu.import("resource://moztray/cairo.jsm");
Cu.import("resource://moztray/gobject.jsm");
Cu.import("resource://firetray/ctypes-utils.jsm");
Cu.import("resource://firetray/cairo.jsm");
Cu.import("resource://firetray/gobject.jsm");
function pango_defines(lib) {
this.PANGO_WEIGHT_THIN = 100,