thunderbird/firefox-1.1-modal-filechooser.patch
2005-08-06 17:15:21 +00:00

67 lines
2.8 KiB
Diff

Index: widget/src/gtk2/nsFilePicker.cpp
===================================================================
RCS file: /cvsroot/mozilla/widget/src/gtk2/nsFilePicker.cpp,v
retrieving revision 1.10
diff -p -u -u -p -U10 -r1.10 nsFilePicker.cpp
--- widget/src/gtk2/nsFilePicker.cpp 1 Jul 2005 04:40:30 -0000 1.10
+++ widget/src/gtk2/nsFilePicker.cpp 16 Jul 2005 08:39:26 -0000
@@ -457,28 +457,32 @@ confirm_overwrite_file (GtkWidget *paren
leafName.get()
};
nsXPIDLString title, message;
bundle->GetStringFromName(NS_LITERAL_STRING("confirmTitle").get(),
getter_Copies(title));
bundle->FormatStringFromName(NS_LITERAL_STRING("confirmFileReplacing").get(),
formatStrings, NS_ARRAY_LENGTH(formatStrings),
getter_Copies(message));
+ GtkWindow *parent_window = GTK_WINDOW(parent);
GtkWidget *dialog;
- dialog = gtk_message_dialog_new(GTK_WINDOW(parent),
+ dialog = gtk_message_dialog_new(parent_window,
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_QUESTION,
GTK_BUTTONS_YES_NO,
NS_ConvertUTF16toUTF8(message).get());
gtk_window_set_title(GTK_WINDOW(dialog), NS_ConvertUTF16toUTF8(title).get());
+ if (parent_window && parent_window->group) {
+ gtk_window_group_add_window(parent_window->group, GTK_WINDOW(dialog));
+ }
PRBool result = (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_YES);
gtk_widget_destroy (dialog);
return result;
}
NS_IMETHODIMP
nsFilePicker::Show(PRInt16 *aReturn)
{
@@ -491,20 +495,24 @@ nsFilePicker::Show(PRInt16 *aReturn)
GtkFileChooserAction action = GetGtkFileChooserAction(mMode);
const gchar *accept_button = (mMode == GTK_FILE_CHOOSER_ACTION_SAVE)
? GTK_STOCK_SAVE : GTK_STOCK_OPEN;
GtkWidget *file_chooser =
_gtk_file_chooser_dialog_new(title, parent_widget, action,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
accept_button, GTK_RESPONSE_ACCEPT,
NULL);
+ if (parent_widget && parent_widget->group) {
+ gtk_window_group_add_window(parent_widget->group, GTK_WINDOW(file_chooser));
+ }
+
if (mMode == nsIFilePicker::modeOpenMultiple) {
_gtk_file_chooser_set_select_multiple (GTK_FILE_CHOOSER(file_chooser), TRUE);
} else if (mMode == nsIFilePicker::modeSave) {
char *default_filename = ToNewUTF8String(mDefault);
_gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(file_chooser),
NS_STATIC_CAST(const gchar*, default_filename));
nsMemory::Free(default_filename);
}
gtk_dialog_set_default_response(GTK_DIALOG(file_chooser), GTK_RESPONSE_ACCEPT);