 |
GTK+ Forums Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
|
|
|
| Author |
Message |
|
|
hydra Familiar Face
Joined: 23 Jan 2007 Posts: 35
|
Posted: Sat Mar 17, 2007 9:18 pm Post subject: Can not close GtkAboutDialog widget via it's close button |
|
|
I use GtkAboutDialog and everything works fine except the close button of this widget. All other buttons works fine, I don't know how but all buttons have default callbacks and they create and destroy the windows.
But the "Close" button of GtkAboutDialog widget does not work. I can not even see it's widget. So, can I access it?
I have a look in the callbacks.c file and there is just the GtkAboutDialog widget class and no any child widgets.
So, how to close the window? I can not make callback because there is no child widgets...... I do not see them in the source file. |
|
| Back to top |
|
 |
Micah Carrick Never Seen the Sunlight
Joined: 21 Sep 2005 Posts: 407 Location: Portland, OR USA
|
Posted: Sat Mar 17, 2007 9:36 pm Post subject: |
|
|
| Can you post your source? Typically it's handle using a call to gtk_dialog_run() |
|
| Back to top |
|
 |
hydra Familiar Face
Joined: 23 Jan 2007 Posts: 35
|
Posted: Sat Mar 17, 2007 10:02 pm Post subject: |
|
|
Here you are the source code extracted from interface.c
I did not make any callbacks so the other source code is useless here.The interesting thing is that all other buttons work fine but only this "close" button does not work.
GtkWidget*
create_aboutdialog (void)
{
GtkWidget *aboutdialog;
const gchar *authors[] = {
"Marcel M. Weber",
"Svetoslav P. Chukov",
"Testing: Gunter Ohmert",
NULL
};
/* TRANSLATORS: Replace this string with your names, one name per line. */
gchar *translators = _("translator-credits");
aboutdialog = gtk_about_dialog_new ();
gtk_about_dialog_set_version (GTK_ABOUT_DIALOG (aboutdialog), VERSION);
gtk_about_dialog_set_name (GTK_ABOUT_DIALOG (aboutdialog), _("GliBench"));
gtk_about_dialog_set_copyright (GTK_ABOUT_DIALOG (aboutdialog), _("Copyright (C) 2007\nMarcel M. Weber <apw@rossby.metr.ou.edu>\n"));
gtk_about_dialog_set_comments (GTK_ABOUT_DIALOG (aboutdialog), _("GliBench is benchmark program to meassure your computer performance.\n"));
gtk_about_dialog_set_license (GTK_ABOUT_DIALOG (aboutdialog), _("This program is free software; you can redistribute it and/or modify it\nunder the terms of the GNU General Public License as published by the Free\nSoftware Foundation; either version 2 of the License, or (at your option)\nany later version.\nThis program is distributed in the hope that it will be useful, but WITHOUT\nANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\nFITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for\nmore details.\nYou should have received a copy of the GNU General\n Public License along\nwith this program; if not, write to the Free Software Foundation, Inc., 59\nTemple Place, Suite 330, Boston, MA 02111-1307 USA\n"));
gtk_about_dialog_set_website (GTK_ABOUT_DIALOG (aboutdialog), "http://www.glibench.sourceforge.net/");
gtk_about_dialog_set_website_label (GTK_ABOUT_DIALOG (aboutdialog), _("GliBench Developer's Site"));
gtk_about_dialog_set_authors (GTK_ABOUT_DIALOG (aboutdialog), authors);
gtk_about_dialog_set_translator_credits (GTK_ABOUT_DIALOG (aboutdialog), translators);
g_signal_connect ((gpointer) aboutdialog, "destroy",
G_CALLBACK (on_aboutdialog_destroy),
NULL);
/* Store pointers to all widgets, for use by lookup_widget(). */
GLADE_HOOKUP_OBJECT_NO_REF (aboutdialog, aboutdialog, "aboutdialog");
return aboutdialog;
} |
|
| Back to top |
|
 |
Micah Carrick Never Seen the Sunlight
Joined: 21 Sep 2005 Posts: 407 Location: Portland, OR USA
|
Posted: Sat Mar 17, 2007 10:30 pm Post subject: |
|
|
| Can you paste the code that shows the dialog? The callback for the Help->About menu activate? |
|
| Back to top |
|
 |
hydra Familiar Face
Joined: 23 Jan 2007 Posts: 35
|
Posted: Sat Mar 17, 2007 10:39 pm Post subject: |
|
|
Sure. This is the code.
| Code: (Plaintext) | 1 2 3 4 5 6 7 8 9
|
void
on_about_show (GtkMenuItem *menuitem,
gpointer user_data)
{
GtkWidget * about_dlg;
about_dlg = create_aboutdialog ();
gtk_widget_show ( about_dlg );
} | |
|
| Back to top |
|
 |
Micah Carrick Never Seen the Sunlight
Joined: 21 Sep 2005 Posts: 407 Location: Portland, OR USA
|
Posted: Sat Mar 17, 2007 10:48 pm Post subject: |
|
|
You can also access the close button in you need to since the GtkAboutDialog is derived from GtkDialog. The GtkDialog struct has the action_area member (about_dlg->action_area) which is a GtkHButton box which contains the close button as one of it's children.
However, an easier way to show an about dialog is by using gtk_dialog_run() as shown below:
| Code: (Plaintext) | 1 2 3 4
| GtkWidget * about_dlg;
about_dlg = create_aboutdialog ();
gtk_dialog_run (GTK_DIALOG (about_dlg ));
gtk_widget_destroy (about_dlg); | |
|
| Back to top |
|
 |
hydra Familiar Face
Joined: 23 Jan 2007 Posts: 35
|
Posted: Sat Mar 17, 2007 11:00 pm Post subject: |
|
|
Thank you very much!
I very appreciate your help and consider to buy the GTK+ book of openldev because the main gtk documentation miss all these small but important details. |
|
| Back to top |
|
 |
|
Powered by phpBB © 2001, 2005 phpBB Group CodeBB 1.0 Beta 2
|