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

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

Issue 6487001: Remember the appropriate previous directory when opening a select folder dial... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 gtk_file_filter_set_name(filter, 300 gtk_file_filter_set_name(filter,
301 l10n_util::GetStringUTF8(IDS_SAVEAS_ALL_FILES).c_str()); 301 l10n_util::GetStringUTF8(IDS_SAVEAS_ALL_FILES).c_str());
302 gtk_file_chooser_add_filter(chooser, filter); 302 gtk_file_chooser_add_filter(chooser, filter);
303 } 303 }
304 } 304 }
305 305
306 void SelectFileDialogImpl::FileSelected(GtkWidget* dialog, 306 void SelectFileDialogImpl::FileSelected(GtkWidget* dialog,
307 const FilePath& path) { 307 const FilePath& path) {
308 if (type_ == SELECT_SAVEAS_FILE) 308 if (type_ == SELECT_SAVEAS_FILE)
309 *last_saved_path_ = path.DirName(); 309 *last_saved_path_ = path.DirName();
310 else if (type_ == SELECT_OPEN_FILE) 310 else if (type_ == SELECT_OPEN_FILE || type_ == SELECT_FOLDER)
311 *last_opened_path_ = path.DirName(); 311 *last_opened_path_ = path.DirName();
312 else if (type_ == SELECT_FOLDER)
313 *last_opened_path_ = path.DirName().DirName();
314 else 312 else
315 NOTREACHED(); 313 NOTREACHED();
316 314
317 if (listener_) { 315 if (listener_) {
318 GtkFileFilter* selected_filter = 316 GtkFileFilter* selected_filter =
319 gtk_file_chooser_get_filter(GTK_FILE_CHOOSER(dialog)); 317 gtk_file_chooser_get_filter(GTK_FILE_CHOOSER(dialog));
320 GSList* filters = gtk_file_chooser_list_filters(GTK_FILE_CHOOSER(dialog)); 318 GSList* filters = gtk_file_chooser_list_filters(GTK_FILE_CHOOSER(dialog));
321 int idx = g_slist_index(filters, selected_filter); 319 int idx = g_slist_index(filters, selected_filter);
322 g_slist_free(filters); 320 g_slist_free(filters);
323 listener_->FileSelected(path, idx + 1, PopParamsForDialog(dialog)); 321 listener_->FileSelected(path, idx + 1, PopParamsForDialog(dialog));
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 GdkPixbuf* pixbuf = gdk_pixbuf_new_from_file_at_size(filename, kPreviewWidth, 576 GdkPixbuf* pixbuf = gdk_pixbuf_new_from_file_at_size(filename, kPreviewWidth,
579 kPreviewHeight, NULL); 577 kPreviewHeight, NULL);
580 g_free(filename); 578 g_free(filename);
581 if (pixbuf) { 579 if (pixbuf) {
582 gtk_image_set_from_pixbuf(GTK_IMAGE(preview_), pixbuf); 580 gtk_image_set_from_pixbuf(GTK_IMAGE(preview_), pixbuf);
583 g_object_unref(pixbuf); 581 g_object_unref(pixbuf);
584 } 582 }
585 gtk_file_chooser_set_preview_widget_active(GTK_FILE_CHOOSER(chooser), 583 gtk_file_chooser_set_preview_widget_active(GTK_FILE_CHOOSER(chooser),
586 pixbuf ? TRUE : FALSE); 584 pixbuf ? TRUE : FALSE);
587 } 585 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698