Commit 0b71de7a authored by thestig@chromium.org's avatar thestig@chromium.org

Media Galleries: Update tooltips in permission dialogs when galleries change.

TEST=In the media gallery permission dialog, hover over the gallery entry for a
USB drive and see a path. Unplug the device and hover over the now detached
gallery should no longer show a tooltip.

Review URL: https://chromiumcodereview.appspot.com/12090078

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@180049 0039d316-1c4b-4281-b951-d872f2087c98
parent 4a03789f
...@@ -101,14 +101,15 @@ void MediaGalleriesDialogGtk::UpdateGallery( ...@@ -101,14 +101,15 @@ void MediaGalleriesDialogGtk::UpdateGallery(
widget = iter->second; widget = iter->second;
} else { } else {
widget = gtk_check_button_new(); widget = gtk_check_button_new();
gtk_widget_set_tooltip_text(widget, UTF16ToUTF8(
MediaGalleriesDialogController::GetGalleryTooltip(*gallery)).c_str());
g_signal_connect(widget, "toggled", G_CALLBACK(OnToggledThunk), this); g_signal_connect(widget, "toggled", G_CALLBACK(OnToggledThunk), this);
gtk_box_pack_start(GTK_BOX(checkbox_container_), widget, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(checkbox_container_), widget, FALSE, FALSE, 0);
gtk_widget_show(widget); gtk_widget_show(widget);
checkbox_map_[gallery] = widget; checkbox_map_[gallery] = widget;
} }
gtk_widget_set_tooltip_text(widget, UTF16ToUTF8(
MediaGalleriesDialogController::GetGalleryTooltip(*gallery)).c_str());
base::AutoReset<bool> reset(&ignore_toggles_, true); base::AutoReset<bool> reset(&ignore_toggles_, true);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), permitted); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), permitted);
std::string label_text = UTF16ToUTF8( std::string label_text = UTF16ToUTF8(
...@@ -135,7 +136,7 @@ void MediaGalleriesDialogGtk::OnToggled(GtkWidget* widget) { ...@@ -135,7 +136,7 @@ void MediaGalleriesDialogGtk::OnToggled(GtkWidget* widget) {
if (ignore_toggles_) if (ignore_toggles_)
return; return;
for (CheckboxMap::iterator iter = checkbox_map_.begin(); for (CheckboxMap::const_iterator iter = checkbox_map_.begin();
iter != checkbox_map_.end(); ++iter) { iter != checkbox_map_.end(); ++iter) {
if (iter->second == widget) { if (iter->second == widget) {
controller_->DidToggleGallery( controller_->DidToggleGallery(
......
...@@ -108,18 +108,20 @@ bool MediaGalleriesDialogViews::AddOrUpdateGallery( ...@@ -108,18 +108,20 @@ bool MediaGalleriesDialogViews::AddOrUpdateGallery(
bool permitted) { bool permitted) {
string16 label = string16 label =
MediaGalleriesDialogController::GetGalleryDisplayName(*gallery); MediaGalleriesDialogController::GetGalleryDisplayName(*gallery);
string16 tooltip_text =
MediaGalleriesDialogController::GetGalleryTooltip(*gallery);
CheckboxMap::iterator iter = checkbox_map_.find(gallery); CheckboxMap::iterator iter = checkbox_map_.find(gallery);
if (iter != checkbox_map_.end()) { if (iter != checkbox_map_.end()) {
views::Checkbox* checkbox = iter->second; views::Checkbox* checkbox = iter->second;
checkbox->SetChecked(permitted); checkbox->SetChecked(permitted);
checkbox->SetText(label); checkbox->SetText(label);
checkbox->SetTooltipText(tooltip_text);
return false; return false;
} }
views::Checkbox* checkbox = new views::Checkbox(label); views::Checkbox* checkbox = new views::Checkbox(label);
checkbox->set_listener(this); checkbox->set_listener(this);
checkbox->SetTooltipText( checkbox->SetTooltipText(tooltip_text);
MediaGalleriesDialogController::GetGalleryTooltip(*gallery));
checkbox_container_->AddChildView(checkbox); checkbox_container_->AddChildView(checkbox);
checkbox->SetChecked(permitted); checkbox->SetChecked(permitted);
checkbox_map_[gallery] = checkbox; checkbox_map_[gallery] = checkbox;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment