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

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

  




 

 

Gtk+/Gnome Application Development
Prev Home Next

Special Dialog Types

This section describes some special kinds of dialog that exist for your convenience, and for UI consistency. Of course nearly everything said so far about GnomeDialog also applies to its subclasses.

GnomeAbout

Gnome applications should have an "About Foo" menu item which displays this widget (where "Foo" is the name of your application). Using it is ridiculously easy; there's only one function involved, gnome_about_new() (Figure 7). The arguments are, respectively: the title of your application, the version of your application, a one-line copyright notice, a NULL-terminated vector of author's names, a short paragraph saying anything you want to say, and an image filename to display as your application's logo. Only the authors argument is required; the others can be NULL, but your dialog will look fairly strange if all of them are.

       #include <libgnomeui/gnome-about.h>
      

GtkWidget* gnome_about_new(const gchar* title, const gchar* version, const gchar* copyright, const gchar** authors, const gchar* comments, const gchar* logo);

Figure 7. GnomeAbout

GnomeAbout automatically closes when clicked, so you don't really need to worry about it; just create and show the dialog. Remember to ensure only one instance exists at any given time, as explained in the section called Finishing Touches.

Here's a menu item callback to show an about dialog, from the Gnome calendar application:


static void
about_calendar_cmd (GtkWidget *widget, void *data)
{
   GtkWidget *about;
   const gchar *authors[] = {
     "Miguel de Icaza <[email protected]>",
     "Federico Mena <[email protected]>",
     "Arturo Espinosa <[email protected]>",
     NULL
   };

   about = gnome_about_new (_("Gnome Calendar"), VERSION,
                            "(C) 1998 the Free Software Foundation",
                            authors,
                            _("The GNOME personal calendar and schedule manager."),
                            NULL);
   gtk_window_set_modal (GTK_WINDOW (about), TRUE);

   gtk_widget_show (about);
}
      

Note that the authors give both their name and email address; that way people can use the dialog to decide where to send hate mail and bug reports. (Or thank you notes!) The VERSION macro comes from config.h, and is defined by configure. The Gnome Calendar authors chose to prevent multiple dialog instances by making the dialog modal---the user can't re-select the menu item while the dialog is open. It is probably better to use the technique described in the section called Finishing Touches, so the dialog is deiconified and raised if the user reselects the menu item.

Gtk+/Gnome Application Development
Prev Home Next

 
 
  Published under free license. Design by Interspire