mirror of
https://github.com/moparisthebest/FireTray
synced 2025-03-11 06:50:18 -04:00
display IM icon when IM enabled
This commit is contained in:
parent
6f95421a2f
commit
ceba669bcd
@ -89,4 +89,4 @@ Acknowledgment
|
||||
[Nils Maier](https://addons.mozilla.org/fr/firefox/addon/minimizetotray-revived/
|
||||
"MinToTrayR addon page").
|
||||
* kind support from Neil Deaking, Bobby Holley
|
||||
|
||||
* default icons borrowed from Mozilla and Pidgin
|
||||
|
@ -0,0 +1 @@
|
||||
../../../../../pidgin-tray-available.png
|
1
src/chrome/skin/linux/icons/gnome/22x22/status/user-away.png
Symbolic link
1
src/chrome/skin/linux/icons/gnome/22x22/status/user-away.png
Symbolic link
@ -0,0 +1 @@
|
||||
../../../../../pidgin-tray-away.png
|
1
src/chrome/skin/linux/icons/gnome/22x22/status/user-busy.png
Symbolic link
1
src/chrome/skin/linux/icons/gnome/22x22/status/user-busy.png
Symbolic link
@ -0,0 +1 @@
|
||||
../../../../../pidgin-tray-busy.png
|
1
src/chrome/skin/linux/icons/gnome/22x22/status/user-offline.png
Symbolic link
1
src/chrome/skin/linux/icons/gnome/22x22/status/user-offline.png
Symbolic link
@ -0,0 +1 @@
|
||||
../../../../../pidgin-tray-offline.png
|
BIN
src/chrome/skin/pidgin-tray-available.png
Normal file
BIN
src/chrome/skin/pidgin-tray-available.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
BIN
src/chrome/skin/pidgin-tray-away.png
Normal file
BIN
src/chrome/skin/pidgin-tray-away.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
BIN
src/chrome/skin/pidgin-tray-busy.png
Normal file
BIN
src/chrome/skin/pidgin-tray-busy.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
BIN
src/chrome/skin/pidgin-tray-offline.png
Normal file
BIN
src/chrome/skin/pidgin-tray-offline.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
@ -7,6 +7,7 @@ const Ci = Components.interfaces;
|
||||
const Cu = Components.utils;
|
||||
|
||||
Cu.import("resource://firetray/commons.js");
|
||||
Cu.import("resource://firetray/linux/FiretrayIMStatusIcon.jsm");
|
||||
|
||||
firetray.InstantMessaging = {
|
||||
initialized: false,
|
||||
@ -26,6 +27,8 @@ firetray.InstantMessaging = {
|
||||
"visited-status-resolution"
|
||||
]);
|
||||
|
||||
firetray.IMStatusIcon.init();
|
||||
|
||||
this.initialized = true;
|
||||
},
|
||||
|
||||
@ -33,6 +36,8 @@ firetray.InstantMessaging = {
|
||||
if (!this.initialized) return;
|
||||
F.LOG("Disabling InstantMessaging");
|
||||
|
||||
firetray.IMStatusIcon.shutdown();
|
||||
|
||||
firetray.Utils.removeAllObservers(firetray.InstantMessaging);
|
||||
|
||||
this.initialized = false;
|
||||
|
@ -54,10 +54,8 @@ firetray.Messaging = {
|
||||
F.LOG("Disabling Messaging");
|
||||
|
||||
firetray.InstantMessaging.shutdown();
|
||||
F.LOG("HI THERE");
|
||||
|
||||
MailServices.mailSession.RemoveFolderListener(this.mailSessionListener);
|
||||
firetray.Handler.setIconImageDefault();
|
||||
|
||||
firetray.Utils.removeAllObservers(firetray.Messaging);
|
||||
|
||||
|
@ -16,6 +16,7 @@ function gio_defines(lib) {
|
||||
this.GIcon = ctypes.StructType("GIcon");
|
||||
this.GThemedIcon = ctypes.StructType("GThemedIcon");
|
||||
|
||||
lib.lazy_bind("g_themed_icon_new", this.GIcon.ptr, ctypes.char.ptr);
|
||||
lib.lazy_bind("g_themed_icon_new_from_names", this.GIcon.ptr, ctypes.char.ptr.ptr, ctypes.int);
|
||||
|
||||
}
|
||||
|
65
src/modules/linux/FiretrayIMStatusIcon.jsm
Normal file
65
src/modules/linux/FiretrayIMStatusIcon.jsm
Normal file
@ -0,0 +1,65 @@
|
||||
/* -*- Mode: js2; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
|
||||
var EXPORTED_SYMBOLS = [ "firetray" ];
|
||||
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
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://firetray/ctypes/linux/gobject.jsm");
|
||||
Cu.import("resource://firetray/ctypes/linux/gio.jsm");
|
||||
Cu.import("resource://firetray/ctypes/linux/gtk.jsm");
|
||||
Cu.import("resource://firetray/commons.js");
|
||||
|
||||
if ("undefined" == typeof(firetray.Handler))
|
||||
F.ERROR("This module MUST be imported from/after FiretrayHandler !");
|
||||
|
||||
|
||||
firetray.IMStatusIcon = {
|
||||
GTK_THEME_ICON_PATH: null,
|
||||
|
||||
initialized: false,
|
||||
trayIcon: null,
|
||||
themedIcons: {
|
||||
"user-available": null,
|
||||
"user-away": null,
|
||||
"user-busy": null,
|
||||
"user-offline": null
|
||||
},
|
||||
|
||||
init: function() {
|
||||
if (!firetray.Handler.inMailApp) throw "IMStatusIcon for mail app only";
|
||||
if (!firetray.GtkIcons.initialized) throw "GtkIcons should have been initialized by StatusIcon";
|
||||
|
||||
this.trayIcon = gtk.gtk_status_icon_new();
|
||||
this.loadThemedIcons();
|
||||
this.setIconImageFromGIcon(this.themedIcons["user-offline"]);
|
||||
|
||||
this.initialized = true;
|
||||
return true;
|
||||
},
|
||||
|
||||
shutdown: function() {
|
||||
gtk.gtk_status_icon_set_visible(this.trayIcon, false);
|
||||
// FIXME: tryCloseLibs should be done by Handler only, submodules should
|
||||
// just pass the imported ctypes modules to it
|
||||
// firetray.Utils.tryCloseLibs([gobject, gio, gtk]);
|
||||
this.initialized = false;
|
||||
},
|
||||
|
||||
loadThemedIcons: function() {
|
||||
for (let name in this.themedIcons)
|
||||
this.themedIcons[name] = gio.g_themed_icon_new(name);
|
||||
},
|
||||
|
||||
setIconImageFromGIcon: function(gicon) {
|
||||
if (!firetray.IMStatusIcon.trayIcon || !gicon)
|
||||
F.ERROR("Icon missing");
|
||||
F.LOG(gicon);
|
||||
gtk.gtk_status_icon_set_from_gicon(firetray.IMStatusIcon.trayIcon, gicon);
|
||||
}
|
||||
|
||||
}; // firetray.IMStatusIcon
|
@ -61,6 +61,7 @@ firetray.StatusIcon = {
|
||||
shutdown: function() {
|
||||
F.LOG("Disabling StatusIcon");
|
||||
firetray.PopupMenu.shutdown();
|
||||
// FIXME: should destroy/hide icon here
|
||||
firetray.GtkIcons.shutdown();
|
||||
firetray.Utils.tryCloseLibs([cairo, gobject, gdk, gio, gtk, pango, pangocairo]);
|
||||
this.initialized = false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user