From 082d0ab8d606a4aec4996cca76729fd5d49f7c47 Mon Sep 17 00:00:00 2001 From: TTimo Date: Sat, 23 Aug 2008 20:16:04 +0000 Subject: [PATCH] saving out some old win32 portability work git-svn-id: svn://svn.icculus.org/gtkradiant/GtkRadiant/branches/timo-win32@306 8a3a26a2-13c4-0310-b231-cf6edde360e5 --- radiant.sln | 2 ++ radiant/gtkmisc.cpp | 11 ++++++----- radiant/missing.cpp | 9 ++++++--- radiant/preferences.cpp | 4 ++-- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/radiant.sln b/radiant.sln index f4ace9f..f81e5a4 100644 --- a/radiant.sln +++ b/radiant.sln @@ -9,6 +9,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "radiant", "radiant\radiant. {DC2F2B6B-2596-4B90-88CE-2FDE4C2FFB01} = {DC2F2B6B-2596-4B90-88CE-2FDE4C2FFB01} {0B522841-BDCC-493A-BA5C-604AE2CD5756} = {0B522841-BDCC-493A-BA5C-604AE2CD5756} {3886C418-A41E-4AFF-BBD1-8E1E508920C9} = {3886C418-A41E-4AFF-BBD1-8E1E508920C9} + {444E6FDA-83BD-49F1-89A4-7CF716F742A8} = {444E6FDA-83BD-49F1-89A4-7CF716F742A8} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "synapse", "libs\synapse\synapse.vcproj", "{E13CCFB0-A366-4EF3-A66F-C374B563E4DF}" @@ -72,6 +73,7 @@ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "q3map2", "tools\quake3\q3map2\q3map2.vcproj", "{F5D0509C-80E0-49B7-B033-885D8253063A}" ProjectSection(ProjectDependencies) = postProject {DC2F2B6B-2596-4B90-88CE-2FDE4C2FFB01} = {DC2F2B6B-2596-4B90-88CE-2FDE4C2FFB01} + {444E6FDA-83BD-49F1-89A4-7CF716F742A8} = {444E6FDA-83BD-49F1-89A4-7CF716F742A8} EndProjectSection EndProject Global diff --git a/radiant/gtkmisc.cpp b/radiant/gtkmisc.cpp index bf17319..9147ee3 100644 --- a/radiant/gtkmisc.cpp +++ b/radiant/gtkmisc.cpp @@ -1474,8 +1474,9 @@ char* WINAPI dir_dialog (void *parent, const char* title, const char* path) GTK_SIGNAL_FUNC (dialog_delete_callback), NULL); gtk_file_selection_hide_fileop_buttons (GTK_FILE_SELECTION (file_sel)); - if (parent != NULL) - gtk_window_set_transient_for (GTK_WINDOW (file_sel), GTK_WINDOW (parent)); + if ( parent != NULL ) { + gtk_window_set_transient_for( GTK_WINDOW( file_sel ), GTK_WINDOW( parent ) ); + } gtk_widget_hide (GTK_FILE_SELECTION (file_sel)->file_list->parent); @@ -1491,10 +1492,10 @@ char* WINAPI dir_dialog (void *parent, const char* title, const char* path) while (loop) gtk_main_iteration (); - filename = g_strdup(gtk_file_selection_get_filename (GTK_FILE_SELECTION (file_sel))); + filename = g_strdup( gtk_file_selection_get_filename( GTK_FILE_SELECTION( file_sel ) ) ); - gtk_grab_remove (file_sel); - gtk_widget_destroy (file_sel); + gtk_grab_remove( file_sel ); + gtk_widget_destroy( file_sel ); return filename; } diff --git a/radiant/missing.cpp b/radiant/missing.cpp index 0245ec1..a296590 100644 --- a/radiant/missing.cpp +++ b/radiant/missing.cpp @@ -205,11 +205,11 @@ EPathCheck CheckFile( const char *path ) { } bool radCreateDirectory( const char *directory ) { - return CreateDirectory( directory, NULL ); + return ( CreateDirectory( directory, NULL ) != 0 ); } bool radCopyFile( const char *lpExistingFileName, const char *lpNewFileName ) { - return CopyFile( lpExistingFileName, lpNewFileName, FALSE ); + return ( CopyFile( lpExistingFileName, lpNewFileName, FALSE ) != 0 ); } #endif @@ -236,7 +236,10 @@ bool CopyTree( const char *source, const char *dest ) { switch ( CheckFile( srcEntry.GetBuffer() ) ) { case PATH_DIRECTORY: { if ( CheckFile( dstEntry.GetBuffer() ) == PATH_FAIL ) { - radCreateDirectory( dstEntry.GetBuffer() ); + if ( !radCreateDirectory( dstEntry.GetBuffer() ) ) { + Sys_Printf( "create directory %s failed\n", dstEntry.GetBuffer() ); + return false; + } } bool ret; ret = CopyTree( srcEntry.GetBuffer(), dstEntry.GetBuffer() ); diff --git a/radiant/preferences.cpp b/radiant/preferences.cpp index df20d71..5799520 100644 --- a/radiant/preferences.cpp +++ b/radiant/preferences.cpp @@ -3171,14 +3171,14 @@ void CGameInstall::OnBtnBrowseEngine( GtkWidget *widget, gpointer data ) { Sys_Printf( "OnBtnBrowseEngine\n" ); CGameInstall* i = static_cast( data ); - char *dir = dir_dialog( widget, "Select game directory", NULL ); + char *dir = dir_dialog( i->m_pWidget, "Select game directory", NULL ); i->UpdateData( TRUE ); if ( dir != NULL ) { i->m_strEngine = dir; i->UpdateData( FALSE ); - free( dir ); + g_free( dir ); } }