#include "atom/browser/ui/file_dialog.h"
-#include "atom/browser/native_window.h"
+#include "atom/browser/native_window_views.h"
#include "base/callback.h"
#include "base/files/file_util.h"
#include "base/strings/string_util.h"
const std::string& button_label,
const base::FilePath& default_path,
const Filters& filters)
- : dialog_scope_(parent_window),
+ : parent_(static_cast<atom::NativeWindowViews*>(parent_window)),
+ dialog_scope_(parent_window),
filters_(filters) {
const char* confirm_text = GTK_STOCK_OK;
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
confirm_text, GTK_RESPONSE_ACCEPT,
NULL);
- if (parent_window) {
- gfx::NativeWindow window = parent_window->GetNativeWindow();
- libgtk2ui::SetGtkTransientForAura(dialog_, window);
+ if (parent_) {
+ parent_->SetEnabled(false);
+ libgtk2ui::SetGtkTransientForAura(dialog_, parent_->GetNativeWindow());
+ gtk_window_set_modal(GTK_WINDOW(dialog_), TRUE);
}
if (action == GTK_FILE_CHOOSER_ACTION_SAVE)
if (action != GTK_FILE_CHOOSER_ACTION_OPEN)
gtk_file_chooser_set_create_folders(GTK_FILE_CHOOSER(dialog_), TRUE);
- gtk_window_set_modal(GTK_WINDOW(dialog_), TRUE);
-
if (!default_path.empty()) {
if (base::DirectoryExists(default_path)) {
gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog_),
virtual ~FileChooserDialog() {
gtk_widget_destroy(dialog_);
+ if (parent_)
+ parent_->SetEnabled(true);
}
void RunAsynchronous() {
void AddFilters(const Filters& filters);
base::FilePath AddExtensionForFilename(const gchar* filename) const;
+ atom::NativeWindowViews* parent_;
atom::NativeWindow::DialogScope dialog_scope_;
GtkWidget* dialog_;
#include "atom/browser/ui/message_box.h"
#include "atom/browser/browser.h"
-#include "atom/browser/native_window.h"
+#include "atom/browser/native_window_views.h"
#include "base/callback.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
const std::string& detail,
const gfx::ImageSkia& icon)
: dialog_scope_(parent_window),
- cancel_id_(cancel_id) {
+ cancel_id_(cancel_id),
+ parent_(static_cast<NativeWindowViews*>(parent_window)) {
// Create dialog.
dialog_ = gtk_message_dialog_new(
nullptr, // parent
}
// Parent window.
- if (parent_window) {
- gfx::NativeWindow window = parent_window->GetNativeWindow();
- libgtk2ui::SetGtkTransientForAura(dialog_, window);
+ if (parent_) {
+ parent_->SetEnabled(false);
+ libgtk2ui::SetGtkTransientForAura(dialog_, parent_->GetNativeWindow());
+ gtk_window_set_modal(GTK_WINDOW(dialog_), TRUE);
}
}
~GtkMessageBox() {
gtk_widget_destroy(dialog_);
+ if (parent_)
+ parent_->SetEnabled(true);
}
GtkMessageType GetMessageType(MessageBoxType type) {
}
int RunSynchronous() {
- gtk_window_set_modal(GTK_WINDOW(dialog_), TRUE);
Show();
int response = gtk_dialog_run(GTK_DIALOG(dialog_));
if (response < 0)
// The id to return when the dialog is closed without pressing buttons.
int cancel_id_;
+ NativeWindowViews* parent_;
GtkWidget* dialog_;
MessageBoxCallback callback_;