| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/avatar_menu_item_gtk.h" | 5 #include "chrome/browser/ui/gtk/avatar_menu_item_gtk.h" |
| 6 | 6 |
| 7 #include <gdk/gdkkeysyms.h> | 7 #include <gdk/gdkkeysyms.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 gtk_box_pack_start(GTK_BOX(item_hbox), avatar_image, FALSE, FALSE, 0); | 224 gtk_box_pack_start(GTK_BOX(item_hbox), avatar_image, FALSE, FALSE, 0); |
| 225 | 225 |
| 226 // The user name label. | 226 // The user name label. |
| 227 GtkWidget* item_vbox = gtk_vbox_new(FALSE, 0); | 227 GtkWidget* item_vbox = gtk_vbox_new(FALSE, 0); |
| 228 GtkWidget* name_label = NULL; | 228 GtkWidget* name_label = NULL; |
| 229 base::string16 elided_name = gfx::ElideText(item_.name, | 229 base::string16 elided_name = gfx::ElideText(item_.name, |
| 230 gfx::Font(), | 230 gfx::Font(), |
| 231 kUserNameMaxWidth, | 231 kUserNameMaxWidth, |
| 232 gfx::ELIDE_AT_END); | 232 gfx::ELIDE_AT_END); |
| 233 | 233 |
| 234 name_label = theme_service->BuildLabel(UTF16ToUTF8(elided_name), | 234 name_label = theme_service->BuildLabel(base::UTF16ToUTF8(elided_name), |
| 235 ui::kGdkBlack); | 235 ui::kGdkBlack); |
| 236 if (item_.active) { | 236 if (item_.active) { |
| 237 char* markup = g_markup_printf_escaped( | 237 char* markup = g_markup_printf_escaped( |
| 238 "<span weight='bold'>%s</span>", UTF16ToUTF8(elided_name).c_str()); | 238 "<span weight='bold'>%s</span>", |
| 239 base::UTF16ToUTF8(elided_name).c_str()); |
| 239 gtk_label_set_markup(GTK_LABEL(name_label), markup); | 240 gtk_label_set_markup(GTK_LABEL(name_label), markup); |
| 240 g_free(markup); | 241 g_free(markup); |
| 241 } | 242 } |
| 242 | 243 |
| 243 gtk_misc_set_alignment(GTK_MISC(name_label), 0, 0); | 244 gtk_misc_set_alignment(GTK_MISC(name_label), 0, 0); |
| 244 gtk_box_pack_start(GTK_BOX(item_vbox), name_label, TRUE, TRUE, 0); | 245 gtk_box_pack_start(GTK_BOX(item_vbox), name_label, TRUE, TRUE, 0); |
| 245 | 246 |
| 246 // The sync status label. | 247 // The sync status label. |
| 247 status_label_ = theme_service_->BuildLabel(std::string(), ui::kGdkBlack); | 248 status_label_ = theme_service_->BuildLabel(std::string(), ui::kGdkBlack); |
| 248 char* markup = g_markup_printf_escaped( | 249 char* markup = g_markup_printf_escaped( |
| 249 "<span size='small'>%s</span>", UTF16ToUTF8(item_.sync_state).c_str()); | 250 "<span size='small'>%s</span>", |
| 251 base::UTF16ToUTF8(item_.sync_state).c_str()); |
| 250 gtk_label_set_markup(GTK_LABEL(status_label_), markup); | 252 gtk_label_set_markup(GTK_LABEL(status_label_), markup); |
| 251 g_free(markup); | 253 g_free(markup); |
| 252 gtk_misc_set_alignment(GTK_MISC(status_label_), 0, 0); | 254 gtk_misc_set_alignment(GTK_MISC(status_label_), 0, 0); |
| 253 gtk_widget_set_no_show_all(status_label_, TRUE); | 255 gtk_widget_set_no_show_all(status_label_, TRUE); |
| 254 gtk_box_pack_start(GTK_BOX(item_vbox), status_label_, FALSE, FALSE, 0); | 256 gtk_box_pack_start(GTK_BOX(item_vbox), status_label_, FALSE, FALSE, 0); |
| 255 gtk_widget_show(status_label_); | 257 gtk_widget_show(status_label_); |
| 256 | 258 |
| 257 if (item_.active) { | 259 if (item_.active) { |
| 258 // The "edit your profile" link. | 260 // The "edit your profile" link. |
| 259 edit_profile_link_ = theme_service_->BuildChromeLinkButton( | 261 edit_profile_link_ = theme_service_->BuildChromeLinkButton( |
| (...skipping 19 matching lines...) Expand all Loading... |
| 279 | 281 |
| 280 GtkSizeGroup* size_group = gtk_size_group_new(GTK_SIZE_GROUP_BOTH); | 282 GtkSizeGroup* size_group = gtk_size_group_new(GTK_SIZE_GROUP_BOTH); |
| 281 gtk_size_group_add_widget(size_group, status_label_); | 283 gtk_size_group_add_widget(size_group, status_label_); |
| 282 gtk_size_group_add_widget(size_group, link_alignment_); | 284 gtk_size_group_add_widget(size_group, link_alignment_); |
| 283 g_object_unref(size_group); | 285 g_object_unref(size_group); |
| 284 } | 286 } |
| 285 | 287 |
| 286 gtk_box_pack_start(GTK_BOX(item_hbox), item_vbox, TRUE, TRUE, 0); | 288 gtk_box_pack_start(GTK_BOX(item_hbox), item_vbox, TRUE, TRUE, 0); |
| 287 gtk_container_add(GTK_CONTAINER(widget_.get()), item_hbox); | 289 gtk_container_add(GTK_CONTAINER(widget_.get()), item_hbox); |
| 288 } | 290 } |
| OLD | NEW |