Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(200)

Side by Side Diff: ui/shell_dialogs/gtk/select_file_dialog_impl_gtk.cc

Issue 18627002: Change dialog texts for folder upload to explicitly indicate it's for 'Uploading' (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: added comments Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 68
69 // Notifies the listener that multiple files were chosen. 69 // Notifies the listener that multiple files were chosen.
70 void MultiFilesSelected(GtkWidget* dialog, 70 void MultiFilesSelected(GtkWidget* dialog,
71 const std::vector<base::FilePath>& files); 71 const std::vector<base::FilePath>& files);
72 72
73 // Notifies the listener that no file was chosen (the action was canceled). 73 // Notifies the listener that no file was chosen (the action was canceled).
74 // Dialog is passed so we can find that |params| pointer that was passed to 74 // Dialog is passed so we can find that |params| pointer that was passed to
75 // us when we were told to show the dialog. 75 // us when we were told to show the dialog.
76 void FileNotSelected(GtkWidget* dialog); 76 void FileNotSelected(GtkWidget* dialog);
77 77
78 GtkWidget* CreateSelectFolderDialog(const std::string& title, 78 GtkWidget* CreateSelectFolderDialog(
79 Type type, const std::string& title,
sky 2013/07/29 16:22:34 nit: when you wrap, one param per line.
kinuko 2013/07/30 07:37:16 Done.
79 const base::FilePath& default_path, gfx::NativeWindow parent); 80 const base::FilePath& default_path, gfx::NativeWindow parent);
80 81
81 GtkWidget* CreateFileOpenDialog(const std::string& title, 82 GtkWidget* CreateFileOpenDialog(const std::string& title,
82 const base::FilePath& default_path, gfx::NativeWindow parent); 83 const base::FilePath& default_path, gfx::NativeWindow parent);
83 84
84 GtkWidget* CreateMultiFileOpenDialog(const std::string& title, 85 GtkWidget* CreateMultiFileOpenDialog(const std::string& title,
85 const base::FilePath& default_path, gfx::NativeWindow parent); 86 const base::FilePath& default_path, gfx::NativeWindow parent);
86 87
87 GtkWidget* CreateSaveAsDialog(const std::string& title, 88 GtkWidget* CreateSaveAsDialog(const std::string& title,
88 const base::FilePath& default_path, gfx::NativeWindow parent); 89 const base::FilePath& default_path, gfx::NativeWindow parent);
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 185
185 file_type_index_ = file_type_index; 186 file_type_index_ = file_type_index;
186 if (file_types) 187 if (file_types)
187 file_types_ = *file_types; 188 file_types_ = *file_types;
188 else 189 else
189 file_types_.include_all_files = true; 190 file_types_.include_all_files = true;
190 191
191 GtkWidget* dialog = NULL; 192 GtkWidget* dialog = NULL;
192 switch (type) { 193 switch (type) {
193 case SELECT_FOLDER: 194 case SELECT_FOLDER:
194 dialog = CreateSelectFolderDialog(title_string, default_path, 195 case SELECT_UPLOAD_FOLDER:
196 dialog = CreateSelectFolderDialog(type, title_string, default_path,
195 owning_window); 197 owning_window);
196 break; 198 break;
197 case SELECT_OPEN_FILE: 199 case SELECT_OPEN_FILE:
198 dialog = CreateFileOpenDialog(title_string, default_path, owning_window); 200 dialog = CreateFileOpenDialog(title_string, default_path, owning_window);
199 break; 201 break;
200 case SELECT_OPEN_MULTI_FILE: 202 case SELECT_OPEN_MULTI_FILE:
201 dialog = CreateMultiFileOpenDialog(title_string, default_path, 203 dialog = CreateMultiFileOpenDialog(title_string, default_path,
202 owning_window); 204 owning_window);
203 break; 205 break;
204 case SELECT_SAVEAS_FILE: 206 case SELECT_SAVEAS_FILE:
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 default_path.value().c_str()); 346 default_path.value().c_str());
345 } 347 }
346 } else if (!last_opened_path_->empty()) { 348 } else if (!last_opened_path_->empty()) {
347 gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), 349 gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog),
348 last_opened_path_->value().c_str()); 350 last_opened_path_->value().c_str());
349 } 351 }
350 return dialog; 352 return dialog;
351 } 353 }
352 354
353 GtkWidget* SelectFileDialogImplGTK::CreateSelectFolderDialog( 355 GtkWidget* SelectFileDialogImplGTK::CreateSelectFolderDialog(
356 Type type,
354 const std::string& title, 357 const std::string& title,
355 const base::FilePath& default_path, 358 const base::FilePath& default_path,
356 gfx::NativeWindow parent) { 359 gfx::NativeWindow parent) {
357 std::string title_string = !title.empty() ? title : 360 std::string title_string = title;
361 if (title_string.empty()) {
362 title_string = (type == SELECT_UPLOAD_FOLDER) ?
363 l10n_util::GetStringUTF8(IDS_SELECT_UPLOAD_FOLDER_DIALOG_TITLE) :
358 l10n_util::GetStringUTF8(IDS_SELECT_FOLDER_DIALOG_TITLE); 364 l10n_util::GetStringUTF8(IDS_SELECT_FOLDER_DIALOG_TITLE);
365 }
366 std::string accept_button_label = (type == SELECT_UPLOAD_FOLDER) ?
367 l10n_util::GetStringUTF8(IDS_SELECT_UPLOAD_FOLDER_DIALOG_UPLOAD_BUTTON) :
368 GTK_STOCK_OPEN;
359 369
360 GtkWidget* dialog = 370 GtkWidget* dialog =
361 gtk_file_chooser_dialog_new(title_string.c_str(), parent, 371 gtk_file_chooser_dialog_new(title_string.c_str(), parent,
362 GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, 372 GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
363 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, 373 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
364 GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, 374 accept_button_label.c_str(),
375 GTK_RESPONSE_ACCEPT,
365 NULL); 376 NULL);
366 377
367 if (!default_path.empty()) { 378 if (!default_path.empty()) {
368 gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog), 379 gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog),
369 default_path.value().c_str()); 380 default_path.value().c_str());
370 } else if (!last_opened_path_->empty()) { 381 } else if (!last_opened_path_->empty()) {
371 gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), 382 gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog),
372 last_opened_path_->value().c_str()); 383 last_opened_path_->value().c_str());
373 } 384 }
374 gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dialog), FALSE); 385 gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dialog), FALSE);
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 } // namespace 583 } // namespace
573 584
574 namespace ui { 585 namespace ui {
575 586
576 SelectFileDialogImpl* SelectFileDialogImpl::NewSelectFileDialogImplGTK( 587 SelectFileDialogImpl* SelectFileDialogImpl::NewSelectFileDialogImplGTK(
577 Listener* listener, ui::SelectFilePolicy* policy) { 588 Listener* listener, ui::SelectFilePolicy* policy) {
578 return new SelectFileDialogImplGTK(listener, policy); 589 return new SelectFileDialogImplGTK(listener, policy);
579 } 590 }
580 591
581 } // namespace ui 592 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698