Mercurial > dwindows
comparison 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 |
comparison
equal
deleted
inserted
replaced
1053:0725114533fe | 1054:818698b4a0df |
---|---|
2559 return TRUE; | 2559 return TRUE; |
2560 } | 2560 } |
2561 | 2561 |
2562 static int _dw_font_active = 0; | 2562 static int _dw_font_active = 0; |
2563 | 2563 |
2564 /* Internal function to handle the color OK press */ | 2564 /* Internal function to handle the font OK press */ |
2565 static gint _gtk_font_ok(GtkWidget *widget, DWDialog *dwwait) | 2565 static gint _gtk_font_ok(GtkWidget *widget, DWDialog *dwwait) |
2566 { | 2566 { |
2567 GtkFontSelectionDialog *fd; | 2567 GtkFontSelectionDialog *fd; |
2568 char *retfont = NULL; | 2568 char *retfont = NULL; |
2569 gchar *fontname; | 2569 gchar *fontname; |
2599 } | 2599 } |
2600 } | 2600 } |
2601 dw_free(fontname); | 2601 dw_free(fontname); |
2602 } | 2602 } |
2603 gtk_widget_destroy(GTK_WIDGET(fd)); | 2603 gtk_widget_destroy(GTK_WIDGET(fd)); |
2604 _dw_font_active = 0; | |
2604 dw_dialog_dismiss(dwwait, (void *)retfont); | 2605 dw_dialog_dismiss(dwwait, (void *)retfont); |
2605 return FALSE; | 2606 return FALSE; |
2606 } | 2607 } |
2607 | 2608 |
2608 /* Internal function to handle the color Cancel press */ | 2609 /* Internal function to handle the font Cancel press */ |
2609 static gint _gtk_font_cancel(GtkWidget *widget, DWDialog *dwwait) | 2610 static gint _gtk_font_cancel(GtkWidget *widget, DWDialog *dwwait) |
2610 { | 2611 { |
2611 if(!dwwait) | 2612 if(!dwwait) |
2612 return FALSE; | 2613 return FALSE; |
2613 | 2614 |
2644 name++; | 2645 name++; |
2645 sprintf(font, "%s %d", name, size); | 2646 sprintf(font, "%s %d", name, size); |
2646 } | 2647 } |
2647 | 2648 |
2648 DW_MUTEX_LOCK; | 2649 DW_MUTEX_LOCK; |
2650 /* The DW mutex should be sufficient for | |
2651 * insuring no thread changes this unknowingly. | |
2652 */ | |
2653 if(_dw_font_active) | |
2654 { | |
2655 DW_MUTEX_UNLOCK; | |
2656 if(name) | |
2657 free(name); | |
2658 return NULL; | |
2659 } | |
2649 fd = (GtkFontSelectionDialog *)gtk_font_selection_dialog_new("Choose font"); | 2660 fd = (GtkFontSelectionDialog *)gtk_font_selection_dialog_new("Choose font"); |
2650 if(name) | 2661 if(name) |
2651 { | 2662 { |
2652 gtk_font_selection_dialog_set_font_name(fd, name); | 2663 gtk_font_selection_dialog_set_font_name(fd, name); |
2653 free(name); | 2664 free(name); |