let the dev. use the glade too (cvs checkout for example)

This commit is contained in:
damdoum 2007-02-05 02:58:02 +00:00
parent b2263b0bfd
commit d7d95ad693
1 changed files with 23 additions and 18 deletions

View File

@ -59,20 +59,25 @@ void notify_Tools() {
}
/* Return the glade directory. */
gchar * get_ui_file (const char *filename)
gchar * get_ui_file (const char *filename, const char * prog)
{
char *path;
char *path, *path2;
/* EHhhhh ! building dir ?*/
path = g_path_get_dirname(prog);
path2 = g_build_filename (path, "glade", filename, NULL);
g_free (path);
if (g_file_test (path2, G_FILE_TEST_IS_REGULAR)) return path2;
g_free (path2);
/* looking in uninstalled dir first */
path = g_build_filename (GLADEUI_UNINSTALLED_DIR, filename, NULL);
if (g_file_test (path, G_FILE_TEST_IS_REGULAR))
return path;
if (g_file_test (path, G_FILE_TEST_IS_REGULAR)) return path;
g_free (path);
/* looking in installed dir */
path = g_build_filename (DATADIR, filename, NULL);
if (g_file_test (path, G_FILE_TEST_IS_REGULAR))
return path;
if (g_file_test (path, G_FILE_TEST_IS_REGULAR)) return path;
g_free (path);
/* not found */
@ -246,8 +251,8 @@ int main(int argc, char *argv[]) {
Read_ConfigFile();
/* load the interface */
xml = glade_xml_new(get_ui_file("DeSmuMe.glade"), NULL, NULL);
xml_tools = glade_xml_new(get_ui_file("DeSmuMe_Dtools.glade"), NULL, NULL);
xml = glade_xml_new(get_ui_file("DeSmuMe.glade",argv[0]), NULL, NULL);
xml_tools = glade_xml_new(get_ui_file("DeSmuMe_Dtools.glade",argv[0]), NULL, NULL);
pWindow = glade_xml_get_widget(xml, "wMainW");
pDrawingArea = glade_xml_get_widget(xml, "wDraw_Main");
pDrawingArea2 = glade_xml_get_widget(xml, "wDraw_Sub");