| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 | 8 |
| 9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 // recommendation of the GTK docs. | 431 // recommendation of the GTK docs. |
| 432 gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), | 432 gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), |
| 433 default_path.DirName().value().c_str()); | 433 default_path.DirName().value().c_str()); |
| 434 gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(dialog), | 434 gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(dialog), |
| 435 default_path.BaseName().value().c_str()); | 435 default_path.BaseName().value().c_str()); |
| 436 } else if (!last_saved_path_->empty()) { | 436 } else if (!last_saved_path_->empty()) { |
| 437 gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), | 437 gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), |
| 438 last_saved_path_->value().c_str()); | 438 last_saved_path_->value().c_str()); |
| 439 } | 439 } |
| 440 gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dialog), FALSE); | 440 gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dialog), FALSE); |
| 441 gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(dialog), |
| 442 TRUE); |
| 441 g_signal_connect(G_OBJECT(dialog), "response", | 443 g_signal_connect(G_OBJECT(dialog), "response", |
| 442 G_CALLBACK(OnSelectSingleFileDialogResponse), this); | 444 G_CALLBACK(OnSelectSingleFileDialogResponse), this); |
| 443 return dialog; | 445 return dialog; |
| 444 } | 446 } |
| 445 | 447 |
| 446 void* SelectFileDialogImpl::PopParamsForDialog(GtkWidget* dialog) { | 448 void* SelectFileDialogImpl::PopParamsForDialog(GtkWidget* dialog) { |
| 447 std::map<GtkWidget*, void*>::iterator iter = params_map_.find(dialog); | 449 std::map<GtkWidget*, void*>::iterator iter = params_map_.find(dialog); |
| 448 DCHECK(iter != params_map_.end()); | 450 DCHECK(iter != params_map_.end()); |
| 449 void* params = iter->second; | 451 void* params = iter->second; |
| 450 params_map_.erase(iter); | 452 params_map_.erase(iter); |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 // This will preserve the image's aspect ratio. | 576 // This will preserve the image's aspect ratio. |
| 575 GdkPixbuf* pixbuf = gdk_pixbuf_new_from_file_at_size(filename, kPreviewWidth, | 577 GdkPixbuf* pixbuf = gdk_pixbuf_new_from_file_at_size(filename, kPreviewWidth, |
| 576 kPreviewHeight, NULL); | 578 kPreviewHeight, NULL); |
| 577 g_free(filename); | 579 g_free(filename); |
| 578 if (pixbuf) { | 580 if (pixbuf) { |
| 579 gtk_image_set_from_pixbuf(GTK_IMAGE(dialog->preview_), pixbuf); | 581 gtk_image_set_from_pixbuf(GTK_IMAGE(dialog->preview_), pixbuf); |
| 580 g_object_unref(pixbuf); | 582 g_object_unref(pixbuf); |
| 581 } | 583 } |
| 582 gtk_file_chooser_set_preview_widget_active(chooser, pixbuf ? TRUE : FALSE); | 584 gtk_file_chooser_set_preview_widget_active(chooser, pixbuf ? TRUE : FALSE); |
| 583 } | 585 } |
| OLD | NEW |