tags 433491 +patch
thanks

The attached patch adds a "Show preferences" option to the context menu
for the tray icon. It appears to work correctly, but I'm not exactly an
expert on the mozilla codebase and I'd appreciate a test. I've not yet
removed the "hide icon" option, I'll wait until I've got a fuller patch
ready, but that's pretty easy to do.

Alan
#! /bin/sh /usr/share/dpatch/dpatch-run
## 21_prefs_context.dpatch by  <[EMAIL PROTECTED]>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: No description.

@DPATCH@
diff -urNad 
mozilla-traybiff-1.2.3~/chrome/locale/cs-CZ/traybiff/traybiff.properties 
mozilla-traybiff-1.2.3/chrome/locale/cs-CZ/traybiff/traybiff.properties
--- mozilla-traybiff-1.2.3~/chrome/locale/cs-CZ/traybiff/traybiff.properties    
2007-07-18 01:06:41.000000000 +0100
+++ mozilla-traybiff-1.2.3/chrome/locale/cs-CZ/traybiff/traybiff.properties     
2007-07-18 01:07:14.000000000 +0100
@@ -3,3 +3,4 @@
 trayMenu_NewWindow=Nové okno
 trayMenu_RestoreWindow=Obnov okno
 trayMenu_HideWindow=Schovej okno
+trayMenu_ShowPref=Show Preferences
diff -urNad 
mozilla-traybiff-1.2.3~/chrome/locale/de-DE/traybiff/traybiff.properties 
mozilla-traybiff-1.2.3/chrome/locale/de-DE/traybiff/traybiff.properties
--- mozilla-traybiff-1.2.3~/chrome/locale/de-DE/traybiff/traybiff.properties    
2007-07-18 01:06:41.000000000 +0100
+++ mozilla-traybiff-1.2.3/chrome/locale/de-DE/traybiff/traybiff.properties     
2007-07-18 01:07:14.000000000 +0100
@@ -3,3 +3,4 @@
 trayMenu_NewWindow=Neues Fenster
 trayMenu_RestoreWindow=Fenster wieder herstellen
 trayMenu_HideWindow=Fenster ausblenden
+trayMenu_ShowPref=Show Preferences
diff -urNad 
mozilla-traybiff-1.2.3~/chrome/locale/en-US/traybiff/traybiff.properties 
mozilla-traybiff-1.2.3/chrome/locale/en-US/traybiff/traybiff.properties
--- mozilla-traybiff-1.2.3~/chrome/locale/en-US/traybiff/traybiff.properties    
2007-07-18 01:06:41.000000000 +0100
+++ mozilla-traybiff-1.2.3/chrome/locale/en-US/traybiff/traybiff.properties     
2007-07-18 01:07:14.000000000 +0100
@@ -3,3 +3,4 @@
 trayMenu_NewWindow=New Window
 trayMenu_RestoreWindow=Restore Window
 trayMenu_HideWindow=Hide Window
+trayMenu_ShowPref=Show Preferences
diff -urNad 
mozilla-traybiff-1.2.3~/chrome/locale/es-ES/traybiff/traybiff.properties 
mozilla-traybiff-1.2.3/chrome/locale/es-ES/traybiff/traybiff.properties
--- mozilla-traybiff-1.2.3~/chrome/locale/es-ES/traybiff/traybiff.properties    
2007-07-18 01:06:41.000000000 +0100
+++ mozilla-traybiff-1.2.3/chrome/locale/es-ES/traybiff/traybiff.properties     
2007-07-18 01:07:14.000000000 +0100
@@ -3,3 +3,4 @@
 trayMenu_NewWindow=Abrir ventana
 trayMenu_RestoreWindow=Restaurar ventana
 trayMenu_HideWindow=Esconder ventana
