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_bubble_gtk.h" | 5 #include "chrome/browser/ui/gtk/avatar_menu_bubble_gtk.h" |
6 | 6 |
7 #include "base/i18n/rtl.h" | 7 #include "base/i18n/rtl.h" |
8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
9 #include "chrome/browser/profiles/avatar_menu_model.h" | 9 #include "chrome/browser/profiles/avatar_menu_model.h" |
10 #include "chrome/browser/profiles/profile_info_cache.h" | 10 #include "chrome/browser/profiles/profile_info_cache.h" |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 | 139 |
140 items_.push_back(item); | 140 items_.push_back(item); |
141 | 141 |
142 gtk_box_pack_start(GTK_BOX(items_vbox), item->widget(), TRUE, TRUE, 0); | 142 gtk_box_pack_start(GTK_BOX(items_vbox), item->widget(), TRUE, TRUE, 0); |
143 gtk_widget_set_can_focus(item->widget(), TRUE); | 143 gtk_widget_set_can_focus(item->widget(), TRUE); |
144 if (menu_item.active) | 144 if (menu_item.active) |
145 gtk_container_set_focus_child(GTK_CONTAINER(items_vbox), item->widget()); | 145 gtk_container_set_focus_child(GTK_CONTAINER(items_vbox), item->widget()); |
146 } | 146 } |
147 | 147 |
148 gtk_box_pack_start(GTK_BOX(contents_), items_vbox, TRUE, TRUE, 0); | 148 gtk_box_pack_start(GTK_BOX(contents_), items_vbox, TRUE, TRUE, 0); |
149 gtk_box_pack_start(GTK_BOX(contents_), gtk_hseparator_new(), TRUE, TRUE, 0); | |
150 | 149 |
151 // The new profile link. | 150 if (avatar_menu_model_->ShouldShowAddNewProfileLink()) { |
152 new_profile_link_ = theme_service_->BuildChromeLinkButton( | 151 gtk_box_pack_start(GTK_BOX(contents_), gtk_hseparator_new(), TRUE, TRUE, 0); |
153 l10n_util::GetStringUTF8(IDS_PROFILES_CREATE_NEW_PROFILE_LINK)); | |
154 g_signal_connect(new_profile_link_, "clicked", | |
155 G_CALLBACK(OnNewProfileLinkClickedThunk), this); | |
156 | 152 |
157 GtkWidget* link_align = gtk_alignment_new(0, 0, 0, 0); | 153 // The new profile link. |
158 gtk_alignment_set_padding(GTK_ALIGNMENT(link_align), | 154 new_profile_link_ = theme_service_->BuildChromeLinkButton( |
159 0, 0, kNewProfileLinkLeftPadding, 0); | 155 l10n_util::GetStringUTF8(IDS_PROFILES_CREATE_NEW_PROFILE_LINK)); |
160 gtk_container_add(GTK_CONTAINER(link_align), new_profile_link_); | 156 g_signal_connect(new_profile_link_, "clicked", |
| 157 G_CALLBACK(OnNewProfileLinkClickedThunk), this); |
161 | 158 |
162 gtk_box_pack_start(GTK_BOX(contents_), link_align, FALSE, FALSE, 0); | 159 GtkWidget* link_align = gtk_alignment_new(0, 0, 0, 0); |
| 160 gtk_alignment_set_padding(GTK_ALIGNMENT(link_align), |
| 161 0, 0, kNewProfileLinkLeftPadding, 0); |
| 162 gtk_container_add(GTK_CONTAINER(link_align), new_profile_link_); |
| 163 |
| 164 gtk_box_pack_start(GTK_BOX(contents_), link_align, FALSE, FALSE, 0); |
| 165 } |
163 } | 166 } |
164 | 167 |
165 void AvatarMenuBubbleGtk::CloseBubble() { | 168 void AvatarMenuBubbleGtk::CloseBubble() { |
166 if (bubble_) { | 169 if (bubble_) { |
167 bubble_->Close(); | 170 bubble_->Close(); |
168 bubble_ = NULL; | 171 bubble_ = NULL; |
169 } | 172 } |
170 } | 173 } |
OLD | NEW |