OLD | NEW |
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/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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 | 126 |
127 contents_ = gtk_vbox_new(FALSE, ui::kControlSpacing); | 127 contents_ = gtk_vbox_new(FALSE, ui::kControlSpacing); |
128 gtk_container_set_border_width(GTK_CONTAINER(contents_), | 128 gtk_container_set_border_width(GTK_CONTAINER(contents_), |
129 ui::kContentAreaBorder); | 129 ui::kContentAreaBorder); |
130 g_signal_connect(contents_, "size-request", | 130 g_signal_connect(contents_, "size-request", |
131 G_CALLBACK(OnSizeRequestThunk), this); | 131 G_CALLBACK(OnSizeRequestThunk), this); |
132 | 132 |
133 GtkWidget* items_vbox = gtk_vbox_new(FALSE, ui::kContentAreaSpacing); | 133 GtkWidget* items_vbox = gtk_vbox_new(FALSE, ui::kContentAreaSpacing); |
134 | 134 |
135 for (size_t i = 0; i < profile_count; ++i) { | 135 for (size_t i = 0; i < profile_count; ++i) { |
| 136 AvatarMenuModel::Item menu_item = avatar_menu_model_->GetItemAt(i); |
136 AvatarMenuItemGtk* item = new AvatarMenuItemGtk( | 137 AvatarMenuItemGtk* item = new AvatarMenuItemGtk( |
137 this, avatar_menu_model_->GetItemAt(i), i, theme_service_); | 138 this, menu_item, i, theme_service_); |
138 | 139 |
139 items_.push_back(item); | 140 items_.push_back(item); |
140 | 141 |
141 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); |
| 144 if (menu_item.active) |
| 145 gtk_container_set_focus_child(GTK_CONTAINER(items_vbox), item->widget()); |
142 } | 146 } |
143 | 147 |
144 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); |
145 gtk_box_pack_start(GTK_BOX(contents_), gtk_hseparator_new(), TRUE, TRUE, 0); | 149 gtk_box_pack_start(GTK_BOX(contents_), gtk_hseparator_new(), TRUE, TRUE, 0); |
146 | 150 |
147 // The new profile link. | 151 // The new profile link. |
148 new_profile_link_ = gtk_chrome_link_button_new( | 152 new_profile_link_ = gtk_chrome_link_button_new( |
149 l10n_util::GetStringUTF8(IDS_PROFILES_CREATE_NEW_PROFILE_LINK).c_str()); | 153 l10n_util::GetStringUTF8(IDS_PROFILES_CREATE_NEW_PROFILE_LINK).c_str()); |
150 g_signal_connect(new_profile_link_, "clicked", | 154 g_signal_connect(new_profile_link_, "clicked", |
151 G_CALLBACK(OnNewProfileLinkClickedThunk), this); | 155 G_CALLBACK(OnNewProfileLinkClickedThunk), this); |
152 | 156 |
153 GtkWidget* link_align = gtk_alignment_new(0, 0, 0, 0); | 157 GtkWidget* link_align = gtk_alignment_new(0, 0, 0, 0); |
154 gtk_alignment_set_padding(GTK_ALIGNMENT(link_align), | 158 gtk_alignment_set_padding(GTK_ALIGNMENT(link_align), |
155 0, 0, kNewProfileLinkLeftPadding, 0); | 159 0, 0, kNewProfileLinkLeftPadding, 0); |
156 gtk_container_add(GTK_CONTAINER(link_align), new_profile_link_); | 160 gtk_container_add(GTK_CONTAINER(link_align), new_profile_link_); |
157 | 161 |
158 gtk_box_pack_start(GTK_BOX(contents_), link_align, FALSE, FALSE, 0); | 162 gtk_box_pack_start(GTK_BOX(contents_), link_align, FALSE, FALSE, 0); |
159 } | 163 } |
OLD | NEW |