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

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

Issue 6343003: [gtk] un-break status bubble. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 11 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 "chrome/browser/ui/gtk/status_bubble_gtk.h" 5 #include "chrome/browser/ui/gtk/status_bubble_gtk.h"
6 6
7 #include <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 // bubble. We should extend ui::ElideUrl to take some sort of pango font. 108 // bubble. We should extend ui::ElideUrl to take some sort of pango font.
109 url_text_ = UTF16ToUTF8(ui::ElideUrl(url_, gfx::Font(), desired_width, 109 url_text_ = UTF16ToUTF8(ui::ElideUrl(url_, gfx::Font(), desired_width,
110 UTF16ToWideHack(languages_))); 110 UTF16ToWideHack(languages_)));
111 SetStatusTextTo(url_text_); 111 SetStatusTextTo(url_text_);
112 } 112 }
113 113
114 void StatusBubbleGtk::Show() { 114 void StatusBubbleGtk::Show() {
115 // If we were going to hide, stop. 115 // If we were going to hide, stop.
116 hide_timer_.Stop(); 116 hide_timer_.Stop();
117 117
118 gtk_widget_show_all(container_.get()); 118 gtk_widget_show(container_.get());
119 if (container_->window) 119 if (container_->window)
120 gdk_window_raise(container_->window); 120 gdk_window_raise(container_->window);
121 } 121 }
122 122
123 void StatusBubbleGtk::Hide() { 123 void StatusBubbleGtk::Hide() {
124 // If we were going to expand the bubble, stop. 124 // If we were going to expand the bubble, stop.
125 expand_timer_.Stop(); 125 expand_timer_.Stop();
126 expand_animation_.reset(); 126 expand_animation_.reset();
127 127
128 gtk_widget_hide_all(container_.get()); 128 gtk_widget_hide(container_.get());
129 } 129 }
130 130
131 void StatusBubbleGtk::SetStatusTextTo(const std::string& status_utf8) { 131 void StatusBubbleGtk::SetStatusTextTo(const std::string& status_utf8) {
132 if (status_utf8.empty()) { 132 if (status_utf8.empty()) {
133 hide_timer_.Stop(); 133 hide_timer_.Stop();
134 hide_timer_.Start(base::TimeDelta::FromMilliseconds(kHideDelay), 134 hide_timer_.Start(base::TimeDelta::FromMilliseconds(kHideDelay),
135 this, &StatusBubbleGtk::Hide); 135 this, &StatusBubbleGtk::Hide);
136 } else { 136 } else {
137 gtk_label_set_text(GTK_LABEL(label_), status_utf8.c_str()); 137 gtk_label_set_text(GTK_LABEL(label_), status_utf8.c_str());
138 GtkRequisition req; 138 GtkRequisition req;
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 bool ltr = !base::i18n::IsRTL(); 246 bool ltr = !base::i18n::IsRTL();
247 247
248 label_ = gtk_label_new(NULL); 248 label_ = gtk_label_new(NULL);
249 249
250 padding_ = gtk_alignment_new(0, 0, 1, 1); 250 padding_ = gtk_alignment_new(0, 0, 1, 1);
251 gtk_alignment_set_padding(GTK_ALIGNMENT(padding_), 251 gtk_alignment_set_padding(GTK_ALIGNMENT(padding_),
252 kInternalTopBottomPadding, kInternalTopBottomPadding, 252 kInternalTopBottomPadding, kInternalTopBottomPadding,
253 kInternalLeftRightPadding + (ltr ? 0 : kCornerSize), 253 kInternalLeftRightPadding + (ltr ? 0 : kCornerSize),
254 kInternalLeftRightPadding + (ltr ? kCornerSize : 0)); 254 kInternalLeftRightPadding + (ltr ? kCornerSize : 0));
255 gtk_container_add(GTK_CONTAINER(padding_), label_); 255 gtk_container_add(GTK_CONTAINER(padding_), label_);
256 gtk_widget_show_all(padding_);
256 257
257 container_.Own(gtk_event_box_new()); 258 container_.Own(gtk_event_box_new());
258 gtk_widget_set_no_show_all(container_.get(), TRUE); 259 gtk_widget_set_no_show_all(container_.get(), TRUE);
259 gtk_util::ActAsRoundedWindow( 260 gtk_util::ActAsRoundedWindow(
260 container_.get(), gtk_util::kGdkWhite, kCornerSize, 261 container_.get(), gtk_util::kGdkWhite, kCornerSize,
261 gtk_util::ROUNDED_TOP_RIGHT, 262 gtk_util::ROUNDED_TOP_RIGHT,
262 gtk_util::BORDER_TOP | gtk_util::BORDER_RIGHT); 263 gtk_util::BORDER_TOP | gtk_util::BORDER_RIGHT);
263 gtk_widget_set_name(container_.get(), "status-bubble"); 264 gtk_widget_set_name(container_.get(), "status-bubble");
264 gtk_container_add(GTK_CONTAINER(container_.get()), padding_); 265 gtk_container_add(GTK_CONTAINER(container_.get()), padding_);
265 266
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 return FALSE; 357 return FALSE;
357 } 358 }
358 359
359 void StatusBubbleGtk::AnimationEnded(const ui::Animation* animation) { 360 void StatusBubbleGtk::AnimationEnded(const ui::Animation* animation) {
360 UpdateLabelSizeRequest(); 361 UpdateLabelSizeRequest();
361 } 362 }
362 363
363 void StatusBubbleGtk::AnimationProgressed(const ui::Animation* animation) { 364 void StatusBubbleGtk::AnimationProgressed(const ui::Animation* animation) {
364 UpdateLabelSizeRequest(); 365 UpdateLabelSizeRequest();
365 } 366 }
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