Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(280)

Side by Side Diff: ui/base/dialogs/gtk/select_file_dialog_impl_gtk.cc

Issue 10697010: Make saving files from flash less annoying. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <gtk/gtk.h> 5 #include <gtk/gtk.h>
6 #include <map> 6 #include <map>
7 #include <set> 7 #include <set>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 GTK_FILE_CHOOSER_ACTION_SAVE, 396 GTK_FILE_CHOOSER_ACTION_SAVE,
397 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, 397 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
398 GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, 398 GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
399 NULL); 399 NULL);
400 400
401 AddFilters(GTK_FILE_CHOOSER(dialog)); 401 AddFilters(GTK_FILE_CHOOSER(dialog));
402 if (!default_path.empty()) { 402 if (!default_path.empty()) {
403 // Since the file may not already exist, we use 403 // Since the file may not already exist, we use
404 // set_current_folder() followed by set_current_name(), as per the 404 // set_current_folder() followed by set_current_name(), as per the
405 // recommendation of the GTK docs. 405 // recommendation of the GTK docs.
406 gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), 406 if (CallDirectoryExistsOnUIThread(default_path)) {
407 default_path.DirName().value().c_str()); 407 gtk_file_chooser_set_current_folder(
408 gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(dialog), 408 GTK_FILE_CHOOSER(dialog), default_path.value().c_str());
409 default_path.BaseName().value().c_str()); 409 gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(dialog), "");
410 } else {
411 gtk_file_chooser_set_current_folder(
412 GTK_FILE_CHOOSER(dialog), default_path.DirName().value().c_str());
413 gtk_file_chooser_set_current_name(
414 GTK_FILE_CHOOSER(dialog), default_path.BaseName().value().c_str());
415 }
410 } else if (!last_saved_path_->empty()) { 416 } else if (!last_saved_path_->empty()) {
411 gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), 417 gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog),
412 last_saved_path_->value().c_str()); 418 last_saved_path_->value().c_str());
413 } 419 }
414 gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dialog), FALSE); 420 gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dialog), FALSE);
415 gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(dialog), 421 gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(dialog),
416 TRUE); 422 TRUE);
417 g_signal_connect(dialog, "response", 423 g_signal_connect(dialog, "response",
418 G_CALLBACK(OnSelectSingleFileDialogResponseThunk), this); 424 G_CALLBACK(OnSelectSingleFileDialogResponseThunk), this);
419 return dialog; 425 return dialog;
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 } // namespace 553 } // namespace
548 554
549 namespace ui { 555 namespace ui {
550 556
551 SelectFileDialogImpl* SelectFileDialogImpl::NewSelectFileDialogImplGTK( 557 SelectFileDialogImpl* SelectFileDialogImpl::NewSelectFileDialogImplGTK(
552 Listener* listener, ui::SelectFilePolicy* policy) { 558 Listener* listener, ui::SelectFilePolicy* policy) {
553 return new SelectFileDialogImplGTK(listener, policy); 559 return new SelectFileDialogImplGTK(listener, policy);
554 } 560 }
555 561
556 } // namespace ui 562 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698