diff options
author | kuchhal@chromium.org <kuchhal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-19 00:03:49 +0000 |
---|---|---|
committer | kuchhal@chromium.org <kuchhal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-19 00:03:49 +0000 |
commit | 0d9ad06c226e4fce7f5e68ccd41007e702881f4e (patch) | |
tree | b1b2c12523278ff70ae183a3a44e6ad0121d0ff2 | |
parent | 6f3992d8b7238283c5d7be52a64066b3674e9dc6 (diff) | |
download | chromium_src-0d9ad06c226e4fce7f5e68ccd41007e702881f4e.zip chromium_src-0d9ad06c226e4fce7f5e68ccd41007e702881f4e.tar.gz chromium_src-0d9ad06c226e4fce7f5e68ccd41007e702881f4e.tar.bz2 |
Linux crash fix.
If no browser profile is found from which we can import, disable the import
button. This was not problem on Windows since we always had IE.
BUG=14489
TEST=Rename your Firefox profile dir (~/.mozilla/firefox) and make sure that the import button is disabled on the import dialog box.
Review URL: http://codereview.chromium.org/131075
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18777 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/app/generated_resources.grd | 3 | ||||
-rw-r--r-- | chrome/browser/gtk/import_dialog_gtk.cc | 35 |
2 files changed, 29 insertions, 9 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 263d621..369f427 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -2217,6 +2217,9 @@ each locale. --> <message name="IDS_IMPORTER_GOOGLE_LOGIN_TEXT" desc="The message to be displayed on dialog"> In order to import Toolbar bookmarks into Chrome, you must be logged into your Google account. Please log in and try to import again. </message> + <message name="IDS_IMPORT_NO_PROFILE_FOUND" desc="Message displayed when we do not find any supported browser to import from."> + No supported browser found + </message> <!-- Import progress popup --> <message name="IDS_IMPORT_PROGRESS_TITLE" desc="Title for the importing progress dialog"> diff --git a/chrome/browser/gtk/import_dialog_gtk.cc b/chrome/browser/gtk/import_dialog_gtk.cc index b6cf511..4ee025e 100644 --- a/chrome/browser/gtk/import_dialog_gtk.cc +++ b/chrome/browser/gtk/import_dialog_gtk.cc @@ -34,10 +34,14 @@ ImportDialogGtk::ImportDialogGtk(GtkWindow* parent, Profile* profile) : (GtkDialogFlags) (GTK_DIALOG_MODAL | GTK_DIALOG_NO_SEPARATOR), GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, - l10n_util::GetStringUTF8(IDS_IMPORT_COMMIT).c_str(), - GTK_RESPONSE_ACCEPT, NULL); + // Add import button separately as we might need to disable it, if + // no supported browsers found. + GtkWidget* import_button = gtk_dialog_add_button(GTK_DIALOG(dialog_), + l10n_util::GetStringUTF8(IDS_IMPORT_COMMIT).c_str(), + GTK_RESPONSE_ACCEPT); + // TODO(rahulk): find how to set size properly so that the dialog // box width is at least enough to display full title. gtk_widget_set_size_request(dialog_, 300, -1); @@ -51,13 +55,6 @@ ImportDialogGtk::ImportDialogGtk(GtkWindow* parent, Profile* profile) : gtk_box_pack_start(GTK_BOX(combo_hbox), from, FALSE, FALSE, 0); combo_ = gtk_combo_box_new_text(); - int profiles_count = importer_host_->GetAvailableProfileCount(); - for (int i = 0; i < profiles_count; i++) { - std::wstring profile = importer_host_->GetSourceProfileNameAt(i); - gtk_combo_box_append_text(GTK_COMBO_BOX(combo_), - WideToUTF8(profile).c_str()); - } - gtk_combo_box_set_active(GTK_COMBO_BOX(combo_), 0); gtk_box_pack_start(GTK_BOX(combo_hbox), combo_, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(content_area), combo_hbox, FALSE, FALSE, 0); @@ -91,6 +88,26 @@ ImportDialogGtk::ImportDialogGtk(GtkWindow* parent, Profile* profile) : gtk_box_pack_start(GTK_BOX(content_area), vbox, FALSE, FALSE, 0); + // Detect any supported browsers that we can import from and fill + // up the combo box. If none found, disable all controls except cancel. + int profiles_count = importer_host_->GetAvailableProfileCount(); + if (profiles_count > 0) { + for (int i = 0; i < profiles_count; i++) { + std::wstring profile = importer_host_->GetSourceProfileNameAt(i); + gtk_combo_box_append_text(GTK_COMBO_BOX(combo_), + WideToUTF8(profile).c_str()); + } + } else { + gtk_combo_box_append_text(GTK_COMBO_BOX(combo_), + l10n_util::GetStringUTF8(IDS_IMPORT_NO_PROFILE_FOUND).c_str()); + gtk_widget_set_sensitive(bookmarks_, FALSE); + gtk_widget_set_sensitive(search_engines_, FALSE); + gtk_widget_set_sensitive(passwords_, FALSE); + gtk_widget_set_sensitive(history_, FALSE); + gtk_widget_set_sensitive(import_button, FALSE); + } + gtk_combo_box_set_active(GTK_COMBO_BOX(combo_), 0); + g_signal_connect(dialog_, "response", G_CALLBACK(HandleOnResponseDialog), this); gtk_window_set_resizable(GTK_WINDOW(dialog_), FALSE); |