diff --git a/contrib/brushexport/callbacks.cpp b/contrib/brushexport/callbacks.cpp index 310c5981..b70cd66f 100644 --- a/contrib/brushexport/callbacks.cpp +++ b/contrib/brushexport/callbacks.cpp @@ -9,16 +9,9 @@ #include "support.h" #include "export.h" -// stuff from interface.cpp -void DestroyWindow(); -//! TODO hide window on close namespace callbacks { -void OnDestroy( GtkWidget* w, gpointer data ){ - DestroyWindow(); -} - static std::string s_export_path; void OnExportClicked( GtkButton* button, gpointer choose_path ){ diff --git a/contrib/brushexport/callbacks.h b/contrib/brushexport/callbacks.h index 48b8c112..e954e31d 100644 --- a/contrib/brushexport/callbacks.h +++ b/contrib/brushexport/callbacks.h @@ -3,7 +3,6 @@ typedef struct _GtkButton GtkButton; namespace callbacks { -void OnDestroy( GtkWidget *, gpointer ); void OnExportClicked( GtkButton *, gpointer ); void OnAddMaterial( GtkButton *, gpointer ); void OnRemoveMaterial( GtkButton *, gpointer ); diff --git a/contrib/brushexport/interface.cpp b/contrib/brushexport/interface.cpp index aa1b14b2..40800954 100644 --- a/contrib/brushexport/interface.cpp +++ b/contrib/brushexport/interface.cpp @@ -152,8 +152,8 @@ create_w_plugplug2( void ){ gtk_box_pack_end( GTK_BOX( vbox2 ), t_exportmaterials, FALSE, FALSE, 0 ); using namespace callbacks; - g_signal_connect( G_OBJECT( w_plugplug2 ), "destroy", G_CALLBACK( OnDestroy ), NULL ); - g_signal_connect_swapped( G_OBJECT( b_close ), "clicked", G_CALLBACK( OnDestroy ), NULL ); + g_signal_connect( G_OBJECT( w_plugplug2 ), "delete_event", G_CALLBACK( gtk_widget_hide_on_delete ), NULL ); + g_signal_connect_swapped( G_OBJECT( b_close ), "clicked", G_CALLBACK( gtk_widget_hide ), w_plugplug2 ); g_signal_connect( G_OBJECT( b_export ), "clicked", G_CALLBACK( OnExportClicked ), NULL ); g_signal_connect( G_OBJECT( b_exportAs ), "clicked", G_CALLBACK( OnExportClicked ), gpointer( 1 ) ); @@ -187,24 +187,17 @@ create_w_plugplug2( void ){ GLADE_HOOKUP_OBJECT( w_plugplug2, t_objects, "t_objects" ); GLADE_HOOKUP_OBJECT( w_plugplug2, t_weld, "t_weld" ); + gtk_widget_show_all( w_plugplug2 ); + return w_plugplug2; } // global main window, is 0 when not created GtkWidget* g_brushexp_window = 0; -// spawn plugin window (and make sure it got destroyed first or never created) +// spawn or unhide plugin window void CreateWindow( void ){ - ASSERT_NOTNULL( !g_brushexp_window ); - gtk_widget_show_all( g_brushexp_window = create_w_plugplug2() ); -} - -void DestroyWindow( void ){ - ASSERT_NOTNULL( g_brushexp_window ); - gtk_widget_destroy( g_brushexp_window ); - g_brushexp_window = 0; -} - -bool IsWindowOpen( void ){ - return g_brushexp_window != 0; + if( !g_brushexp_window ) + g_brushexp_window = create_w_plugplug2(); + gtk_widget_show( g_brushexp_window ); } diff --git a/contrib/brushexport/plugin.cpp b/contrib/brushexport/plugin.cpp index 67e1cc4c..b655bf18 100644 --- a/contrib/brushexport/plugin.cpp +++ b/contrib/brushexport/plugin.cpp @@ -45,8 +45,6 @@ #include "typesystem.h" void CreateWindow( void ); -void DestroyWindow( void ); -bool IsWindowOpen( void ); GtkWidget *g_pRadiantWnd = NULL; @@ -78,9 +76,6 @@ void dispatch( const char* command, float* vMin, float* vMax, bool bSingleBrush eMB_ICONDEFAULT ); } else if ( string_equal( command, "Export .obj" ) ) { - if ( IsWindowOpen() ) { - DestroyWindow(); - } CreateWindow(); } }