From 8d0917ab628f5f8fe615e4f8fdb126f804efd2ca Mon Sep 17 00:00:00 2001 From: foudfou Date: Sat, 21 Apr 2012 16:15:43 +0200 Subject: [PATCH 1/2] fix cleanExcludedAccounts() --- src/modules/FiretrayMessaging.jsm | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/modules/FiretrayMessaging.jsm b/src/modules/FiretrayMessaging.jsm index a4687db..f7dddb8 100644 --- a/src/modules/FiretrayMessaging.jsm +++ b/src/modules/FiretrayMessaging.jsm @@ -61,7 +61,6 @@ firetray.Messaging = { /* removes removed accounts from excludedAccounts pref. NOTE: Can't be called at shutdown because MailServices.accounts no longer available */ cleanExcludedAccounts: function() { - try { F.LOG("* cleaning *"); let mailAccounts = firetray.Utils.getObjPref('mail_accounts'); let excludedAccounts = mailAccounts["excludedAccounts"]; @@ -71,12 +70,12 @@ firetray.Messaging = { let accountServerKeys = []; for (let i=0, len=accounts.Count(); i= 0) newExcludedAccounts.push(excludedAccount); else @@ -88,7 +87,6 @@ firetray.Messaging = { let prefObj = {"serverTypes":mailAccounts["serverTypes"], "excludedAccounts":newExcludedAccounts}; firetray.Utils.setObjPref('mail_accounts', prefObj); } - } catch(x) { F.ERROR(x); } }, /* http://mxr.mozilla.org/comm-central/source/mailnews/base/public/nsIFolderListener.idl */ From f86a3ac7942a5bd2d0d48d6254ca5420e902d67f Mon Sep 17 00:00:00 2001 From: foudfou Date: Mon, 23 Apr 2012 00:32:01 +0200 Subject: [PATCH 2/2] use Gtk gtk_widget_show/hide instead of Moz BaseWindow.visibility. This ensures Thunderbird to be shown, when launched from the command line, while already running. NOTE: gdk_window_show/hide also works, but we'd lose the ability to resize and move the windows before showing it when restoring. --- src/modules/ctypes/linux/gtk.jsm | 2 +- src/modules/linux/FiretrayWindow.jsm | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/modules/ctypes/linux/gtk.jsm b/src/modules/ctypes/linux/gtk.jsm index 2ae8d3b..5dfd936 100644 --- a/src/modules/ctypes/linux/gtk.jsm +++ b/src/modules/ctypes/linux/gtk.jsm @@ -93,7 +93,6 @@ function gtk_defines(lib) { lib.lazy_bind("gtk_image_menu_item_set_image", ctypes.void_t, this.GtkImageMenuItem.ptr, this.GtkWidget.ptr); lib.lazy_bind("gtk_menu_shell_append", ctypes.void_t, this.GtkMenuShell.ptr, this.GtkWidget.ptr); lib.lazy_bind("gtk_menu_shell_prepend", ctypes.void_t, this.GtkMenuShell.ptr, this.GtkWidget.ptr); - lib.lazy_bind("gtk_widget_show_all", ctypes.void_t, this.GtkWidget.ptr); lib.lazy_bind("gtk_menu_popup", ctypes.void_t, this.GtkMenu.ptr, this.GtkWidget.ptr, this.GtkWidget.ptr, this.GtkMenuPositionFunc_t, gobject.gpointer, gobject.guint, gobject.guint); lib.lazy_bind("gtk_status_icon_position_menu", ctypes.void_t, this.GtkMenu.ptr, gobject.gint.ptr, gobject.gint.ptr, gobject.gboolean.ptr, gobject.gpointer); lib.lazy_bind("gtk_separator_menu_item_new", this.GtkWidget.ptr); @@ -113,6 +112,7 @@ function gtk_defines(lib) { lib.lazy_bind("gtk_widget_hide_on_delete", gobject.gboolean, this.GtkWidget.ptr); lib.lazy_bind("gtk_widget_hide", ctypes.void_t, this.GtkWidget.ptr); lib.lazy_bind("gtk_widget_show", ctypes.void_t, this.GtkWidget.ptr); + lib.lazy_bind("gtk_widget_show_all", ctypes.void_t, this.GtkWidget.ptr); lib.lazy_bind("gtk_widget_get_events", gobject.gint, this.GtkWidget.ptr); lib.lazy_bind("gtk_widget_get_events", gobject.gint, this.GtkWidget.ptr); lib.lazy_bind("gtk_widget_add_events", ctypes.void_t, this.GtkWidget.ptr, gobject.gint); diff --git a/src/modules/linux/FiretrayWindow.jsm b/src/modules/linux/FiretrayWindow.jsm index aed2507..9229851 100644 --- a/src/modules/linux/FiretrayWindow.jsm +++ b/src/modules/linux/FiretrayWindow.jsm @@ -320,7 +320,12 @@ firetray.Window = { }, setVisibility: function(xid, visibility) { - firetray.Handler.windows[xid].baseWin.visibility = visibility; + let gtkWidget = ctypes.cast(firetray.Handler.gtkWindows.get(xid), gtk.GtkWidget.ptr); + if (visibility) + gtk.gtk_widget_show_all(gtkWidget); + else + gtk.gtk_widget_hide(gtkWidget); + firetray.Handler.windows[xid].visibility = visibility; firetray.Handler.visibleWindowsCount = visibility ? firetray.Handler.visibleWindowsCount + 1 :