[Pkg-mozext-commits] [firetray] 391/399: add preferences item to popup menu

David Prévot taffit at alioth.debian.org
Tue Oct 29 18:24:20 UTC 2013


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch dfsg-clean
in repository firetray.

commit c96ff01ebd9c9a7d20a0537b1a22a78cf028aec7
Author: foudfou <foudil.newbie+git at gmail.com>
Date:   Fri Oct 25 17:49:01 2013 +0200

    add preferences item to popup menu
---
 src/chrome/locale/en-US/overlay.properties |    1 +
 src/modules/FiretrayHandler.jsm            |   17 +++++++++++++++--
 src/modules/linux/FiretrayPopupMenu.jsm    |    9 +++++++--
 3 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/src/chrome/locale/en-US/overlay.properties b/src/chrome/locale/en-US/overlay.properties
index 8336891..fd3b3e0 100644
--- a/src/chrome/locale/en-US/overlay.properties
+++ b/src/chrome/locale/en-US/overlay.properties
@@ -1,5 +1,6 @@
 extensions.{9533f794-00b4-4354-aa15-c2bbda6989f8}.description=A system tray extension for linux.
 popupMenu.itemLabel.ResetIcon=Reset icon
+popupMenu.itemLabel.Preferences=Preferences
 popupMenu.itemLabel.Quit=Quit
 popupMenu.itemLabel.NewWindow=New window
 popupMenu.itemLabel.NewMessage=New message
diff --git a/src/modules/FiretrayHandler.jsm b/src/modules/FiretrayHandler.jsm
index eddd65d..430c0b8 100644
--- a/src/modules/FiretrayHandler.jsm
+++ b/src/modules/FiretrayHandler.jsm
@@ -392,6 +392,19 @@ firetray.Handler = {
     return url;
   },
 
+  openPrefWindow: function() {
+    if (null == firetray.Handler._preferencesWindow ||
+        firetray.Handler._preferencesWindow.closed) {
+      for(var first in firetray.Handler.windows) break;
+      firetray.Handler._preferencesWindow =
+        firetray.Handler.windows[first].chromeWin.openDialog(
+          "chrome://firetray/content/options.xul", null,
+          "chrome,titlebar,toolbar,centerscreen", null);
+    }
+
+    firetray.Handler._preferencesWindow.focus();
+  },
+
   openBrowserWindow: function() {
     try {
       var home = firetray.Handler._getHomePage();
@@ -402,8 +415,8 @@ firetray.Handler = {
       firetray.Handler.timers['open-browser-window'] =
         firetray.Utils.timer(FIRETRAY_DELAY_NOWAIT_MILLISECONDS,
           Ci.nsITimer.TYPE_ONE_SHOT, function() {
-            for(var key in firetray.Handler.windows) break;
-            firetray.Handler.windows[key].chromeWin.open(home);
+            for(var first in firetray.Handler.windows) break;
+            firetray.Handler.windows[first].chromeWin.open(home);
           });
     } catch (x) { log.error(x); }
   },
diff --git a/src/modules/linux/FiretrayPopupMenu.jsm b/src/modules/linux/FiretrayPopupMenu.jsm
index 6f601bc..36a481a 100644
--- a/src/modules/linux/FiretrayPopupMenu.jsm
+++ b/src/modules/linux/FiretrayPopupMenu.jsm
@@ -43,11 +43,16 @@ firetray.PopupMenu = {
       addMenuSeparator = true;
     }
 
+    var menuSeparator;
     if (addMenuSeparator) {
-      var menuSeparator = gtk.gtk_separator_menu_item_new();
+      menuSeparator = gtk.gtk_separator_menu_item_new();
       gtk.gtk_menu_shell_append(this.menuShell, ctypes.cast(menuSeparator, gtk.GtkWidget.ptr));
     }
 
+    this.addItem("Preferences", "gtk-preferences", "activate", firetray.Handler.openPrefWindow);
+    menuSeparator = gtk.gtk_separator_menu_item_new();
+    gtk.gtk_menu_shell_append(this.menuShell, ctypes.cast(menuSeparator, gtk.GtkWidget.ptr));
+
     this.addItem("Quit", "gtk-quit", "activate", firetray.Handler.quitApplication);
 
     var menuWidget = ctypes.cast(this.menu, gtk.GtkWidget.ptr);
@@ -67,7 +72,7 @@ firetray.PopupMenu = {
   },
 
   addItem: function(itemName, iconName, action, callback) {
-		var menuItemLabel = firetray.Utils.strings.GetStringFromName("popupMenu.itemLabel."+itemName); // shouldn't need to convert to utf8 later thank to js-ctypes
+    var menuItemLabel = firetray.Utils.strings.GetStringFromName("popupMenu.itemLabel."+itemName); // shouldn't need to convert to utf8 later thank to js-ctypes
     var menuItem = gtk.gtk_image_menu_item_new_with_label(menuItemLabel);
     var menuItemIcon = gtk.gtk_image_new_from_stock(iconName, gtk.GTK_ICON_SIZE_MENU);
     gtk.gtk_image_menu_item_set_image(menuItem, menuItemIcon);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/firetray.git



More information about the Pkg-mozext-commits mailing list