status icon API



Hi,

On Tue, 2003-04-08 at 06:13, Owen Taylor wrote:
> On Mon, 2003-04-07 at 13:51, martyn 2 russell bt com wrote:

> > Plus, if there are plans, which version/milestone of GTK will there be
> > support the sys tray in gnome/windows?
> 
> No current plans. The bug tracking this issue is:
> 
>  http://bugzilla.gnome.org/show_bug.cgi?id=105101

<snip/>

> > I would be willing to help develop the WIN32 code for this, as I have done
> > it before.
> 
> The first step would be to come up with an API proposal.

	Okay, so I've done some work on a simple API for adding icons to the
Notification Area. Its in libegg. But it sucks in its current form:

	* Its currently geared towards "status icons" - that is, an icon that
remains in the notification area while the app is running and the app
switches the icon around as some status changes. It needs an API for an
icon that is added and removed as a certain event occurs ...

	* The API for setting an array of icons and then using a status
identifier to index into the array sucks. Couldn't think of a nicer way
to do it.

	But anyway, its a start - I've appended it below.

	I've only ever had a quick look at the Win32 API for this, but my
interpretation was similar to what Havoc says in #105101. I think the
API below could be implemented in Win32, but I'd be very interested to
hear from someone who actually knows what they're talking about :-)

	As regards this API limiting people on X11, maybe gtk+ on X11 could
also ship something similar to EggTrayIcon (effectively only an
implementation of the protocol). That way people can do their fancy
embedding if they want, but they know they are limiting themselves to
X11 only - in a similar way to GtkPlug/Socket. Hmm, its just occurred to
me that that would mean the widget would sub-class different widgets on
Win32 and X11. Ouch.

Good Luck,
Mark.


struct _EggStatusIcon
{
  EggTrayIcon           tray_icon;

  EggStatusIconPrivate *priv;
};

struct _EggStatusIconClass
{
  EggTrayIconClass parent_class;

  void (* activate)   (EggStatusIcon *icon);
  void (* popup_menu) (EggStatusIcon *icon);
};

GType               egg_status_icon_get_type        (void);

/* Pass in a list of icon names (looked up according to the
 * icon theme) or icon paths.
 */
GtkWidget           *egg_status_icon_new             (gchar         **icons,
						      guint           n_icons);

/* Set the currently displayed icon using an index into the array
 * of status icons. Most applications would probably use a status
 * enum as an indexer.
 */
void                 egg_status_icon_set_status      (EggStatusIcon  *status_icon,
						      guint           status);
/* Gets the current status */
guint                egg_status_icon_get_status      (EggStatusIcon  *status_icon);

/* Set the list of status icons */
void                 egg_status_icon_set_icons       (EggStatusIcon  *status_icon,
						      gchar         **icons,
						      guint           n_icons);
/* Retrieve the list of status icons */
gchar              **egg_status_icon_get_icons       (EggStatusIcon  *status_icon,
						      guint          *n_icons);

/* Set an individual icon */
void                  egg_status_icon_set_icon        (EggStatusIcon  *status_icon,
						       guint           status,
						       const gchar    *icon);
/* Retrieve an individual icon */
G_CONST_RETURN gchar *egg_status_icon_get_icon        (EggStatusIcon  *status_icon,
						       guint           status);

/* Blink the icon for a set period of time */
void                  egg_status_icon_begin_blinking  (EggStatusIcon  *status_icon);
/* Blink the icon indefinetly */
void                  egg_status_icon_set_is_blinking (EggStatusIcon  *status_icon,
						       gboolean        is_blinking);
/* Determine if the icon is currently blinking */
gboolean              egg_status_icon_get_is_blinking (EggStatusIcon  *status_icon);





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