| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 gtk_file_filter_set_name(filter, mime_type.c_str()); | 292 gtk_file_filter_set_name(filter, mime_type.c_str()); |
| 293 } | 293 } |
| 294 | 294 |
| 295 gtk_file_chooser_add_filter(chooser, filter); | 295 gtk_file_chooser_add_filter(chooser, filter); |
| 296 if (i == file_type_index_ - 1) | 296 if (i == file_type_index_ - 1) |
| 297 gtk_file_chooser_set_filter(chooser, filter); | 297 gtk_file_chooser_set_filter(chooser, filter); |
| 298 } | 298 } |
| 299 | 299 |
| 300 // Add the *.* filter, but only if we have added other filters (otherwise it | 300 // Add the *.* filter, but only if we have added other filters (otherwise it |
| 301 // is implied). | 301 // is implied). |
| 302 if (file_types_.include_all_files && file_types_.extensions.size() > 0) { | 302 if (file_types_.include_all_files && !file_types_.extensions.empty()) { |
| 303 GtkFileFilter* filter = gtk_file_filter_new(); | 303 GtkFileFilter* filter = gtk_file_filter_new(); |
| 304 gtk_file_filter_add_pattern(filter, "*"); | 304 gtk_file_filter_add_pattern(filter, "*"); |
| 305 gtk_file_filter_set_name(filter, | 305 gtk_file_filter_set_name(filter, |
| 306 l10n_util::GetStringUTF8(IDS_SAVEAS_ALL_FILES).c_str()); | 306 l10n_util::GetStringUTF8(IDS_SAVEAS_ALL_FILES).c_str()); |
| 307 gtk_file_chooser_add_filter(chooser, filter); | 307 gtk_file_chooser_add_filter(chooser, filter); |
| 308 } | 308 } |
| 309 } | 309 } |
| 310 | 310 |
| 311 void SelectFileDialogImpl::FileSelected(GtkWidget* dialog, | 311 void SelectFileDialogImpl::FileSelected(GtkWidget* dialog, |
| 312 const FilePath& path) { | 312 const FilePath& path) { |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 GdkPixbuf* pixbuf = gdk_pixbuf_new_from_file_at_size(filename, kPreviewWidth, | 581 GdkPixbuf* pixbuf = gdk_pixbuf_new_from_file_at_size(filename, kPreviewWidth, |
| 582 kPreviewHeight, NULL); | 582 kPreviewHeight, NULL); |
| 583 g_free(filename); | 583 g_free(filename); |
| 584 if (pixbuf) { | 584 if (pixbuf) { |
| 585 gtk_image_set_from_pixbuf(GTK_IMAGE(preview_), pixbuf); | 585 gtk_image_set_from_pixbuf(GTK_IMAGE(preview_), pixbuf); |
| 586 g_object_unref(pixbuf); | 586 g_object_unref(pixbuf); |
| 587 } | 587 } |
| 588 gtk_file_chooser_set_preview_widget_active(GTK_FILE_CHOOSER(chooser), | 588 gtk_file_chooser_set_preview_widget_active(GTK_FILE_CHOOSER(chooser), |
| 589 pixbuf ? TRUE : FALSE); | 589 pixbuf ? TRUE : FALSE); |
| 590 } | 590 } |
| OLD | NEW |