mirror of
https://github.com/moparisthebest/FireTray
synced 2025-01-08 12:08:05 -05:00
* Linux: add debug for icon theme search path.
* Logging: fix superfluous newline, and expose Log module. The additional newline was introduced by Log.jsm in FF32 (see https://bugzilla.mozilla.org/show_bug.cgi?id=966674).
This commit is contained in:
parent
0fee978ec3
commit
a0c0061cd6
@ -16,6 +16,8 @@ function glib_defines(lib) {
|
|||||||
/* mutual inclusion not possible */
|
/* mutual inclusion not possible */
|
||||||
this.GQuark = ctypes.uint32_t; // this.GQuark = gobject.guint32;
|
this.GQuark = ctypes.uint32_t; // this.GQuark = gobject.guint32;
|
||||||
this.GError = ctypes.StructType("GError");
|
this.GError = ctypes.StructType("GError");
|
||||||
|
|
||||||
|
lib.lazy_bind("g_strfreev", ctypes.void_t, ctypes.char.ptr.ptr);
|
||||||
};
|
};
|
||||||
|
|
||||||
new ctypes_library(GLIB_LIBNAME, GLIB_ABIS, glib_defines, this);
|
new ctypes_library(GLIB_LIBNAME, GLIB_ABIS, glib_defines, this);
|
||||||
|
@ -101,6 +101,7 @@ function gtk_defines(lib) {
|
|||||||
|
|
||||||
lib.lazy_bind("gtk_icon_theme_get_default", this.GtkIconTheme.ptr);
|
lib.lazy_bind("gtk_icon_theme_get_default", this.GtkIconTheme.ptr);
|
||||||
lib.lazy_bind("gtk_icon_theme_get_for_screen", this.GtkIconTheme.ptr, gdk.GdkScreen.ptr);
|
lib.lazy_bind("gtk_icon_theme_get_for_screen", this.GtkIconTheme.ptr, gdk.GdkScreen.ptr);
|
||||||
|
lib.lazy_bind("gtk_icon_theme_get_search_path", ctypes.void_t, this.GtkIconTheme.ptr, gobject.gchar.ptr.ptr.array(), gobject.gint.ptr);
|
||||||
lib.lazy_bind("gtk_icon_theme_append_search_path", ctypes.void_t, this.GtkIconTheme.ptr, gobject.gchar.ptr);
|
lib.lazy_bind("gtk_icon_theme_append_search_path", ctypes.void_t, this.GtkIconTheme.ptr, gobject.gchar.ptr);
|
||||||
lib.lazy_bind("gtk_icon_theme_prepend_search_path", ctypes.void_t, this.GtkIconTheme.ptr, gobject.gchar.ptr);
|
lib.lazy_bind("gtk_icon_theme_prepend_search_path", ctypes.void_t, this.GtkIconTheme.ptr, gobject.gchar.ptr);
|
||||||
lib.lazy_bind("gtk_icon_theme_choose_icon", this.GtkIconInfo.ptr, this.GtkIconTheme.ptr, gobject.gchar.ptr.array(), gobject.gint, this.GtkIconLookupFlags);
|
lib.lazy_bind("gtk_icon_theme_choose_icon", this.GtkIconInfo.ptr, this.GtkIconTheme.ptr, gobject.gchar.ptr.array(), gobject.gint, this.GtkIconLookupFlags);
|
||||||
|
@ -44,6 +44,23 @@ firetray.GtkIcons = {
|
|||||||
let gtkIconTheme = gtk.gtk_icon_theme_get_default();
|
let gtkIconTheme = gtk.gtk_icon_theme_get_default();
|
||||||
log.debug("gtkIconTheme="+gtkIconTheme);
|
log.debug("gtkIconTheme="+gtkIconTheme);
|
||||||
gtk.gtk_icon_theme_append_search_path(gtkIconTheme, this.GTK_THEME_ICON_PATH);
|
gtk.gtk_icon_theme_append_search_path(gtkIconTheme, this.GTK_THEME_ICON_PATH);
|
||||||
|
|
||||||
|
if (log.level <= firetray.Logging.LogMod.Level.Debug) {
|
||||||
|
Cu.import("resource://firetray/ctypes/linux/glib.jsm");
|
||||||
|
Cu.import("resource://firetray/ctypes/linux/gobject.jsm");
|
||||||
|
firetray.Handler.subscribeLibsForClosing([glib, gobject]);
|
||||||
|
let path = new gobject.gchar.ptr.ptr;
|
||||||
|
let n_elements = new gobject.gint;
|
||||||
|
gtk.gtk_icon_theme_get_search_path(gtkIconTheme, path.address(), n_elements.address());
|
||||||
|
log.debug("n_elements="+n_elements+" path="+path);
|
||||||
|
let pathIt = path;
|
||||||
|
for (let i=0, len=n_elements.value; i<len || pathIt.isNull(); ++i) {
|
||||||
|
log.debug("path["+i+"]="+pathIt.contents.readString());
|
||||||
|
pathIt = pathIt.increment();
|
||||||
|
}
|
||||||
|
log.debug("path="+path+" pathIt="+pathIt);
|
||||||
|
glib.g_strfreev(path);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -335,7 +335,7 @@ BasicFormatter.prototype = Object.create(Formatter.prototype);
|
|||||||
BasicFormatter.prototype.constructor = BasicFormatter;
|
BasicFormatter.prototype.constructor = BasicFormatter;
|
||||||
BasicFormatter.prototype.format = function BF_format(message) {
|
BasicFormatter.prototype.format = function BF_format(message) {
|
||||||
return message.time + "\t" + message.loggerName + "\t" + message.levelDesc
|
return message.time + "\t" + message.loggerName + "\t" + message.levelDesc
|
||||||
+ "\t" + message.message + "\n";
|
+ "\t" + message.message;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -373,7 +373,7 @@ function DumpAppender(formatter) {
|
|||||||
DumpAppender.prototype = Object.create(Appender.prototype);
|
DumpAppender.prototype = Object.create(Appender.prototype);
|
||||||
DumpAppender.prototype.constructor = DumpAppender;
|
DumpAppender.prototype.constructor = DumpAppender;
|
||||||
DumpAppender.prototype.doAppend = function DApp_doAppend(message) {
|
DumpAppender.prototype.doAppend = function DApp_doAppend(message) {
|
||||||
dump(message);
|
dump(message + "\n");
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -47,11 +47,11 @@ var colorTermLogColors = {
|
|||||||
if ("undefined" == typeof(firetray)) {
|
if ("undefined" == typeof(firetray)) {
|
||||||
var firetray = {};
|
var firetray = {};
|
||||||
};
|
};
|
||||||
var LogMod;
|
|
||||||
|
|
||||||
// https://wiki.mozilla.org/Labs/JS_Modules#Logging
|
// https://wiki.mozilla.org/Labs/JS_Modules#Logging
|
||||||
firetray.Logging = {
|
firetray.Logging = {
|
||||||
initialized: false,
|
initialized: false,
|
||||||
|
LogMod: null,
|
||||||
|
|
||||||
init: function() {
|
init: function() {
|
||||||
if (this.initialized) return;
|
if (this.initialized) return;
|
||||||
@ -65,9 +65,9 @@ firetray.Logging = {
|
|||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
if ("undefined" != typeof(Log)) {
|
if ("undefined" != typeof(Log)) {
|
||||||
LogMod = Log;
|
this.LogMod = Log;
|
||||||
} else if ("undefined" != typeof(Log4Moz)) {
|
} else if ("undefined" != typeof(Log4Moz)) {
|
||||||
LogMod = Log4Moz;
|
this.LogMod = Log4Moz;
|
||||||
} else {
|
} else {
|
||||||
let errMsg = "Log module not found";
|
let errMsg = "Log module not found";
|
||||||
dump(errMsg+"\n");
|
dump(errMsg+"\n");
|
||||||
@ -85,8 +85,8 @@ firetray.Logging = {
|
|||||||
setupLogging: function(loggerName) {
|
setupLogging: function(loggerName) {
|
||||||
|
|
||||||
// lifted from log4moz.js
|
// lifted from log4moz.js
|
||||||
function SimpleFormatter() {LogMod.Formatter.call(this);}
|
function SimpleFormatter() {firetray.Logging.LogMod.Formatter.call(this);}
|
||||||
SimpleFormatter.prototype = Object.create(LogMod.Formatter.prototype);
|
SimpleFormatter.prototype = Object.create(firetray.Logging.LogMod.Formatter.prototype);
|
||||||
SimpleFormatter.prototype.constructor = SimpleFormatter;
|
SimpleFormatter.prototype.constructor = SimpleFormatter;
|
||||||
SimpleFormatter.prototype.format = function(message) {
|
SimpleFormatter.prototype.format = function(message) {
|
||||||
let messageString = "";
|
let messageString = "";
|
||||||
@ -104,7 +104,7 @@ firetray.Logging = {
|
|||||||
date.getSeconds() + "." + date.getMilliseconds();
|
date.getSeconds() + "." + date.getMilliseconds();
|
||||||
let stringLog = dateStr + " " +
|
let stringLog = dateStr + " " +
|
||||||
message.levelDesc + " " + message.loggerName + " " +
|
message.levelDesc + " " + message.loggerName + " " +
|
||||||
messageString + "\n";
|
messageString;
|
||||||
|
|
||||||
if (message.exception)
|
if (message.exception)
|
||||||
stringLog += message.stackTrace + "\n";
|
stringLog += message.stackTrace + "\n";
|
||||||
@ -124,14 +124,14 @@ firetray.Logging = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Loggers are hierarchical, affiliation is handled by a '.' in the name.
|
// Loggers are hierarchical, affiliation is handled by a '.' in the name.
|
||||||
this._logger = LogMod.repository.getLogger(loggerName);
|
this._logger = this.LogMod.repository.getLogger(loggerName);
|
||||||
// Lowering this log level will affect all of our addon output
|
// Lowering this log level will affect all of our addon output
|
||||||
this._logger.level = LogMod.Level[FIRETRAY_LOG_LEVEL];
|
this._logger.level = this.LogMod.Level[FIRETRAY_LOG_LEVEL];
|
||||||
|
|
||||||
// A console appender outputs to the JS Error Console
|
// A console appender outputs to the JS Error Console
|
||||||
let simpleFormatter = new SimpleFormatter();
|
let simpleFormatter = new SimpleFormatter();
|
||||||
let capp = new LogMod.ConsoleAppender(simpleFormatter);
|
let capp = new this.LogMod.ConsoleAppender(simpleFormatter);
|
||||||
capp.level = LogMod.Level["Debug"];
|
capp.level = this.LogMod.Level["Debug"];
|
||||||
this._logger.addAppender(capp);
|
this._logger.addAppender(capp);
|
||||||
|
|
||||||
// A dump appender outputs to standard out
|
// A dump appender outputs to standard out
|
||||||
@ -141,13 +141,13 @@ firetray.Logging = {
|
|||||||
} else {
|
} else {
|
||||||
dumpFormatter = new SimpleFormatter();
|
dumpFormatter = new SimpleFormatter();
|
||||||
}
|
}
|
||||||
let dapp = new LogMod.DumpAppender(dumpFormatter);
|
let dapp = new this.LogMod.DumpAppender(dumpFormatter);
|
||||||
dapp.level = LogMod.Level["Debug"];
|
dapp.level = this.LogMod.Level["Debug"];
|
||||||
this._logger.addAppender(dapp);
|
this._logger.addAppender(dapp);
|
||||||
},
|
},
|
||||||
|
|
||||||
getLogger: function(loggerName){
|
getLogger: function(loggerName){
|
||||||
return LogMod.repository.getLogger(loggerName);
|
return this.LogMod.repository.getLogger(loggerName);
|
||||||
}
|
}
|
||||||
|
|
||||||
}; // firetray.Logging
|
}; // firetray.Logging
|
||||||
|
Loading…
Reference in New Issue
Block a user