+trayMenu_ShowPref=Show Preferences
diff -urNad 
mozilla-traybiff-1.2.3~/chrome/locale/fr-FR/traybiff/traybiff.properties 
mozilla-traybiff-1.2.3/chrome/locale/fr-FR/traybiff/traybiff.properties
--- mozilla-traybiff-1.2.3~/chrome/locale/fr-FR/traybiff/traybiff.properties    
2007-07-18 01:06:41.000000000 +0100
+++ mozilla-traybiff-1.2.3/chrome/locale/fr-FR/traybiff/traybiff.properties     
2007-07-18 01:07:14.000000000 +0100
@@ -3,3 +3,4 @@
 trayMenu_NewWindow=Nouvelle fenêtre
 trayMenu_RestoreWindow=Restaurer la fenêtre
 trayMenu_HideWindow=Masquer la fenêtre
+trayMenu_ShowPref=Show Preferences
diff -urNad 
mozilla-traybiff-1.2.3~/chrome/locale/he-IL/traybiff/traybiff.properties 
mozilla-traybiff-1.2.3/chrome/locale/he-IL/traybiff/traybiff.properties
--- mozilla-traybiff-1.2.3~/chrome/locale/he-IL/traybiff/traybiff.properties    
2007-07-18 01:06:41.000000000 +0100
+++ mozilla-traybiff-1.2.3/chrome/locale/he-IL/traybiff/traybiff.properties     
2007-07-18 01:07:14.000000000 +0100
@@ -3,3 +3,4 @@
 trayMenu_NewWindow=New Window
 trayMenu_RestoreWindow=Restore Window
 trayMenu_HideWindow=Hide Window
+trayMenu_ShowPref=Show Preferences
diff -urNad 
mozilla-traybiff-1.2.3~/chrome/locale/it-IT/traybiff/traybiff.properties 
mozilla-traybiff-1.2.3/chrome/locale/it-IT/traybiff/traybiff.properties
--- mozilla-traybiff-1.2.3~/chrome/locale/it-IT/traybiff/traybiff.properties    
2007-07-18 01:06:41.000000000 +0100
+++ mozilla-traybiff-1.2.3/chrome/locale/it-IT/traybiff/traybiff.properties     
2007-07-18 01:07:14.000000000 +0100
@@ -3,3 +3,4 @@
 trayMenu_NewWindow=Nuova finestra
 trayMenu_RestoreWindow=Ripristina la finestra
 trayMenu_HideWindow=Nascondi la finestra
+trayMenu_ShowPref=Show Preferences
diff -urNad 
mozilla-traybiff-1.2.3~/chrome/locale/ru-RU/traybiff/traybiff.properties 
mozilla-traybiff-1.2.3/chrome/locale/ru-RU/traybiff/traybiff.properties
--- mozilla-traybiff-1.2.3~/chrome/locale/ru-RU/traybiff/traybiff.properties    
2007-07-18 01:06:41.000000000 +0100
+++ mozilla-traybiff-1.2.3/chrome/locale/ru-RU/traybiff/traybiff.properties     
2007-07-18 01:07:14.000000000 +0100
@@ -3,3 +3,4 @@
 trayMenu_NewWindow=Новое окно
 trayMenu_RestoreWindow=Восстановить окно
 trayMenu_HideWindow=Спрятать окно
+trayMenu_ShowPref=Show Preferences
diff -urNad 
mozilla-traybiff-1.2.3~/components/nsMessengerFreeDesktopIntegration.cpp 
mozilla-traybiff-1.2.3/components/nsMessengerFreeDesktopIntegration.cpp
--- mozilla-traybiff-1.2.3~/components/nsMessengerFreeDesktopIntegration.cpp    
2007-07-18 01:06:41.000000000 +0100
+++ mozilla-traybiff-1.2.3/components/nsMessengerFreeDesktopIntegration.cpp     
2007-07-18 01:09:10.000000000 +0100
@@ -939,6 +939,29 @@
        // TODO: This should ultimately popup an informational message box.
 }
 
