| 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_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.h" | 10 #include "base/message_loop.h" |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 g_free(markup); | 287 g_free(markup); |
| 288 gtk_misc_set_alignment(GTK_MISC(status_label_), 0, 0); | 288 gtk_misc_set_alignment(GTK_MISC(status_label_), 0, 0); |
| 289 gtk_widget_set_no_show_all(status_label_, TRUE); | 289 gtk_widget_set_no_show_all(status_label_, TRUE); |
| 290 gtk_box_pack_start(GTK_BOX(item_vbox), status_label_, FALSE, FALSE, 0); | 290 gtk_box_pack_start(GTK_BOX(item_vbox), status_label_, FALSE, FALSE, 0); |
| 291 gtk_widget_show(status_label_); | 291 gtk_widget_show(status_label_); |
| 292 | 292 |
| 293 if (item_.active) { | 293 if (item_.active) { |
| 294 // The "edit your profile" link. | 294 // The "edit your profile" link. |
| 295 edit_profile_link_ = gtk_chrome_link_button_new( | 295 edit_profile_link_ = gtk_chrome_link_button_new( |
| 296 l10n_util::GetStringUTF8(IDS_PROFILES_EDIT_PROFILE_LINK).c_str()); | 296 l10n_util::GetStringUTF8(IDS_PROFILES_EDIT_PROFILE_LINK).c_str()); |
| 297 // Fix for bug#107348. edit link steals focus from menu item which |
| 298 // hides edit link button in focus-out-event handler, |
| 299 // so, it misses the click event. |
| 300 gtk_widget_set_can_focus(edit_profile_link_, FALSE); |
| 297 | 301 |
| 298 link_alignment_ = gtk_alignment_new(0, 0, 0, 0); | 302 link_alignment_ = gtk_alignment_new(0, 0, 0, 0); |
| 299 gtk_container_add(GTK_CONTAINER(link_alignment_), edit_profile_link_); | 303 gtk_container_add(GTK_CONTAINER(link_alignment_), edit_profile_link_); |
| 300 | 304 |
| 301 // The chrome link button contains a label that won't be shown if the button | 305 // The chrome link button contains a label that won't be shown if the button |
| 302 // is set to "no show all", so show all first. | 306 // is set to "no show all", so show all first. |
| 303 gtk_widget_show_all(link_alignment_); | 307 gtk_widget_show_all(link_alignment_); |
| 304 gtk_widget_set_no_show_all(link_alignment_, TRUE); | 308 gtk_widget_set_no_show_all(link_alignment_, TRUE); |
| 305 gtk_widget_hide(link_alignment_); | 309 gtk_widget_hide(link_alignment_); |
| 306 | 310 |
| 307 gtk_box_pack_start(GTK_BOX(item_vbox), link_alignment_, FALSE, FALSE, 0); | 311 gtk_box_pack_start(GTK_BOX(item_vbox), link_alignment_, FALSE, FALSE, 0); |
| 308 | 312 |
| 309 g_signal_connect(edit_profile_link_, "clicked", | 313 g_signal_connect(edit_profile_link_, "clicked", |
| 310 G_CALLBACK(OnEditProfileLinkClickedThunk), this); | 314 G_CALLBACK(OnEditProfileLinkClickedThunk), this); |
| 311 | 315 |
| 312 GtkSizeGroup* size_group = gtk_size_group_new(GTK_SIZE_GROUP_BOTH); | 316 GtkSizeGroup* size_group = gtk_size_group_new(GTK_SIZE_GROUP_BOTH); |
| 313 gtk_size_group_add_widget(size_group, status_label_); | 317 gtk_size_group_add_widget(size_group, status_label_); |
| 314 gtk_size_group_add_widget(size_group, link_alignment_); | 318 gtk_size_group_add_widget(size_group, link_alignment_); |
| 315 g_object_unref(size_group); | 319 g_object_unref(size_group); |
| 316 } | 320 } |
| 317 | 321 |
| 318 gtk_box_pack_start(GTK_BOX(item_hbox), item_vbox, TRUE, TRUE, 0); | 322 gtk_box_pack_start(GTK_BOX(item_hbox), item_vbox, TRUE, TRUE, 0); |
| 319 gtk_container_add(GTK_CONTAINER(widget_.get()), item_hbox); | 323 gtk_container_add(GTK_CONTAINER(widget_.get()), item_hbox); |
| 320 } | 324 } |
| OLD | NEW |