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 = | 322 std::string fallback_label = JoinString(fallback_labels_vector, ','); |
323 base::JoinString(fallback_labels_vector, ","); | |
324 gtk_file_filter_set_name(filter, fallback_label.c_str()); | 323 gtk_file_filter_set_name(filter, fallback_label.c_str()); |
325 } | 324 } |
326 | 325 |
327 gtk_file_chooser_add_filter(chooser, filter); | 326 gtk_file_chooser_add_filter(chooser, filter); |
328 if (i == file_type_index_ - 1) | 327 if (i == file_type_index_ - 1) |
329 gtk_file_chooser_set_filter(chooser, filter); | 328 gtk_file_chooser_set_filter(chooser, filter); |
330 } | 329 } |
331 | 330 |
332 // Add the *.* filter, but only if we have added other filters (otherwise it | 331 // Add the *.* filter, but only if we have added other filters (otherwise it |
333 // is implied). | 332 // is implied). |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
628 g_free(filename); | 627 g_free(filename); |
629 if (pixbuf) { | 628 if (pixbuf) { |
630 gtk_image_set_from_pixbuf(GTK_IMAGE(preview_), pixbuf); | 629 gtk_image_set_from_pixbuf(GTK_IMAGE(preview_), pixbuf); |
631 g_object_unref(pixbuf); | 630 g_object_unref(pixbuf); |
632 } | 631 } |
633 gtk_file_chooser_set_preview_widget_active(GTK_FILE_CHOOSER(chooser), | 632 gtk_file_chooser_set_preview_widget_active(GTK_FILE_CHOOSER(chooser), |
634 pixbuf ? TRUE : FALSE); | 633 pixbuf ? TRUE : FALSE); |
635 } | 634 } |
636 | 635 |
637 } // namespace libgtk2ui | 636 } // namespace libgtk2ui |
OLD | NEW |