+void nsMessengerFreeDesktopIntegration::OnActionShowPref() 
+{
+    nsCOMPtr<nsIDOMWindowInternal> domWindow;
+    
+    nsCOMPtr<nsIWindowMediator> mediator ( 
do_GetService(NS_WINDOWMEDIATOR_CONTRACTID) );
+    NS_ASSERTION(mediator, "no mediator");
+    mediator->GetMostRecentWindow(NS_LITERAL_STRING("mail:3pane").get(), 
getter_AddRefs(domWindow));
+    if (domWindow) 
+    {
+        nsIDOMWindow *newWindow;
+        nsresult rv;
+        rv = 
domWindow->OpenDialog(NS_LITERAL_STRING("chrome://traybiff/content/settings.xul"),
+                                   NS_LITERAL_STRING("Preferences"),
+                                   
NS_LITERAL_STRING("chrome,dialog,centerscreen,dependent"), 
+                                   (nsISupports*)NULL, 
+                                   &newWindow);
+                
+        if (!NS_SUCCEEDED(rv)) {
+            printf("Failed to show prefs chrome!\n");
+        }
+    }
+}
+
 void nsMessengerFreeDesktopIntegration::OnBiffChange()
 {
        if (mHasBiff)
@@ -1007,6 +1030,9 @@
        menuItemHideWindow.Assign(NS_LITERAL_STRING("Hide window"));
        nsXPIDLString menuItemHideIcon;
        menuItemHideIcon.Assign(NS_LITERAL_STRING("Hide icon"));
+       nsXPIDLString menuItemShowPref;
+       menuItemShowPref.Assign(NS_LITERAL_STRING("Show preferences"));
+       
 
        // Retrieve menu item localizations from the string bundle, if possible
        nsCOMPtr<nsIStringBundle> bundle; 
@@ -1019,6 +1045,8 @@
                
bundle->GetStringFromName(NS_LITERAL_STRING("trayMenu_RestoreWindow").get(), 
getter_Copies(menuItemRestoreWindow));
                
bundle->GetStringFromName(NS_LITERAL_STRING("trayMenu_HideWindow").get(), 
getter_Copies(menuItemHideWindow));
                
bundle->GetStringFromName(NS_LITERAL_STRING("trayMenu_HideIcon").get(), 
getter_Copies(menuItemHideIcon));
+               
bundle->GetStringFromName(NS_LITERAL_STRING("trayMenu_ShowPref").get(), 
getter_Copies(menuItemShowPref));
+               
        }
 
        if (mHasBiff)
@@ -1044,6 +1072,9 @@
        entry = 
gtk_menu_item_new_with_label(NS_ConvertUTF16toUTF8(menuItemHideIcon).get());
        g_signal_connect(G_OBJECT(entry), "activate", G_CALLBACK(MenuHideIcon), 
this);
        gtk_menu_shell_append(GTK_MENU_SHELL(pTrayMenu), entry);
+    entry = 
gtk_menu_item_new_with_label(NS_ConvertUTF16toUTF8(menuItemShowPref).get());
+       gtk_menu_shell_append(GTK_MENU_SHELL(pTrayMenu), entry);
+       g_signal_connect(G_OBJECT(entry), "activate", G_CALLBACK(MenuShowPref), 
this);
 
        gtk_widget_show_all(pTrayMenu);
        g_signal_connect(G_OBJECT(pTrayMenu), "selection-done", 
G_CALLBACK(TrayIconPopupMenuSelectionDone), this);
@@ -1075,6 +1106,11 @@
        
reinterpret_cast<nsMessengerFreeDesktopIntegration*>(data)->OnActionHideIcon();
 }
 
