OLD | NEW |
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/sad_tab_gtk.h" | 5 #include "chrome/browser/gtk/sad_tab_gtk.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "app/gfx/gtk_util.h" | 9 #include "app/gfx/gtk_util.h" |
10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 const SadTabGtkConstants& sad_tab_constants = g_sad_tab_constants.Get(); | 161 const SadTabGtkConstants& sad_tab_constants = g_sad_tab_constants.Get(); |
162 int icon_height = gdk_pixbuf_get_height(sad_tab_constants.sad_tab_bitmap); | 162 int icon_height = gdk_pixbuf_get_height(sad_tab_constants.sad_tab_bitmap); |
163 int icon_y = ((height_ - icon_height) / 2) + kSadTabOffset; | 163 int icon_y = ((height_ - icon_height) / 2) + kSadTabOffset; |
164 gtk_alignment_set_padding(GTK_ALIGNMENT(top_padding_), std::max(icon_y, 0), | 164 gtk_alignment_set_padding(GTK_ALIGNMENT(top_padding_), std::max(icon_y, 0), |
165 0, kTabHorzMargin, kTabHorzMargin); | 165 0, kTabHorzMargin, kTabHorzMargin); |
166 } | 166 } |
167 | 167 |
168 // Only readjust width for message if width of widget has changed. | 168 // Only readjust width for message if width of widget has changed. |
169 if (allocation->width != 0 && allocation->width != width_) { | 169 if (allocation->width != 0 && allocation->width != width_) { |
170 width_ = allocation->width; | 170 width_ = allocation->width; |
171 // Set width for wrappable message. | 171 // If necessary, set width for wrappable message. |
172 gtk_widget_set_size_request(message_, width_ - (kTabHorzMargin * 2), -1); | 172 int message_width = width_ - (kTabHorzMargin * 2); |
| 173 if (message_width > -1) |
| 174 gtk_widget_set_size_request(message_, message_width, -1); |
173 } | 175 } |
174 } | 176 } |
175 | 177 |
176 // static | 178 // static |
177 void SadTabGtk::OnLinkButtonClick(GtkWidget* button, const char* url) { | 179 void SadTabGtk::OnLinkButtonClick(GtkWidget* button, const char* url) { |
178 BrowserList::GetLastActive()->OpenURL(GURL(url), GURL(), CURRENT_TAB, | 180 BrowserList::GetLastActive()->OpenURL(GURL(url), GURL(), CURRENT_TAB, |
179 PageTransition::LINK); | 181 PageTransition::LINK); |
180 } | 182 } |
OLD | NEW |