GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Tue Oct 21, 2014 12:37 am

All times are UTC




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Can not close GtkAboutDialog widget via it's close button
PostPosted: Sat Mar 17, 2007 9:18 pm 
Offline
Familiar Face

Joined: Tue Jan 23, 2007 6:13 pm
Posts: 34
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.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 17, 2007 9:36 pm 
Offline
Never Seen the Sunlight

Joined: Wed Sep 21, 2005 12:07 am
Posts: 563
Location: Portland, OR USA
Can you post your source? Typically it's handle using a call to gtk_dialog_run()

_________________
Micah Carrick - Forum Administrator
http://www.micahcarrick.com


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 17, 2007 10:02 pm 
Offline
Familiar Face

Joined: Tue Jan 23, 2007 6:13 pm
Posts: 34
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;
}


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 17, 2007 10:30 pm 
Offline
Never Seen the Sunlight

Joined: Wed Sep 21, 2005 12:07 am
Posts: 563
Location: Portland, OR USA
Can you paste the code that shows the dialog? The callback for the Help->About menu activate?

_________________
Micah Carrick - Forum Administrator
http://www.micahcarrick.com


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 17, 2007 10:39 pm 
Offline
Familiar Face

Joined: Tue Jan 23, 2007 6:13 pm
Posts: 34
Sure. This is the code.
Code:
void
on_about_show                          (GtkMenuItem     *menuitem,
                                            gpointer         user_data)
{
  GtkWidget * about_dlg;
  about_dlg = create_aboutdialog ();
  gtk_widget_show ( about_dlg );
}


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 17, 2007 10:48 pm 
Offline
Never Seen the Sunlight

Joined: Wed Sep 21, 2005 12:07 am
Posts: 563
Location: Portland, OR USA
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:
  GtkWidget * about_dlg;
  about_dlg = create_aboutdialog ();
  gtk_dialog_run (GTK_DIALOG (about_dlg ));
  gtk_widget_destroy (about_dlg);

_________________
Micah Carrick - Forum Administrator
http://www.micahcarrick.com


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 17, 2007 11:00 pm 
Offline
Familiar Face

Joined: Tue Jan 23, 2007 6:13 pm
Posts: 34
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group