+void nsMessengerFreeDesktopIntegration::MenuShowPref(GtkMenuItem *menuItem, 
void *data) 
+{
+    
reinterpret_cast<nsMessengerFreeDesktopIntegration*>(data)->OnActionShowPref();
+}
+
 void nsMessengerFreeDesktopIntegration::MenuReadMail(GtkMenuItem *menuItem, 
void *data)
 {
        
reinterpret_cast<nsMessengerFreeDesktopIntegration*>(data)->OnActionReadMail();
diff -urNad 
mozilla-traybiff-1.2.3~/components/nsMessengerFreeDesktopIntegration.h 
mozilla-traybiff-1.2.3/components/nsMessengerFreeDesktopIntegration.h
--- mozilla-traybiff-1.2.3~/components/nsMessengerFreeDesktopIntegration.h      
2007-07-18 01:06:41.000000000 +0100
+++ mozilla-traybiff-1.2.3/components/nsMessengerFreeDesktopIntegration.h       
2007-07-18 01:07:14.000000000 +0100
@@ -130,6 +130,8 @@
        void OnActionToggleWindow();
        // Hide Icon chosen in popup menu.
        void OnActionHideIcon();
+       // Show Preferences window
+       void OnActionShowPref();
 
 // GTK+ signal handlers
 private:
@@ -139,6 +141,7 @@
        static void MenuReadMail(GtkMenuItem *menuItem, void *data);
        static void MenuToggleWindow(GtkMenuItem *menuItem, void *data);
        static void MenuHideIcon(GtkMenuItem *menuItem, void *data);
+       static void MenuShowPref(GtkMenuItem *menuItem, void *data);
   
 // GTK+ tray icon-related members
 private:
diff -urNad mozilla-traybiff-1.2.3~/install.rdf 
mozilla-traybiff-1.2.3/install.rdf
--- mozilla-traybiff-1.2.3~/install.rdf 1970-01-01 01:00:00.000000000 +0100
+++ mozilla-traybiff-1.2.3/install.rdf  2007-07-18 01:07:14.000000000 +0100
@@ -0,0 +1,36 @@
+<?xml version="1.0"?>
+<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"; 
xmlns:em="http://www.mozilla.org/2004/em-rdf#";>
+       <Description about="urn:mozilla:install-manifest">
+               <em:id>{2e1b75f1-6b5a-4f1d-89b4-424f636e4fba}</em:id>
+               <em:version>1.2.3</em:version>
+               <em:targetApplication>
+                       <Description>
+                               
<em:id>{3550f703-e582-4d05-9a08-453d09bdfdc6}</em:id>
+                               <em:minVersion>2.0</em:minVersion>
+                               <em:maxVersion>2.0.0.*</em:maxVersion>
+                       </Description>
+               </em:targetApplication>
+               <em:name>New Mail Icon</em:name>
+               <em:description>Displays an icon in the system tray when new 
mail arrives.</em:description>
+               <em:creator>Ilya Konstantinov</em:creator>
+               <em:homepageURL>http://moztraybiff.mozdev.org/</em:homepageURL>
+               
<em:optionsURL>chrome://traybiff/content/settings.xul</em:optionsURL>
+               
<em:updateURL>http://moztraybiff.mozdev.org/update.rdf</em:updateURL>
+               <em:type>2</em:type>
+               
+               <em:file>
+                       <Description 
about="urn:mozilla:extension:file:tray-biff.jar">
+                               <em:package>content/traybiff/</em:package>
+                               <em:locale>locale/en-US/traybiff/</em:locale>
+                               <em:locale>locale/he-IL/traybiff/</em:locale>
+                               <em:locale>locale/fr-FR/traybiff/</em:locale>
+                               <em:locale>locale/it-IT/traybiff/</em:locale>
+                               <em:locale>locale/ca-AD/traybiff/</em:locale>
+                               <em:locale>locale/de-DE/traybiff/</em:locale>
+                               <em:locale>locale/es-ES/traybiff/</em:locale>
+                               <em:locale>locale/cs-CZ/traybiff/</em:locale>
+                               <em:locale>locale/ru-RU/traybiff/</em:locale>
+                       </Description>
+               </em:file>
+       </Description>      
+</RDF>
\ No newline at end of file

Reply via email to