emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: RFC: status icon support


From: Michael Olson
Subject: Re: RFC: status icon support
Date: Sun, 13 Jan 2008 20:03:36 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.50 (gnu/linux)

Tom Tromey <address@hidden> writes:

>>>>>> "Dan" == Dan Nicolaescu <address@hidden> writes:
>
> Dan> Please no K&R in new code.
>
> Here is the updated patch.

I tried it out today.  I can see from config.log and src/config.h that
libnotify support is being detected correctly, and that
gtk_status_icon_new is present.  The problem is that the
`show-status-icon-message' acts somewhat erratically if the icon is
created and then an immediate attempt is made to display a popup
message.  I suspect a race condition.

Once this issue is fixed, I'd love to see this feature hit Emacs CVS.
It will be particularly nice for ERC once your erc-status.el is adapted
to work with the new code.

Here's my test case, with instructions in comments.  Let me know if you
need any additional info.

;; Save this to test.el.
;;
;; Recipe:
;;
;;   emacs -Q -l test.el
;;   M-x my-icon-all-in-one RET
;;   => Creates icon in status area
;;   => "Couldn't connect to notification server"
;;   => libnotify-Message: Unable to get session bus: Failed to
;;      execute dbus-launch to autolaunch D-Bus session
;;   => Does not show "foo" popup
;;   M-x my-icon-remove-all RET
;;
;;   C-x 5 2
;;   C-x 5 o
;;   M-x my-icon-all-in-one RET
;;   => Creates icon and shows "foo" popup, but off the screen, or
;;      sometimes neat the position of the cursor, or (once) crashes
;;      Emacs.
;;   M-x my-icon-remove-all RET
;;
;;   M-x my-icon-create RET
;;   => Creates icon in status area.
;;   M-x my-icon-display RET
;;   => Always displays popup successfully.
;;   C-x C-c
;;
;;   emacs -Q -l test.el
;;   M-x my-icon-two-separate RET
;;   => Creates icon and shows "foo" popup, but off the screen, or
;;      near the position of the cursor
;;   M-x my-icon-remove RET
;;   M-x my-icon-create RET
;;   => Creates icon in status area.
;;   M-x my-icon-display RET
;;   => Always displays popup successfully.

(defvar my-status-icon nil)

(defun my-icon-create ()
  (interactive)
  (setq my-status-icon
        (make-status-icon '((help-echo . "bar")
                            (icon-name . 
"/usr/local/share/emacs/23.0.50/etc/images/icons/hicolor/48x48/apps/emacs.png")))))

(defun my-icon-test ()
  (interactive)
  (show-status-icon-message my-status-icon "foo"))

(defun my-icon-remove ()
  (interactive)
  (delete-status-icon my-status-icon))

(defun my-icon-remove-all ()
  (interactive)
  (dolist (icon (status-icon-list))
    (delete-status-icon icon)))

(defun my-icon-all-in-one ()
  (interactive)
  (show-status-icon-message
   (setq my-status-icon
         (make-status-icon '((help-echo . "bar")
                             (icon-name . 
"/usr/local/share/emacs/23.0.50/etc/images/icons/hicolor/48x48/apps/emacs.png"))))
   "foo"))

(defun my-icon-two-separate ()
  (interactive)
  (my-icon-create)
  (my-icon-test))

-- 
       Michael Olson -- FSF Associate Member #652     |
 http://mwolson.org/ -- Jabber: mwolson_at_hcoop.net  |  /` |\ | | |
          Programmer -- Hobbies: Lisp, HCoop          | |_] | \| |_|
Projects: Emacs, Muse, ERC, EMMS, ErBot, DVC, Planner |

Attachment: pgprJk7doLQZT.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]