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

Side by Side Diff: chrome/browser/gtk/import_dialog_gtk.cc

Issue 259028: Set the default action of the import data dialog to "Import" and (Closed)
Patch Set: Created 11 years, 2 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
« 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "chrome/browser/gtk/import_dialog_gtk.h" 5 #include "chrome/browser/gtk/import_dialog_gtk.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "app/resource_bundle.h" 8 #include "app/resource_bundle.h"
9 #include "chrome/common/gtk_util.h" 9 #include "chrome/common/gtk_util.h"
10 #include "grit/generated_resources.h" 10 #include "grit/generated_resources.h"
(...skipping 24 matching lines...) Expand all
35 GTK_STOCK_CANCEL, 35 GTK_STOCK_CANCEL,
36 GTK_RESPONSE_REJECT, 36 GTK_RESPONSE_REJECT,
37 NULL); 37 NULL);
38 importer_host_->set_parent_window(GTK_WINDOW(dialog_)); 38 importer_host_->set_parent_window(GTK_WINDOW(dialog_));
39 39
40 // Add import button separately as we might need to disable it, if 40 // Add import button separately as we might need to disable it, if
41 // no supported browsers found. 41 // no supported browsers found.
42 GtkWidget* import_button = gtk_util::AddButtonToDialog(dialog_, 42 GtkWidget* import_button = gtk_util::AddButtonToDialog(dialog_,
43 l10n_util::GetStringUTF8(IDS_IMPORT_COMMIT).c_str(), 43 l10n_util::GetStringUTF8(IDS_IMPORT_COMMIT).c_str(),
44 GTK_STOCK_APPLY, GTK_RESPONSE_ACCEPT); 44 GTK_STOCK_APPLY, GTK_RESPONSE_ACCEPT);
45 GTK_WIDGET_SET_FLAGS(import_button, GTK_CAN_DEFAULT);
46 gtk_dialog_set_default_response(GTK_DIALOG(dialog_), GTK_RESPONSE_ACCEPT);
45 47
46 // TODO(rahulk): find how to set size properly so that the dialog 48 // TODO(rahulk): find how to set size properly so that the dialog
47 // box width is at least enough to display full title. 49 // box width is at least enough to display full title.
48 gtk_widget_set_size_request(dialog_, 300, -1); 50 gtk_widget_set_size_request(dialog_, 300, -1);
49 51
50 GtkWidget* content_area = GTK_DIALOG(dialog_)->vbox; 52 GtkWidget* content_area = GTK_DIALOG(dialog_)->vbox;
51 gtk_box_set_spacing(GTK_BOX(content_area), gtk_util::kContentAreaSpacing); 53 gtk_box_set_spacing(GTK_BOX(content_area), gtk_util::kContentAreaSpacing);
52 54
53 GtkWidget* combo_hbox = gtk_hbox_new(FALSE, gtk_util::kLabelSpacing); 55 GtkWidget* combo_hbox = gtk_hbox_new(FALSE, gtk_util::kLabelSpacing);
54 GtkWidget* from = gtk_label_new( 56 GtkWidget* from = gtk_label_new(
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 93
92 // Detect any supported browsers that we can import from and fill 94 // Detect any supported browsers that we can import from and fill
93 // up the combo box. If none found, disable all controls except cancel. 95 // up the combo box. If none found, disable all controls except cancel.
94 int profiles_count = importer_host_->GetAvailableProfileCount(); 96 int profiles_count = importer_host_->GetAvailableProfileCount();
95 if (profiles_count > 0) { 97 if (profiles_count > 0) {
96 for (int i = 0; i < profiles_count; i++) { 98 for (int i = 0; i < profiles_count; i++) {
97 std::wstring profile = importer_host_->GetSourceProfileNameAt(i); 99 std::wstring profile = importer_host_->GetSourceProfileNameAt(i);
98 gtk_combo_box_append_text(GTK_COMBO_BOX(combo_), 100 gtk_combo_box_append_text(GTK_COMBO_BOX(combo_),
99 WideToUTF8(profile).c_str()); 101 WideToUTF8(profile).c_str());
100 } 102 }
103 gtk_widget_grab_focus(import_button);
101 } else { 104 } else {
102 gtk_combo_box_append_text(GTK_COMBO_BOX(combo_), 105 gtk_combo_box_append_text(GTK_COMBO_BOX(combo_),
103 l10n_util::GetStringUTF8(IDS_IMPORT_NO_PROFILE_FOUND).c_str()); 106 l10n_util::GetStringUTF8(IDS_IMPORT_NO_PROFILE_FOUND).c_str());
104 gtk_widget_set_sensitive(bookmarks_, FALSE); 107 gtk_widget_set_sensitive(bookmarks_, FALSE);
105 gtk_widget_set_sensitive(search_engines_, FALSE); 108 gtk_widget_set_sensitive(search_engines_, FALSE);
106 gtk_widget_set_sensitive(passwords_, FALSE); 109 gtk_widget_set_sensitive(passwords_, FALSE);
107 gtk_widget_set_sensitive(history_, FALSE); 110 gtk_widget_set_sensitive(history_, FALSE);
108 gtk_widget_set_sensitive(import_button, FALSE); 111 gtk_widget_set_sensitive(import_button, FALSE);
109 } 112 }
110 gtk_combo_box_set_active(GTK_COMBO_BOX(combo_), 0); 113 gtk_combo_box_set_active(GTK_COMBO_BOX(combo_), 0);
(...skipping 23 matching lines...) Expand all
134 const ProfileInfo& source_profile = 137 const ProfileInfo& source_profile =
135 importer_host_->GetSourceProfileInfoAt( 138 importer_host_->GetSourceProfileInfoAt(
136 gtk_combo_box_get_active(GTK_COMBO_BOX(combo_))); 139 gtk_combo_box_get_active(GTK_COMBO_BOX(combo_)));
137 StartImportingWithUI(parent_, items, importer_host_.get(), 140 StartImportingWithUI(parent_, items, importer_host_.get(),
138 source_profile, profile_, this, false); 141 source_profile, profile_, this, false);
139 } 142 }
140 } else { 143 } else {
141 ImportCanceled(); 144 ImportCanceled();
142 } 145 }
143 } 146 }
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