1
0
mirror of https://github.com/moparisthebest/FireTray synced 2024-12-21 21:48:47 -05:00

try supporting more applications (Firefox, Thunderbird for now)

export 'Cc' and 'Ci' in common.js module. This helps managing the different
behaviours in FF and TB: TB requires Ci and Cc to be defined explicitly in
overlay.js, and FF fails to load overlay.js silently when Ci and Cc are defined
explicitly (const defined twice ?)...
This commit is contained in:
foudfou 2011-07-06 02:32:21 +02:00
parent 0d25df1d17
commit fded2c2a31
6 changed files with 54 additions and 37 deletions

View File

@ -10,7 +10,8 @@ help:
@echo " DEBUG=on make all"
@echo
@echo "to create the dev profile:"
@echo " firefox -no-remote -P # then create '$(profile_dir)'"
@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"
@ -18,6 +19,7 @@ help:
@echo
@echo "to test with dev profile:"
@echo " firefox -no-remote -P mozilla-dev"
@echo " thunderbird -no-remote -P mozilla-dev"
@echo
@echo "Have fun !"
@ -25,7 +27,7 @@ help:
extension_uuid := moztray@foudil.fr
# The name of the profile dir where the extension can be installed.
profile_dir := mozilla-dev
profile_id := mozilla-dev
# The zip application to be used.
ZIP := zip
@ -33,24 +35,10 @@ ZIP := zip
# The target location of the build and build files.
build_dir := ../build
# The type of operating system this make command is running on.
# os_type := $(patsubst darwin%,darwin,$(shell echo $(OSTYPE)))
# we don't want to: export OSTYPE; make install
os_type := $(patsubst darwin%,darwin,$(shell echo $$OSTYPE))
# The location of the extension profile.
ifeq ($(os_type), darwin)
profile_location := \
~/Library/Application\ Support/Firefox/Profiles/$(profile_dir)/extensions
else
ifeq ($(os_type), linux-gnu)
profile_location := \
~/.mozilla/firefox/$(profile_dir)/extensions
else
profile_location := \
"$(subst \,\\,$(APPDATA))\\Mozilla\\Firefox\\Profiles\\$(profile_dir)\\extensions"
endif
endif
# The location of the extension profile. (this extension is intended for Linux only)
profile_locations := \
~/.mozilla/firefox/$(profile_id)/extensions \
~/.thunderbird/$(profile_id)/extensions
# The license file
license := LICENSE
@ -128,9 +116,11 @@ clean: clean_build clean_profile
# 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_location)
@echo "Installing in profile folder: $(profile_location)"
@cp -f $(xpi_built) $(profile_location)/$(xpi_deployed)
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
@ -151,7 +141,7 @@ $(build_dir)/$(chrome_source_root)/%.js: $(chrome_source_root)/%.js
cp -f $< $@; \
else \
echo "Stripping comments from JS file $<"; \
sed '/moztray\.Debug\.dump/d' $< > $@; \
sed '/mozt\.Debug\.dump/d' $< > $@; \
fi
$(build_dir)/$(modules_dir)/commons.js: $(modules_dir)/commons.js
@ -170,17 +160,21 @@ $(build_dir):
mkdir -p $(build_dir); \
fi
$(profile_location):
@echo "Creating extension folder: $(profile_location)"
@if [ ! -x $(profile_location) ]; \
$(profile_locations):
@echo "Creating extension folder: $(profile_locations)"
@for p in $(profile_locations) ; do \
if [ ! -x "$$p" ]; \
then \
mkdir -p $(profile_location); \
fi
mkdir -p $$p; \
fi; \
done
clean_build:
@echo "Removing build dir: $(build_dir)"
@rm -rf $(build_dir)
clean_profile:
@echo "Removing extension from extension folder: $(profile_location)"
@rm -f $(profile_location)/$(xpi_deployed)
@echo "Removing extension from extension folders: $(profile_locations)"
@for p in $(profile_locations) ; do \
rm -f $$p/$(xpi_deployed); \
done

View File

@ -3,4 +3,9 @@ skin moztray classic/1.0 chrome/skin/
locale moztray en-US chrome/locale/en-US/
resource moztray modules/
overlay chrome://browser/content/browser.xul chrome://moztray/content/overlay.xul
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/songOverlay.xul
overlay chrome://sunbird/content/calendar.xul chrome://moztray/content/mailOverlay.xul
overlay chrome://navigator/content/navigator.xul chrome://moztray/content/navigatorOverlay.xul
overlay chrome://chatzilla/content/chatzilla.xul chrome://moztray/content/ircOverlay.xul

View File

@ -4,13 +4,11 @@ Components.utils.import("resource://moztray/commons.js");
Components.utils.import("resource://moztray/LibGtkStatusIcon.js");
const MOZT_ICON_DIR = "chrome/skin/";
const MOZT_ICON_FIREFOX = "firefox32.png";
const MOZT_ICON_SUFFIX = "32.png";
mozt.Main = {
onLoad: function() {
mozt.Debug.dump('Moztray GO !');
// initialization code
this.initialized = null;
this.strings = document.getElementById("moztray-strings");
@ -27,7 +25,8 @@ mozt.Main = {
LibGtkStatusIcon.init();
this.tray_icon = LibGtkStatusIcon.gtk_status_icon_new();
var icon_filename = MOZT_ICON_DIR + MOZT_ICON_FIREFOX;
var mozApp = mozt.Utils.appInfoService.name.toLowerCase();
var icon_filename = MOZT_ICON_DIR + mozApp + MOZT_ICON_SUFFIX;
LibGtkStatusIcon.gtk_status_icon_set_from_file(this.tray_icon,
icon_filename);

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@ -12,6 +12,7 @@
<em:description>A system tray extension for linux.</em:description>
<!-- <em:optionsURL>chrome://moztray/content/options.xul</em:optionsURL> -->
<em:iconURL>chrome://moztray/skin/icon32.png</em:iconURL>
<em:targetApplication>
<Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id> <!-- Firefox -->
@ -19,5 +20,14 @@
<em:maxVersion>6.*</em:maxVersion>
</Description>
</em:targetApplication>
<em:targetApplication> <!-- Thunderbird -->
<Description>
<em:id>{3550f703-e582-4d05-9a08-453d09bdfdc6}</em:id>
<em:minVersion>3.0</em:minVersion>
<em:maxVersion>5.*</em:maxVersion>
</Description>
</em:targetApplication>
</Description>
</RDF>

View File

@ -6,11 +6,18 @@
* http://developer.mozilla.org/en/XUL_School/JavaScript_Object_Management.html
*/
var EXPORTED_SYMBOLS = [ "mozt" ];
var EXPORTED_SYMBOLS = [ "mozt", "Cc", "Ci" ];
const Cc = Components.classes;
const Ci = Components.interfaces;
const FIREFOX_ID = "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}";
const THUNDERBIRD_ID = "{3550f703-e582-4d05-9a08-453d09bdfdc6}";
const SONGBIRD_ID = "songbird@songbirdnest.com";
const SUNBIRD_ID = "{718e30fb-e89b-41dd-9da7-e25a45638b28}";
const SEAMONKEY_ID = "{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}";
const CHATZILLA_ID = "{59c81df5-4b7a-477b-912d-4e0fdf64e5f2}";
/**
* mozt namespace.
*/
@ -67,4 +74,6 @@ mozt.Utils = {
prefService: Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefService)
.getBranch("extensions.moztray."),
appInfoService: Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULAppInfo), // appInfoService.name.toLower
};