Annotation of /trunk/mozilla-firefox/patches/mozilla-firefox-1.0.7-modal-filechooser.patch
Parent Directory | Revision Log
Revision 153 -
(hide annotations)
(download)
Tue May 8 20:52:56 2007 UTC (17 years, 4 months ago) by niro
File size: 2896 byte(s)
Tue May 8 20:52:56 2007 UTC (17 years, 4 months ago) by niro
File size: 2896 byte(s)
-import
1 | niro | 153 | Index: widget/src/gtk2/nsFilePicker.cpp |
2 | =================================================================== | ||
3 | RCS file: /cvsroot/mozilla/widget/src/gtk2/nsFilePicker.cpp,v | ||
4 | retrieving revision 1.10 | ||
5 | diff -p -u -u -p -U10 -r1.10 nsFilePicker.cpp | ||
6 | --- widget/src/gtk2/nsFilePicker.cpp 1 Jul 2005 04:40:30 -0000 1.10 | ||
7 | +++ widget/src/gtk2/nsFilePicker.cpp 16 Jul 2005 08:39:26 -0000 | ||
8 | @@ -457,28 +457,32 @@ confirm_overwrite_file (GtkWidget *paren | ||
9 | leafName.get() | ||
10 | }; | ||
11 | |||
12 | nsXPIDLString title, message; | ||
13 | bundle->GetStringFromName(NS_LITERAL_STRING("confirmTitle").get(), | ||
14 | getter_Copies(title)); | ||
15 | bundle->FormatStringFromName(NS_LITERAL_STRING("confirmFileReplacing").get(), | ||
16 | formatStrings, NS_ARRAY_LENGTH(formatStrings), | ||
17 | getter_Copies(message)); | ||
18 | |||
19 | + GtkWindow *parent_window = GTK_WINDOW(parent); | ||
20 | GtkWidget *dialog; | ||
21 | |||
22 | - dialog = gtk_message_dialog_new(GTK_WINDOW(parent), | ||
23 | + dialog = gtk_message_dialog_new(parent_window, | ||
24 | GTK_DIALOG_DESTROY_WITH_PARENT, | ||
25 | GTK_MESSAGE_QUESTION, | ||
26 | GTK_BUTTONS_YES_NO, | ||
27 | NS_ConvertUTF16toUTF8(message).get()); | ||
28 | gtk_window_set_title(GTK_WINDOW(dialog), NS_ConvertUTF16toUTF8(title).get()); | ||
29 | + if (parent_window && parent_window->group) { | ||
30 | + gtk_window_group_add_window(parent_window->group, GTK_WINDOW(dialog)); | ||
31 | + } | ||
32 | |||
33 | PRBool result = (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_YES); | ||
34 | gtk_widget_destroy (dialog); | ||
35 | |||
36 | return result; | ||
37 | } | ||
38 | |||
39 | NS_IMETHODIMP | ||
40 | nsFilePicker::Show(PRInt16 *aReturn) | ||
41 | { | ||
42 | @@ -491,20 +495,24 @@ nsFilePicker::Show(PRInt16 *aReturn) | ||
43 | |||
44 | GtkFileChooserAction action = GetGtkFileChooserAction(mMode); | ||
45 | const gchar *accept_button = (mMode == GTK_FILE_CHOOSER_ACTION_SAVE) | ||
46 | ? GTK_STOCK_SAVE : GTK_STOCK_OPEN; | ||
47 | GtkWidget *file_chooser = | ||
48 | _gtk_file_chooser_dialog_new(title, parent_widget, action, | ||
49 | GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, | ||
50 | accept_button, GTK_RESPONSE_ACCEPT, | ||
51 | NULL); | ||
52 | |||
53 | + if (parent_widget && parent_widget->group) { | ||
54 | + gtk_window_group_add_window(parent_widget->group, GTK_WINDOW(file_chooser)); | ||
55 | + } | ||
56 | + | ||
57 | if (mMode == nsIFilePicker::modeOpenMultiple) { | ||
58 | _gtk_file_chooser_set_select_multiple (GTK_FILE_CHOOSER(file_chooser), TRUE); | ||
59 | } else if (mMode == nsIFilePicker::modeSave) { | ||
60 | char *default_filename = ToNewUTF8String(mDefault); | ||
61 | _gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(file_chooser), | ||
62 | NS_STATIC_CAST(const gchar*, default_filename)); | ||
63 | nsMemory::Free(default_filename); | ||
64 | } | ||
65 | |||
66 | gtk_dialog_set_default_response(GTK_DIALOG(file_chooser), GTK_RESPONSE_ACCEPT); |