From: Braden M. <br...@us...> - 2007-02-04 09:30:29
|
Update of /cvsroot/openvrml/openvrml/src/openvrml-player In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv19624/src/openvrml-player Modified Files: player.cpp Log Message: Factored GladeXML creation out of main. Index: player.cpp =================================================================== RCS file: /cvsroot/openvrml/openvrml/src/openvrml-player/player.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** player.cpp 24 Jan 2007 00:06:46 -0000 1.3 --- player.cpp 4 Feb 2007 09:30:27 -0000 1.4 *************** *** 70,73 **** --- 70,74 ---- G_GNUC_INTERNAL ssize_t write_command(const std::string & command); G_GNUC_INTERNAL GSource * curl_source_new(CURLM * multi_handle); + G_GNUC_INTERNAL GladeXML * xml_new(GnomeProgram & program); *************** *** 146,169 **** GNOME_PARAM_NONE); ! const gchar * const gladedir = g_getenv("OPENVRML_PLAYER_GLADEDIR"); ! string glade_file_str; ! const gchar * glade_file = 0; ! if (gladedir) { ! glade_file_str = string(gladedir) + "/openvrml-player.glade"; ! glade_file = glade_file_str.c_str(); ! } ! ! if (!glade_file) { ! static const gboolean only_if_exists = true; ! glade_file = gnome_program_locate_file(program, ! GNOME_FILE_DOMAIN_APP_DATADIR, ! "/glade/openvrml-player.glade", ! only_if_exists, ! 0); ! } ! ! g_return_val_if_fail(glade_file, EXIT_FAILURE); ! ! GladeXML * const xml = glade_xml_new(glade_file, 0, 0); glade_xml_signal_autoconnect(xml); --- 147,151 ---- GNOME_PARAM_NONE); ! GladeXML * const xml = xml_new(*program); glade_xml_signal_autoconnect(xml); *************** *** 310,313 **** --- 292,322 ---- namespace { + GladeXML * xml_new(GnomeProgram & program) + { + using std::string; + + const gchar * const gladedir = g_getenv("OPENVRML_PLAYER_GLADEDIR"); + string glade_file_str; + const gchar * glade_file = 0; + if (gladedir) { + glade_file_str = string(gladedir) + "/openvrml-player.glade"; + glade_file = glade_file_str.c_str(); + } + + if (!glade_file) { + static const gboolean only_if_exists = true; + glade_file = + gnome_program_locate_file(&program, + GNOME_FILE_DOMAIN_APP_DATADIR, + "/glade/openvrml-player.glade", + only_if_exists, + 0); + } + + g_return_val_if_fail(glade_file, 0); + + return glade_xml_new(glade_file, 0, 0); + } + typedef std::list<GPollFD> poll_fds_t; |