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

Side by Side Diff: chrome/browser/ui/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, 5 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
« no previous file with comments | « chrome/browser/file_select_helper.cc ('k') | chrome/browser/ui/views/select_file_dialog_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 GTK_FILE_CHOOSER_ACTION_SAVE, 397 GTK_FILE_CHOOSER_ACTION_SAVE,
398 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, 398 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
399 GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, 399 GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
400 NULL); 400 NULL);
401 401
402 AddFilters(GTK_FILE_CHOOSER(dialog)); 402 AddFilters(GTK_FILE_CHOOSER(dialog));
403 if (!default_path.empty()) { 403 if (!default_path.empty()) {
404 // Since the file may not already exist, we use 404 // Since the file may not already exist, we use
405 // set_current_folder() followed by set_current_name(), as per the 405 // set_current_folder() followed by set_current_name(), as per the
406 // recommendation of the GTK docs. 406 // recommendation of the GTK docs.
407 gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), 407 if (CallDirectoryExistsOnUIThread(default_path)) {
408 default_path.DirName().value().c_str()); 408 gtk_file_chooser_set_current_folder(
409 gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(dialog), 409 GTK_FILE_CHOOSER(dialog), default_path.value().c_str());
410 default_path.BaseName().value().c_str()); 410 gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(dialog), "");
Evan Stade 2012/07/02 18:59:41 is this line necessary?
411 } else {
412 gtk_file_chooser_set_current_folder(
413 GTK_FILE_CHOOSER(dialog), default_path.DirName().value().c_str());
414 gtk_file_chooser_set_current_name(
415 GTK_FILE_CHOOSER(dialog), default_path.BaseName().value().c_str());
416 }
411 } else if (!last_saved_path_->empty()) { 417 } else if (!last_saved_path_->empty()) {
412 gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), 418 gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog),
413 last_saved_path_->value().c_str()); 419 last_saved_path_->value().c_str());
414 } 420 }
415 gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dialog), FALSE); 421 gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dialog), FALSE);
416 gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(dialog), 422 gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(dialog),
417 TRUE); 423 TRUE);
418 g_signal_connect(dialog, "response", 424 g_signal_connect(dialog, "response",
419 G_CALLBACK(OnSelectSingleFileDialogResponseThunk), this); 425 G_CALLBACK(OnSelectSingleFileDialogResponseThunk), this);
420 return dialog; 426 return dialog;
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 GdkPixbuf* pixbuf = gdk_pixbuf_new_from_file_at_size(filename, kPreviewWidth, 543 GdkPixbuf* pixbuf = gdk_pixbuf_new_from_file_at_size(filename, kPreviewWidth,
538 kPreviewHeight, NULL); 544 kPreviewHeight, NULL);
539 g_free(filename); 545 g_free(filename);
540 if (pixbuf) { 546 if (pixbuf) {
541 gtk_image_set_from_pixbuf(GTK_IMAGE(preview_), pixbuf); 547 gtk_image_set_from_pixbuf(GTK_IMAGE(preview_), pixbuf);
542 g_object_unref(pixbuf); 548 g_object_unref(pixbuf);
543 } 549 }
544 gtk_file_chooser_set_preview_widget_active(GTK_FILE_CHOOSER(chooser), 550 gtk_file_chooser_set_preview_widget_active(GTK_FILE_CHOOSER(chooser),
545 pixbuf ? TRUE : FALSE); 551 pixbuf ? TRUE : FALSE);
546 } 552 }
OLDNEW
« no previous file with comments | « chrome/browser/file_select_helper.cc ('k') | chrome/browser/ui/views/select_file_dialog_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698