Prism: Add tray icon support (nsINotificationArea) for GTK2

ASSIGNED
Assigned to

Status

Mozilla Labs
Prism
--
enhancement
ASSIGNED
10 years ago
5 years ago

People

(Reporter: nossralf, Assigned: nossralf)

Tracking

Details

Attachments

(1 attachment, 2 obsolete attachments)

(Assignee)

Description

10 years ago
This is some desktop integration lovin' for Prism on Linux. Adds support for tray icons (though the GTK nomenclature calls it "status icons"). It's got feature parity with the Windows code that's in the tree right now.
(Assignee)

Comment 1

10 years ago
Created attachment 305715 [details] [diff] [review]
a work-in-progress patch

This is a patch that builds and works great for me. I still call it a WIP because there are probably things like license texts that may need some massaging, it's possible the makefiles include unnecessary stuff, etc. Also, there are probably UI changes that fall under this bug, to enable tray icons when creating a webapp, etc. (Or they're follow-ups at least.)

Note that there's code commented out in _processConfig in the patch which corresponds to changes suggested in bug 418904.

(It's a patch generated by "hg diff", so apply with "patch -p1".)
Assignee: nobody → nossralf
Status: NEW → ASSIGNED
Please use "unix" instead of "linux".
(Assignee)

Updated

10 years ago
Summary: Add tray icon support for Linux (GTK2) → Add tray icon support for unix (GTK2)
well, the summary can definitely say Linux, but I just meant that you should use "unix" for the directory name, etc.
(Assignee)

Comment 4

10 years ago
Ah, OK. Gotcha. Heh, I'm new at this.
(Assignee)

Comment 5

10 years ago
Created attachment 305727 [details] [diff] [review]
same WIP with renames of files and directories

Dirs are now unix/ instead of linux/, files end with GTK instead of Linux.
Attachment #305715 - Attachment is obsolete: true
(Assignee)

Updated

10 years ago
Summary: Add tray icon support for unix (GTK2) → Add tray icon support (nsINotificationArea) for GTK2
(Assignee)

Updated

10 years ago
Summary: Add tray icon support (nsINotificationArea) for GTK2 → Prism: Add tray icon support (nsINotificationArea) for GTK2

Comment 6

10 years ago
Comment on attachment 305727 [details] [diff] [review]
same WIP with renames of files and directories

Great work! Thanks a lot. A few comments:

>diff -r 014e0666cf43 client/chrome/content/webrunner.js
>--- a/client/chrome/content/webrunner.js	Mon Feb 25 13:51:19 2008 +0100
>+++ b/client/chrome/content/webrunner.js	Tue Feb 26 12:49:10 2008 +0100
>@@ -190,10 +190,10 @@ var WebRunner = {
> 
>     document.title = WebAppProperties.name;
> 
>-    if (WebAppProperties.trayicon) {
>-      var desktop = Cc["@mozilla.org/desktop-environment;1"].getService(Ci.nsIDesktopEnvironment);
>-      desktop.QueryInterface(Ci.nsINotificationArea).setTitle(WebAppProperties.id, document.title);
>-    }
>+    //    if (WebAppProperties.trayicon) {
>+    //      var desktop = Cc["@mozilla.org/desktop-environment;1"].getService(Ci.nsIDesktopEnvironment);
>+    //      desktop.QueryInterface(Ci.nsINotificationArea).setTitle(WebAppProperties.id, document.title);
>+    //    }

I removed this anyway in bug 419640.

>     if (WebAppProperties.uri)
>         this._getBrowser().loadURI(WebAppProperties.uri, null, null);
>@@ -568,7 +568,7 @@ var WebRunner = {
>     appIcon.append(WebAppProperties.id);
>     appIcon.append("icons");
>     appIcon.append("default");
>-    appIcon.append(WebAppProperties.icon + ".ico");
>+    appIcon.append(WebAppProperties.icon + ".png");

We should probably use the text preprocessor for this so we can use the right file extension for the platform (see http://developer.mozilla.org/en/docs/Build:Text_Preprocessor for general info and install-shortcut.js for an example).

>--- a/components/public/Makefile.in	Mon Feb 25 13:51:19 2008 +0100
>+++ b/components/public/Makefile.in	Tue Feb 26 12:49:10 2008 +0100
>@@ -54,6 +54,10 @@ DIRS = mac
> DIRS = mac
> endif
> 
>+ifeq ($(MOZ_WIDGET_TOOLKIT), gtk2)
>+DIRS = unix
>+endif
>+
> EXPORTS = \
> 		$(NULL)

We should move nsINotificationArea.idl into the top-level public directory if we're going to share it across multiple operating systems.

>diff -r 014e0666cf43 components/public/unix/Makefile.in
>--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
>+++ b/components/public/unix/Makefile.in	Tue Feb 26 12:49:10 2008 +0100

See previous comment.

>diff -r 014e0666cf43 components/public/unix/nsINotificationArea.idl
>--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
>+++ b/components/public/unix/nsINotificationArea.idl	Tue Feb 26 12:49:10 2008 +0100

See previous comment.

>+/*
>+ This little struct is used to maintain the relationship between
>+ tray icons and their listeners. It is necessary to do so
>+ in order to properly release the listener object once the
>+ icon is removed.
>+ */
>+
>+typedef struct _IconListenerMapping {
>+  GtkStatusIcon* icon;
>+  nsINotificationAreaListener* listener;
>+} IconListenerMapping;

Okay for now but we'll probably want to do something generic that works across all platforms.

>+static const nsModuleComponentInfo components[] =
>+{
>+  { "Windows desktop environment",

"GTK desktop environment"
(Assignee)

Comment 7

10 years ago
Created attachment 305804 [details] [diff] [review]
same WIP with required changes 

This addresses everything in comment 6. (Except the IconListenerMapping thing.) 

I can't verify the slight changes for the Windows makefile (but as they follow the same logic that works on Linux I think it's fine). This patch builds on Linux and works as before.
Attachment #305727 - Attachment is obsolete: true
(Assignee)

Updated

9 years ago
Duplicate of this bug: 424846
nossralf, do you have any time to look at matching this to matt's current work on windows and mac?

Updated

7 years ago
Blocks: 325353
You need to log in before you can comment on or make changes to this bug.