gtkmm documentation format



Bob Caryl wrote:

Believe me when I say that I feel you pain insofar as the documentation for almost all things linux are concerned. It reminds me of how things were under the old Soviet system: all things, both possessions and responsibilities belonged to everyone, but at the same time to no one! That is how I see documentation of GPL'd stuff under linux. Bob

I have another suggestion for you, if it really is the case that documentation belongs to everyone, and that is, would someone host the tutorial in a wiki format? This has worked quite well at my company, and even at well-known sites such as http://wikipedia.org and http://nslu2-linux.org. Perhaps it could be access-controlled using the gtkmm mailing list address & password to somewhat limit vandalism, if that is a concern. Once the docs were in wiki format, new users like myself could help continually improve them and hopefully make it easier for the next person. Just my $0.02.

--
Ron

/-------Original Message-------/ /*From:*/ rchilds vctlabs com <mailto:rchilds vctlabs com>
/*Date:*/ 07/02/05 09:03:39
/*To:*/ gtkmm-list gnome org <mailto:gtkmm-list gnome org>
/*Subject:*/ Re: sigc::ptr_fun() compiler error
Bob Caryl wrote:
 > Ron Lockwood-Childs wrote:
 >
 >> Hello,
 >>
 >> I get an error when trying to compile the following code:
 >>
 >> test.h
 >> ------
 >> #include <libglademm/xml.h>
 >> #include <gtkmm>
 >> #include <iostream>
 >>
 >> class Test
 >> {
 >>   Glib::RefPtr<Gnome::Glade::Xml> refXml;
 >>   Gtk::Window *pMWindow;
 >>   void on_quit_activate() { if (pMWindow) pMWindow->hide(); }
 >> public:
 >>   Test( int argc, char **argv, char *glade_path );
 >> };
 >>
 >> test.cc
 >> -------
 >> #include <libglademm/xml.h>
 >> #include <gtkmm>
 >> #include <iostream>
 >> #include "test.h"
 >>
 >> Test::Test( int argc, char **argv, char *glade_path )
 >> {
 >>   try
 >>   {
 >>     refXml = Gnome::Glade::Xml::create( glade_path );
 >>   }
 >>   catch(const Gnome::Glade::XmlError& ex)
 >>   {
 >>     std::cerr << ex.what() << std::endl;
 >>     exit( 1 );
 >>   }
 >>
 >>   refXml->get_widget("mainwindow", pMWindow);
 >>   if (pMWindow)
 >>   {
 >>       Gtk::MenuItem* pMenuItem = 0;
 >>       refXml->get_widget("menu_file_quit", pMenuItem);
 >>       if(pMenuItem)
 >>       {
 >>         pMenuItem->signal_activate().connect(
 >>           sigc::ptr_fun( &Test::on_quit_activate ) );
 >>       }
 >>   }
 >> }
 >>
 >> int main( argc, argv )
 >> {
 >>   Test testDialog = new Test( argc, argv, "test.glade" );
 >>   return 0;
 >> }
 >>
 >> ---------
 >> (if I've made copy-paste errors, FWIW the actual code doesn't get
 >> syntax errors..)
 >>
 >> Finally, when I attempt compilation, this is what I get:
 >>
 >> $ g++ test.cc -o test `pkg-config gtkmm-2.4 --cflags --libs`
 >> -lglademm-2.4
 >> test.cc: In constructor `Test::Test(int, char**, char*)':
 >> test.cc: error: no matching function for call to `ptr_fun(void
 >> (Test::*)())'
 >>
 >> This was taken from the tutorial, except that now I'm attempting to
 >> put the UI code into its own class.  It gives me no hint on why it
 >> can't find the function.  If I do anything to the function pointer,
 >> such as:
 >> sigc::ptr_fun(&(Test::on_quit_activate))
 >> or
 >> sigc::ptr_fun(&(this->on_quit_activate))
 >> I get the same error, with another complaint regarding ANSI C++ and
 >> pointers to non-static member functions.  This signal handler must be
 >> a member function, since it accesses private data.
 >>
 >> Anyone seen this or similar errors & can offer help?  I'd appreciate it.
 >>
 >> --
 >> Ron Lockwood-Childs
 >> _______________________________________________
 >> gtkmm-list mailing list
 >> gtkmm-list gnome org <mailto:gtkmm-list gnome org>
 >> http://mail.gnome.org/mailman/listinfo/gtkmm-list
 >>
 > Your compiler is unhappy because you are trying to pass a class member
 > function to sigc::ptr_fun when it is expecting a NON class member
 > function.  Try using sigc::mem_fun with the following syntax to pass
 > your member function:
 >
 > pMenuItem->signal_activate().connect( sigc::mem_fun( *this,
 > &Test::on_quit_activate ) );
 >
 > I hope this helps you out.
 >
 > Bob Caryl
Thanks for the replies on this one. Recommendation to the doc team,
please make this difference between mem_fun() and ptr_fun() a little
clearer in the tutorial page:
http://www.gtkmm.org/docs/gtkmm-2.4/docs/tutorial/html/apb.html
Working in the embedded field as long as I have, my mind automatically
expands "mem" to "memory"..
--
Ron Lockwood-Childs
_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org <mailto:gtkmm-list gnome org>
http://mail.gnome.org/mailman/listinfo/gtkmm-list
		





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]