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

Side by Side Diff: chrome/browser/ui/gtk/dialogs_gtk.cc

Issue 6627038: gtk: Rename OnDialogResponse() to OnResponse() to standardize on a consistent naming scheme. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 9 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) 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 gfx::NativeWindow parent); 102 gfx::NativeWindow parent);
103 103
104 // Wrapper for file_util::DirectoryExists() that allow access on the UI 104 // Wrapper for file_util::DirectoryExists() that allow access on the UI
105 // thread. Use this only in the file dialog functions, where it's ok 105 // thread. Use this only in the file dialog functions, where it's ok
106 // because the file dialog has to do many stats anyway. One more won't 106 // because the file dialog has to do many stats anyway. One more won't
107 // hurt too badly and it's likely already cached. 107 // hurt too badly and it's likely already cached.
108 bool CallDirectoryExistsOnUIThread(const FilePath& path); 108 bool CallDirectoryExistsOnUIThread(const FilePath& path);
109 109
110 // Callback for when the user responds to a Save As or Open File dialog. 110 // Callback for when the user responds to a Save As or Open File dialog.
111 CHROMEGTK_CALLBACK_1(SelectFileDialogImpl, void, 111 CHROMEGTK_CALLBACK_1(SelectFileDialogImpl, void,
112 OnSelectSingleFileDialogResponse, gint); 112 OnSelectSingleFileDialogResponse, int);
113 113
114 // Callback for when the user responds to a Select Folder dialog. 114 // Callback for when the user responds to a Select Folder dialog.
115 CHROMEGTK_CALLBACK_1(SelectFileDialogImpl, void, 115 CHROMEGTK_CALLBACK_1(SelectFileDialogImpl, void,
116 OnSelectSingleFolderDialogResponse, gint); 116 OnSelectSingleFolderDialogResponse, int);
117 117
118 // Callback for when the user responds to a Open Multiple Files dialog. 118 // Callback for when the user responds to a Open Multiple Files dialog.
119 CHROMEGTK_CALLBACK_1(SelectFileDialogImpl, void, 119 CHROMEGTK_CALLBACK_1(SelectFileDialogImpl, void,
120 OnSelectMultiFileDialogResponse, gint); 120 OnSelectMultiFileDialogResponse, int);
121 121
122 // Callback for when the file chooser gets destroyed. 122 // Callback for when the file chooser gets destroyed.
123 CHROMEGTK_CALLBACK_0(SelectFileDialogImpl, void, OnFileChooserDestroy); 123 CHROMEGTK_CALLBACK_0(SelectFileDialogImpl, void, OnFileChooserDestroy);
124 124
125 // Callback for when we update the preview for the selection. 125 // Callback for when we update the preview for the selection.
126 CHROMEGTK_CALLBACK_0(SelectFileDialogImpl, void, OnUpdatePreview); 126 CHROMEGTK_CALLBACK_0(SelectFileDialogImpl, void, OnUpdatePreview);
127 127
128 // The listener to be notified of selection completion. 128 // The listener to be notified of selection completion.
129 Listener* listener_; 129 Listener* listener_;
130 130
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 FileSelected(dialog, path); 521 FileSelected(dialog, path);
522 return; 522 return;
523 } 523 }
524 524
525 if (CallDirectoryExistsOnUIThread(path)) 525 if (CallDirectoryExistsOnUIThread(path))
526 FileNotSelected(dialog); 526 FileNotSelected(dialog);
527 else 527 else
528 FileSelected(dialog, path); 528 FileSelected(dialog, path);
529 } 529 }
530 530
531 void SelectFileDialogImpl::OnSelectSingleFileDialogResponse( 531 void SelectFileDialogImpl::OnSelectSingleFileDialogResponse(GtkWidget* dialog,
532 GtkWidget* dialog, gint response_id) { 532 int response_id) {
533 return SelectSingleFileHelper(dialog, response_id, false); 533 return SelectSingleFileHelper(dialog, response_id, false);
534 } 534 }
535 535
536 void SelectFileDialogImpl::OnSelectSingleFolderDialogResponse( 536 void SelectFileDialogImpl::OnSelectSingleFolderDialogResponse(GtkWidget* dialog,
537 GtkWidget* dialog, gint response_id) { 537 int response_id) {
538 return SelectSingleFileHelper(dialog, response_id, true); 538 return SelectSingleFileHelper(dialog, response_id, true);
539 } 539 }
540 540
541 void SelectFileDialogImpl::OnSelectMultiFileDialogResponse( 541 void SelectFileDialogImpl::OnSelectMultiFileDialogResponse(GtkWidget* dialog,
542 GtkWidget* dialog, gint response_id) { 542 int response_id) {
543 if (IsCancelResponse(response_id)) { 543 if (IsCancelResponse(response_id)) {
544 FileNotSelected(dialog); 544 FileNotSelected(dialog);
545 return; 545 return;
546 } 546 }
547 547
548 GSList* filenames = gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER(dialog)); 548 GSList* filenames = gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER(dialog));
549 if (!filenames) { 549 if (!filenames) {
550 FileNotSelected(dialog); 550 FileNotSelected(dialog);
551 return; 551 return;
552 } 552 }
(...skipping 28 matching lines...) Expand all
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698