]> git.xonotic.org Git - xonotic/netradiant.git/commitdiff
Cleaning up some file dialog tidbits in Rambetter-temp-fixes branch.
authorrambetter <rambetter@8a3a26a2-13c4-0310-b231-cf6edde360e5>
Sun, 19 Dec 2010 04:12:29 +0000 (04:12 +0000)
committerrambetter <rambetter@8a3a26a2-13c4-0310-b231-cf6edde360e5>
Sun, 19 Dec 2010 04:12:29 +0000 (04:12 +0000)
Just some code maintenence.  Like removing unused local vars.

PLS MERGE TO TRUNK.

git-svn-id: https://zerowing.idsoftware.com/svn/radiant/GtkRadiant/branches/Rambetter-temp-fixes@356 8a3a26a2-13c4-0310-b231-cf6edde360e5

radiant/gtkmisc.cpp
radiant/preferences.cpp

index 9d584f43247bd93f6cc15be16da3a3ee7e29c80b..93fed4a010eea754d356efa81684dfccd6ffb891 100644 (file)
@@ -1203,13 +1203,11 @@ private:
 
 #ifdef _WIN32
 
-static int in_file_dialog = 0;
-
 typedef struct {
   gboolean open;
   OPENFILENAME *ofn;
   BOOL dlgRtnVal;
-  int done;
+  bool done;
 } win32_native_file_dialog_comms_t;
 
 DWORD WINAPI win32_native_file_dialog_thread_func(LPVOID lpParam)
@@ -1222,7 +1220,7 @@ DWORD WINAPI win32_native_file_dialog_thread_func(LPVOID lpParam)
   else {
     fileDialogComms->dlgRtnVal = GetSaveFileName(fileDialogComms->ofn);
   }
-  fileDialogComms->done = -1; // No need to synchronize around lock.
+  fileDialogComms->done = true; // No need to synchronize around lock, one-way gate.
   return 0;
 }
 
@@ -1235,14 +1233,14 @@ const char* file_dialog (void *parent, gboolean open, const char* title, const c
 {
 
 #ifdef _WIN32
+  static bool in_file_dialog = false;
   HANDLE fileDialogThreadHandle;
   win32_native_file_dialog_comms_t fileDialogComms;
-  int dialogDone;
+  bool dialogDone;
 #endif
 
   // Gtk dialog
   GtkWidget* file_sel;
-  int loop = 1;
   char *new_path = NULL;
 
   const char* r;
@@ -1258,7 +1256,7 @@ const char* file_dialog (void *parent, gboolean open, const char* title, const c
     // do that the native way
 
     if (in_file_dialog) return NULL; // Avoid recursive entry.
-    in_file_dialog = 1;
+    in_file_dialog = true;
     /* Set the members of the OPENFILENAME structure. */
     // See http://msdn.microsoft.com/en-us/library/ms646839%28v=vs.85%29.aspx .
     memset(&ofn, 0, sizeof(ofn));
@@ -1305,16 +1303,16 @@ const char* file_dialog (void *parent, gboolean open, const char* title, const c
                    0, // dwCreationFlags
                    NULL); // lpThreadId
 
-    dialogDone = 0;
+    dialogDone = false;
     while (1) {
-      // Avoid blocking indefinitely.  Another thread will set fileDialogComms->done to nonzero;
+      // Avoid blocking indefinitely.  Another thread will set fileDialogComms->done to true;
       // we don't want to be in an indefinite blocked state when this happens.  We want to break
       // out of here eventually.
       while (gtk_events_pending()) {
         gtk_main_iteration();
       }
       if (dialogDone) break;
-      if (fileDialogComms.done) dialogDone = 1; // One more loop of gtk_main_iteration() to get things in sync.
+      if (fileDialogComms.done) dialogDone = true; // One more loop of gtk_main_iteration() to get things in sync.
       // Avoid tight infinte loop, add a small amount of sleep.
       Sleep(10);
     }
@@ -1322,7 +1320,7 @@ const char* file_dialog (void *parent, gboolean open, const char* title, const c
     WaitForSingleObject(fileDialogThreadHandle, INFINITE);
     CloseHandle(fileDialogThreadHandle);
 
-    in_file_dialog = 0;
+    in_file_dialog = false;
     
     if (!fileDialogComms.dlgRtnVal) {
       return NULL; // Cancelled.
index a741e219e802d3ca219300299031077af7510d7f..821f44c38ab686704b1628790c7138905c87e5e0 100644 (file)
@@ -2218,7 +2218,7 @@ void PrefsDlg::BuildDialog ()
 
 #ifdef _WIN32
   // win32 file dialog
-  check = gtk_check_button_new_with_label (_("Use win32 file load dialog (hacky)"));
+  check = gtk_check_button_new_with_label (_("Use win32 file dialog (hacky)"));
   gtk_widget_show (check);
   // gtk_container_add (GTK_CONTAINER (vbox), check);
   gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);