Lines Matching refs:dialog
26 // the dialog, but usually not the height). The image's aspect ratio will always
31 // Implementation of SelectFileDialog that shows a Gtk common dialog for
32 // choosing a file or folder. This acts as a modal dialog.
59 void FileSelected(GtkWidget* dialog, const FilePath& path);
62 void MultiFilesSelected(GtkWidget* dialog,
66 // Dialog is passed so we can find that |params| pointer that was passed to
67 // us when we were told to show the dialog.
68 void FileNotSelected(GtkWidget* dialog);
82 // Removes and returns the |params| associated with |dialog| from
84 void* PopParamsForDialog(GtkWidget* dialog);
86 // Take care of internal data structures when a file dialog is destroyed.
87 void FileDialogDestroyed(GtkWidget* dialog);
90 // dialog. Used as a helper for the below callbacks.
95 void SelectSingleFileHelper(GtkWidget* dialog,
105 // thread. Use this only in the file dialog functions, where it's ok
106 // because the file dialog has to do many stats anyway. One more won't
110 // Callback for when the user responds to a Save As or Open File dialog.
114 // Callback for when the user responds to a Select Folder dialog.
118 // Callback for when the user responds to a Open Multiple Files dialog.
128 // A map from dialog windows to the |params| user data associated with them.
141 // The type of dialog we are showing the user.
217 GtkWidget* dialog = NULL;
220 dialog = CreateSelectFolderDialog(title_string, default_path,
224 dialog = CreateFileOpenDialog(title_string, default_path, owning_window);
227 dialog = CreateMultiFileOpenDialog(title_string, default_path,
231 dialog = CreateSaveAsDialog(title_string, default_path, owning_window);
237 dialogs_.insert(dialog);
240 g_signal_connect(dialog, "destroy",
242 g_signal_connect(dialog, "update-preview",
244 gtk_file_chooser_set_preview_widget(GTK_FILE_CHOOSER(dialog), preview_);
246 params_map_[dialog] = params;
248 // Set window-to-parent modality by adding the dialog to the same window
251 GTK_WINDOW(dialog));
252 gtk_window_set_modal(GTK_WINDOW(dialog), TRUE);
254 gtk_widget_show_all(dialog);
265 // Allow IO in the file dialog. http://crbug.com/72637
282 // Allow IO in the file dialog. http://crbug.com/72637
307 void SelectFileDialogImpl::FileSelected(GtkWidget* dialog,
318 gtk_file_chooser_get_filter(GTK_FILE_CHOOSER(dialog));
319 GSList* filters = gtk_file_chooser_list_filters(GTK_FILE_CHOOSER(dialog));
322 listener_->FileSelected(path, idx + 1, PopParamsForDialog(dialog));
324 gtk_widget_destroy(dialog);
327 void SelectFileDialogImpl::MultiFilesSelected(GtkWidget* dialog,
332 listener_->MultiFilesSelected(files, PopParamsForDialog(dialog));
333 gtk_widget_destroy(dialog);
336 void SelectFileDialogImpl::FileNotSelected(GtkWidget* dialog) {
337 void* params = PopParamsForDialog(dialog);
340 gtk_widget_destroy(dialog);
352 GtkWidget* dialog =
358 AddFilters(GTK_FILE_CHOOSER(dialog));
362 gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog),
367 gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog),
371 gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog),
374 return dialog;
384 GtkWidget* dialog =
392 gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog),
395 gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog),
398 gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dialog), FALSE);
399 g_signal_connect(dialog, "response",
401 return dialog;
410 GtkWidget* dialog = CreateFileOpenHelper(title_string, default_path, parent);
411 gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dialog), FALSE);
412 g_signal_connect(dialog, "response",
414 return dialog;
423 GtkWidget* dialog = CreateFileOpenHelper(title_string, default_path, parent);
424 gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dialog), TRUE);
425 g_signal_connect(dialog, "response",
427 return dialog;
435 GtkWidget* dialog =
442 AddFilters(GTK_FILE_CHOOSER(dialog));
447 gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog),
449 gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(dialog),
452 gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog),
455 gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dialog), FALSE);
456 gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(dialog),
458 g_signal_connect(dialog, "response",
460 return dialog;
463 void* SelectFileDialogImpl::PopParamsForDialog(GtkWidget* dialog) {
464 std::map<GtkWidget*, void*>::iterator iter = params_map_.find(dialog);
471 void SelectFileDialogImpl::FileDialogDestroyed(GtkWidget* dialog) {
472 dialogs_.erase(dialog);
479 GtkWindow* parent = gtk_window_get_transient_for(GTK_WINDOW(dialog));
499 void SelectFileDialogImpl::SelectSingleFileHelper(GtkWidget* dialog,
503 FileNotSelected(dialog);
507 gchar* filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
509 FileNotSelected(dialog);
517 FileSelected(dialog, path);
522 FileNotSelected(dialog);
524 FileSelected(dialog, path);
527 void SelectFileDialogImpl::OnSelectSingleFileDialogResponse(GtkWidget* dialog,
529 SelectSingleFileHelper(dialog, response_id, false);
532 void SelectFileDialogImpl::OnSelectSingleFolderDialogResponse(GtkWidget* dialog,
534 SelectSingleFileHelper(dialog, response_id, true);
537 void SelectFileDialogImpl::OnSelectMultiFileDialogResponse(GtkWidget* dialog,
540 FileNotSelected(dialog);
544 GSList* filenames = gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER(dialog));
546 FileNotSelected(dialog);
561 FileNotSelected(dialog);
564 MultiFilesSelected(dialog, filenames_fp);
567 void SelectFileDialogImpl::OnFileChooserDestroy(GtkWidget* dialog) {
568 FileDialogDestroyed(dialog);