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 // Xlib defines RootWindow | 10 // Xlib defines RootWindow |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 // The description vector may be blank, in which case we are supposed to | 312 // The description vector may be blank, in which case we are supposed to |
313 // use some sort of default description based on the filter. | 313 // use some sort of default description based on the filter. |
314 if (i < file_types_.extension_description_overrides.size()) { | 314 if (i < file_types_.extension_description_overrides.size()) { |
315 gtk_file_filter_set_name(filter, base::UTF16ToUTF8( | 315 gtk_file_filter_set_name(filter, base::UTF16ToUTF8( |
316 file_types_.extension_description_overrides[i]).c_str()); | 316 file_types_.extension_description_overrides[i]).c_str()); |
317 } else { | 317 } else { |
318 // There is no system default filter description so we use | 318 // There is no system default filter description so we use |
319 // the extensions themselves if the description is blank. | 319 // the extensions themselves if the description is blank. |
320 std::vector<std::string> fallback_labels_vector(fallback_labels.begin(), | 320 std::vector<std::string> fallback_labels_vector(fallback_labels.begin(), |
321 fallback_labels.end()); | 321 fallback_labels.end()); |
322 std::string fallback_label = JoinString(fallback_labels_vector, ','); | 322 std::string fallback_label = |
| 323 base::JoinString(fallback_labels_vector, ","); |
323 gtk_file_filter_set_name(filter, fallback_label.c_str()); | 324 gtk_file_filter_set_name(filter, fallback_label.c_str()); |
324 } | 325 } |
325 | 326 |
326 gtk_file_chooser_add_filter(chooser, filter); | 327 gtk_file_chooser_add_filter(chooser, filter); |
327 if (i == file_type_index_ - 1) | 328 if (i == file_type_index_ - 1) |
328 gtk_file_chooser_set_filter(chooser, filter); | 329 gtk_file_chooser_set_filter(chooser, filter); |
329 } | 330 } |
330 | 331 |
331 // Add the *.* filter, but only if we have added other filters (otherwise it | 332 // Add the *.* filter, but only if we have added other filters (otherwise it |
332 // is implied). | 333 // is implied). |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
627 g_free(filename); | 628 g_free(filename); |
628 if (pixbuf) { | 629 if (pixbuf) { |
629 gtk_image_set_from_pixbuf(GTK_IMAGE(preview_), pixbuf); | 630 gtk_image_set_from_pixbuf(GTK_IMAGE(preview_), pixbuf); |
630 g_object_unref(pixbuf); | 631 g_object_unref(pixbuf); |
631 } | 632 } |
632 gtk_file_chooser_set_preview_widget_active(GTK_FILE_CHOOSER(chooser), | 633 gtk_file_chooser_set_preview_widget_active(GTK_FILE_CHOOSER(chooser), |
633 pixbuf ? TRUE : FALSE); | 634 pixbuf ? TRUE : FALSE); |
634 } | 635 } |
635 | 636 |
636 } // namespace libgtk2ui | 637 } // namespace libgtk2ui |
OLD | NEW |