GtkStatusbar has no default
text or "transient" text, as in
GnomeAppBar; it only has a message stack. However,
each message is tagged with a "context" identified by a
string. When you pop a message off the stack, you must
specify a context; the topmost message in that context is popped. If there are no
messages in the context you specify, no text is popped.
In essence, the GtkStatusbar
"pop" operation works only within namespaces. There's no
way to unconditionally pop all messages or
unconditionally pop the topmost message.
In principle this lets different parts of the program use
the statusbar without interfering with one another.
However, in my experience there's no need for this. For
example, Netscape doesn't even have a stack for its
statusbar; its statusbar is simply a label. In general it
is poor interface design to make anything essential appear in the statusbar, since
the user might not notice it. Accidentally deleting a
message should not be a major worry.
Figure 9 shows the
GtkStatusbar functions.
To use the statusbar:
-
First obtain a context ID with
gtk_statusbar_get_context_id(); the context_description argument can
be any string you like.
-
Push a message onto the statusbar using gtk_statusbar_push(); the message is
tagged with the given context ID. The return value is
a message ID you can use to remove the message.
(Unlike GnomeAppBar, GtkStatusbar lets you remove a
message that isn't on top of the stack.)
-
Eventually remove the message with gtk_statusbar_remove() or gtk_statusbar_pop(). The former
refers to a specific message by ID, the latter
removes the topmost message in the supplied
context.
Note that gtk_statusbar_push()
pushes a message on top of all other messages, even those
in other contexts; but
gtk_statusbar_pop() will only pop from the context
supplied. Contexts do not refer to separate stacks, they
merely restrict which messages you are permitted to pop.