diff gtk3/dw.c @ 1054:818698b4a0df

Added dw_font_choose() on GTK2 for 2.1. Also a fix on GTK3 to prevent multiple dialogs from being active.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Thu, 02 Jun 2011 10:12:08 +0000
parents 0725114533fe
children 0cd0089ee17d
line wrap: on
line diff
--- a/gtk3/dw.c	Thu Jun 02 08:19:14 2011 +0000
+++ b/gtk3/dw.c	Thu Jun 02 10:12:08 2011 +0000
@@ -2561,7 +2561,7 @@
 
 static int _dw_font_active = 0;
 
-/* Internal function to handle the color OK press */
+/* Internal function to handle the font OK press */
 static gint _gtk_font_ok(GtkWidget *widget, DWDialog *dwwait)
 {
    GtkFontSelectionDialog *fd;
@@ -2601,11 +2601,12 @@
       dw_free(fontname);
    }
    gtk_widget_destroy(GTK_WIDGET(fd));
+   _dw_font_active = 0;
    dw_dialog_dismiss(dwwait, (void *)retfont);
    return FALSE;
 }
 
-/* Internal function to handle the color Cancel press */
+/* Internal function to handle the font Cancel press */
 static gint _gtk_font_cancel(GtkWidget *widget, DWDialog *dwwait)
 {
    if(!dwwait)
@@ -2646,6 +2647,16 @@
    }
 
    DW_MUTEX_LOCK;
+   /* The DW mutex should be sufficient for
+    * insuring no thread changes this unknowingly.
+    */
+   if(_dw_font_active)
+   {
+      DW_MUTEX_UNLOCK;
+      if(name)
+         free(name);
+      return NULL;
+   }
    fd = (GtkFontSelectionDialog *)gtk_font_selection_dialog_new("Choose font");
    if(name)
    {