Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Gtk+/Gnome Application Development
Prev Home Next

GtkStatusbar

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:

  1. First obtain a context ID with gtk_statusbar_get_context_id(); the context_description argument can be any string you like.

  2. 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.)

  3. 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.

#include <gtk/gtkstatusbar.h>

GtkWidget* gtk_statusbar_new(void);

guint gtk_statusbar_get_context_id(GtkStatusbar* statusbar, const gchar* context_description);

guint gtk_statusbar_push(GtkStatusbar* statusbar, guint context_id, const gchar* text);

void gtk_statusbar_pop(GtkStatusbar* statusbar, guint context_id);

void gtk_statusbar_remove(GtkStatusbar* statusbar, guint context_id, guint message_id);

Figure 9. GtkStatusbar

Gtk+/Gnome Application Development
Prev Home Next

 
 
  Published under free license. Design by Interspire