OLD | NEW |
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 12 matching lines...) Expand all Loading... |
23 #include "ui/base/gtk/gtk_signal.h" | 23 #include "ui/base/gtk/gtk_signal.h" |
24 #include "ui/base/l10n/l10n_util.h" | 24 #include "ui/base/l10n/l10n_util.h" |
25 | 25 |
26 // Implementation of SelectFileDialog that shows a Gtk common dialog for | 26 // Implementation of SelectFileDialog that shows a Gtk common dialog for |
27 // choosing a file or folder. This acts as a modal dialog. | 27 // choosing a file or folder. This acts as a modal dialog. |
28 class SelectFileDialogImplGTK : public SelectFileDialogImpl { | 28 class SelectFileDialogImplGTK : public SelectFileDialogImpl { |
29 public: | 29 public: |
30 explicit SelectFileDialogImplGTK(Listener* listener); | 30 explicit SelectFileDialogImplGTK(Listener* listener); |
31 | 31 |
32 protected: | 32 protected: |
| 33 virtual ~SelectFileDialogImplGTK(); |
| 34 |
33 // SelectFileDialog implementation. | 35 // SelectFileDialog implementation. |
34 // |params| is user data we pass back via the Listener interface. | 36 // |params| is user data we pass back via the Listener interface. |
35 virtual void SelectFileImpl(Type type, | 37 virtual void SelectFileImpl(Type type, |
36 const string16& title, | 38 const string16& title, |
37 const FilePath& default_path, | 39 const FilePath& default_path, |
38 const FileTypeInfo* file_types, | 40 const FileTypeInfo* file_types, |
39 int file_type_index, | 41 int file_type_index, |
40 const FilePath::StringType& default_extension, | 42 const FilePath::StringType& default_extension, |
41 gfx::NativeWindow owning_window, | 43 gfx::NativeWindow owning_window, |
42 void* params) OVERRIDE; | 44 void* params) OVERRIDE; |
43 | 45 |
44 private: | 46 private: |
45 virtual ~SelectFileDialogImplGTK(); | |
46 | |
47 virtual bool HasMultipleFileTypeChoicesImpl() OVERRIDE; | 47 virtual bool HasMultipleFileTypeChoicesImpl() OVERRIDE; |
48 | 48 |
49 // Add the filters from |file_types_| to |chooser|. | 49 // Add the filters from |file_types_| to |chooser|. |
50 void AddFilters(GtkFileChooser* chooser); | 50 void AddFilters(GtkFileChooser* chooser); |
51 | 51 |
52 // Notifies the listener that a single file was chosen. | 52 // Notifies the listener that a single file was chosen. |
53 void FileSelected(GtkWidget* dialog, const FilePath& path); | 53 void FileSelected(GtkWidget* dialog, const FilePath& path); |
54 | 54 |
55 // Notifies the listener that multiple files were chosen. | 55 // Notifies the listener that multiple files were chosen. |
56 void MultiFilesSelected(GtkWidget* dialog, | 56 void MultiFilesSelected(GtkWidget* dialog, |
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 GdkPixbuf* pixbuf = gdk_pixbuf_new_from_file_at_size(filename, kPreviewWidth, | 555 GdkPixbuf* pixbuf = gdk_pixbuf_new_from_file_at_size(filename, kPreviewWidth, |
556 kPreviewHeight, NULL); | 556 kPreviewHeight, NULL); |
557 g_free(filename); | 557 g_free(filename); |
558 if (pixbuf) { | 558 if (pixbuf) { |
559 gtk_image_set_from_pixbuf(GTK_IMAGE(preview_), pixbuf); | 559 gtk_image_set_from_pixbuf(GTK_IMAGE(preview_), pixbuf); |
560 g_object_unref(pixbuf); | 560 g_object_unref(pixbuf); |
561 } | 561 } |
562 gtk_file_chooser_set_preview_widget_active(GTK_FILE_CHOOSER(chooser), | 562 gtk_file_chooser_set_preview_widget_active(GTK_FILE_CHOOSER(chooser), |
563 pixbuf ? TRUE : FALSE); | 563 pixbuf ? TRUE : FALSE); |
564 } | 564 } |
OLD | NEW |